From a30926005c665f93c7ee565d7f0a4ee6ae49a48a Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Sun, 1 Aug 2021 17:34:45 -0600 Subject: [PATCH] Changed TODO-mg to TODO-lev --- freqtrade/persistence/migrations.py | 2 +- freqtrade/persistence/models.py | 11 ++++++----- tests/conftest_trades.py | 4 ++-- tests/test_persistence.py | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/freqtrade/persistence/migrations.py b/freqtrade/persistence/migrations.py index 03f412724..9a6b09174 100644 --- a/freqtrade/persistence/migrations.py +++ b/freqtrade/persistence/migrations.py @@ -66,7 +66,7 @@ def migrate_trades_table(decl_base, inspector, engine, table_back_name: str, col close_profit_abs = get_column_def( cols, 'close_profit_abs', f"(amount * close_rate * (1 - {fee_close})) - {open_trade_value}") - # TODO-mg: update to exit order status + # TODO-lev: update to exit order status sell_order_status = get_column_def(cols, 'sell_order_status', 'null') amount_requested = get_column_def(cols, 'amount_requested', 'amount') diff --git a/freqtrade/persistence/models.py b/freqtrade/persistence/models.py index d09c5ed68..c596041f1 100644 --- a/freqtrade/persistence/models.py +++ b/freqtrade/persistence/models.py @@ -545,10 +545,11 @@ class LocalTrade(): elif order_type in ('market', 'limit') and self.exit_side == order['side']: if self.is_open: payment = "BUY" if self.is_short else "SELL" - # TODO-mg: On shorts, you buy a little bit more than the amount (amount + interest) - # This wll only print the original amount + # TODO-lev: On shorts, you buy a little bit more than the amount (amount + interest) + # TODO-lev: This wll only print the original amount logger.info(f'{order_type.upper()}_{payment} has been fulfilled for {self}.') - self.close(safe_value_fallback(order, 'average', 'price')) # TODO-mg: Double check this + # TODO-lev: Double check this + self.close(safe_value_fallback(order, 'average', 'price')) elif order_type in ('stop_loss_limit', 'stop-loss', 'stop-loss-limit', 'stop'): self.stoploss_order_id = None self.close_rate_requested = self.stop_loss @@ -883,8 +884,8 @@ class Trade(_DECL_BASE, LocalTrade): max_rate = Column(Float, nullable=True, default=0.0) # Lowest price reached min_rate = Column(Float, nullable=True) - sell_reason = Column(String(100), nullable=True) # TODO-mg: Change to close_reason - sell_order_status = Column(String(100), nullable=True) # TODO-mg: Change to close_order_status + sell_reason = Column(String(100), nullable=True) # TODO-lev: Change to close_reason + sell_order_status = Column(String(100), nullable=True) # TODO-lev: Change to close_order_status strategy = Column(String(100), nullable=True) buy_tag = Column(String(100), nullable=True) timeframe = Column(Integer, nullable=True) diff --git a/tests/conftest_trades.py b/tests/conftest_trades.py index cad6d195c..e1c17c0eb 100644 --- a/tests/conftest_trades.py +++ b/tests/conftest_trades.py @@ -380,7 +380,7 @@ def short_trade(fee): open_order_id='dry_run_exit_short_12345', strategy='DefaultStrategy', timeframe=5, - sell_reason='sell_signal', # TODO-mg: Update to exit/close reason + sell_reason='sell_signal', # TODO-lev: Update to exit/close reason open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=20), # close_date=datetime.now(tz=timezone.utc) - timedelta(minutes=2), is_short=True, @@ -470,7 +470,7 @@ def leverage_trade(fee): open_order_id='dry_run_leverage_buy_12368', strategy='DefaultStrategy', timeframe=5, - sell_reason='sell_signal', # TODO-mg: Update to exit/close reason + sell_reason='sell_signal', # TODO-lev: Update to exit/close reason open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=300), close_date=datetime.now(tz=timezone.utc), interest_rate=0.0005, diff --git a/tests/test_persistence.py b/tests/test_persistence.py index 16469f6fc..4a9407884 100644 --- a/tests/test_persistence.py +++ b/tests/test_persistence.py @@ -1575,7 +1575,7 @@ def test_adjust_stop_loss_short(fee): assert trade.initial_stop_loss_pct == 0.05 # Initial is true but stop_loss set - so doesn't do anything trade.adjust_stop_loss(0.3, -0.1, True) - assert round(trade.stop_loss, 8) == 0.66 # TODO-mg: What is this test? + assert round(trade.stop_loss, 8) == 0.66 assert trade.initial_stop_loss == 1.05 assert trade.initial_stop_loss_pct == 0.05 assert trade.stop_loss_pct == 0.1