diff options
author | uvok | 2025-04-18 19:10:02 +0200 |
---|---|---|
committer | uvok | 2025-04-18 19:10:02 +0200 |
commit | 728914b4457bd84181b05d40275af4ccda19d616 (patch) | |
tree | 7d7ccc274a3f55133e64eedff3a87ff9603c47dc /test_trade_queue.py | |
parent | 49d5bfc8124f47d91ba12af3fa8fb409f41f479a (diff) |
Add test for in-order trades
Diffstat (limited to 'test_trade_queue.py')
-rw-r--r-- | test_trade_queue.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test_trade_queue.py b/test_trade_queue.py index f43487d..032f864 100644 --- a/test_trade_queue.py +++ b/test_trade_queue.py @@ -142,6 +142,16 @@ class TestFIFOQueueRemove(unittest.TestCase): self.fifo_queue.add(Decimal("10"), Decimal("100"), "2025-04-18") # Duplicate date for testing + def test_add_in_order(self): + """ + Test whether trades are ordered by date. + """ + self.fifo_queue.add(Decimal("10"), Decimal("100"), "2025-04-01") + lt = self.fifo_queue.get_copy() + self.assertTrue( + all(lt[i].date <= lt[i+1].date for i in range(len(lt) - 1)) + ) + def test_remove_successful(self): """ Test removing a trade successfully using a matching predicate. |