summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test_ledger_process.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/test_ledger_process.py b/test_ledger_process.py
index cf5e64c..0824a7b 100644
--- a/test_ledger_process.py
+++ b/test_ledger_process.py
@@ -66,6 +66,51 @@ class TestLedgerProcess(unittest.TestCase):
with self.assertRaises(TradeNotFound):
self.lp.process_ledger([deposit])
+ def test_deposit_before_trade(self):
+ """Test depositing before the trade occurred.
+
+ Can't work anyway b/c there's no matching withdraw.
+ """
+
+ withdrawal = LedgerAction(
+ type="withdrawal",
+ asset="BTC",
+ # already includes removed fee
+ amount=Decimal("-0.098"),
+ fee=Decimal("0.001"),
+ timestamp="2025-04-18 12:00:00",
+ refid="67890",
+ )
+
+ deposit = LedgerAction(
+ type="deposit",
+ asset="BTC",
+ amount=Decimal("0.098"),
+ fee=Decimal("0.001"),
+ timestamp="2024-04-18 12:00:00",
+ refid="ABCDE",
+ )
+
+ eur_trade = LedgerAction(
+ type="trade",
+ asset="EUR",
+ amount=Decimal("-500.00"),
+ fee=Decimal("2.00"),
+ timestamp="2025-04-17 10:00:00",
+ refid="12345",
+ )
+ crypto_trade = LedgerAction(
+ type="trade",
+ asset="BTC",
+ amount=Decimal("0.1"),
+ fee=Decimal("0.001"),
+ timestamp="2025-04-17 10:00:00",
+ refid="12345",
+ )
+
+ with self.assertRaises(TradeNotFound):
+ self.lp.process_ledger([eur_trade, withdrawal, crypto_trade, deposit])
+
def test_withdraw_before_trade(self):
"""Test withdrawing before the trade occurred."""