From dd9a4c3d5d9617d3b3664f332db02ba99a61b223 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Mon, 22 Jul 2024 16:05:42 +0200 Subject: [PATCH] Executed time --- crypto_seller/__init__.py | 3 ++- crypto_seller/order_csv.py | 1 + test/test_auto_sell.py | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto_seller/__init__.py b/crypto_seller/__init__.py index fca054d..5218b61 100644 --- a/crypto_seller/__init__.py +++ b/crypto_seller/__init__.py @@ -68,7 +68,8 @@ most mature on the danish market, and does support KuCoin. * Show errors to log. * Stop loop and exit with results, and error indicator. - [ ] Document configuration -- [ ] Document auditing +- [ ] Document code auditing +- [X] Ensure sell time is included in order details - [X] Log all trades to CSV file. - [X] Collect information during the run and output after run diff --git a/crypto_seller/order_csv.py b/crypto_seller/order_csv.py index 79434a8..988e837 100644 --- a/crypto_seller/order_csv.py +++ b/crypto_seller/order_csv.py @@ -10,6 +10,7 @@ class CsvFileLogger: def __call__(self, trade_order: fin_depo.data.TradeOrderDetails): fieldnames: list[str] = [ + 'executed_time', 'input_asset', 'input_amount', 'output_asset', diff --git a/test/test_auto_sell.py b/test/test_auto_sell.py index 25f1613..7b8ecb1 100644 --- a/test/test_auto_sell.py +++ b/test/test_auto_sell.py @@ -30,7 +30,10 @@ class SellerMock(fin_depo.data.DepoFetcher): assert input_amount <= self.amount_left, 'Attempt to sell too much' self.amount_left -= input_amount + executed_time = datetime.datetime.now(tz=datetime.UTC) + return fin_depo.data.TradeOrderDetails( + executed_time = executed_time, input_asset=input_asset, input_amount=input_amount, output_asset=output_asset,