diff options
author | uvok | 2025-04-18 19:46:01 +0200 |
---|---|---|
committer | uvok | 2025-04-18 19:46:01 +0200 |
commit | 58a5dac33d8fc37158f2190cf6d0501b15644a69 (patch) | |
tree | d0d31b0cd242db43c9c6e8bb1dd44577b9bc107d /test_ledger_process.py | |
parent | 2a1acf26c51e494f257e88a4f040eedd4ca779ac (diff) |
Add test
Diffstat (limited to 'test_ledger_process.py')
-rw-r--r-- | test_ledger_process.py | 45 |
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.""" |