Changed TODO-mg to TODO-lev
This commit is contained in:
parent
5e7ffb75c5
commit
a30926005c
@ -66,7 +66,7 @@ def migrate_trades_table(decl_base, inspector, engine, table_back_name: str, col
|
|||||||
close_profit_abs = get_column_def(
|
close_profit_abs = get_column_def(
|
||||||
cols, 'close_profit_abs',
|
cols, 'close_profit_abs',
|
||||||
f"(amount * close_rate * (1 - {fee_close})) - {open_trade_value}")
|
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')
|
sell_order_status = get_column_def(cols, 'sell_order_status', 'null')
|
||||||
amount_requested = get_column_def(cols, 'amount_requested', 'amount')
|
amount_requested = get_column_def(cols, 'amount_requested', 'amount')
|
||||||
|
|
||||||
|
@ -545,10 +545,11 @@ class LocalTrade():
|
|||||||
elif order_type in ('market', 'limit') and self.exit_side == order['side']:
|
elif order_type in ('market', 'limit') and self.exit_side == order['side']:
|
||||||
if self.is_open:
|
if self.is_open:
|
||||||
payment = "BUY" if self.is_short else "SELL"
|
payment = "BUY" if self.is_short else "SELL"
|
||||||
# TODO-mg: On shorts, you buy a little bit more than the amount (amount + interest)
|
# TODO-lev: On shorts, you buy a little bit more than the amount (amount + interest)
|
||||||
# This wll only print the original amount
|
# TODO-lev: This wll only print the original amount
|
||||||
logger.info(f'{order_type.upper()}_{payment} has been fulfilled for {self}.')
|
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'):
|
elif order_type in ('stop_loss_limit', 'stop-loss', 'stop-loss-limit', 'stop'):
|
||||||
self.stoploss_order_id = None
|
self.stoploss_order_id = None
|
||||||
self.close_rate_requested = self.stop_loss
|
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)
|
max_rate = Column(Float, nullable=True, default=0.0)
|
||||||
# Lowest price reached
|
# Lowest price reached
|
||||||
min_rate = Column(Float, nullable=True)
|
min_rate = Column(Float, nullable=True)
|
||||||
sell_reason = Column(String(100), nullable=True) # TODO-mg: Change to close_reason
|
sell_reason = Column(String(100), nullable=True) # TODO-lev: Change to close_reason
|
||||||
sell_order_status = Column(String(100), nullable=True) # TODO-mg: Change to close_order_status
|
sell_order_status = Column(String(100), nullable=True) # TODO-lev: Change to close_order_status
|
||||||
strategy = Column(String(100), nullable=True)
|
strategy = Column(String(100), nullable=True)
|
||||||
buy_tag = Column(String(100), nullable=True)
|
buy_tag = Column(String(100), nullable=True)
|
||||||
timeframe = Column(Integer, nullable=True)
|
timeframe = Column(Integer, nullable=True)
|
||||||
|
@ -380,7 +380,7 @@ def short_trade(fee):
|
|||||||
open_order_id='dry_run_exit_short_12345',
|
open_order_id='dry_run_exit_short_12345',
|
||||||
strategy='DefaultStrategy',
|
strategy='DefaultStrategy',
|
||||||
timeframe=5,
|
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),
|
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=20),
|
||||||
# close_date=datetime.now(tz=timezone.utc) - timedelta(minutes=2),
|
# close_date=datetime.now(tz=timezone.utc) - timedelta(minutes=2),
|
||||||
is_short=True,
|
is_short=True,
|
||||||
@ -470,7 +470,7 @@ def leverage_trade(fee):
|
|||||||
open_order_id='dry_run_leverage_buy_12368',
|
open_order_id='dry_run_leverage_buy_12368',
|
||||||
strategy='DefaultStrategy',
|
strategy='DefaultStrategy',
|
||||||
timeframe=5,
|
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),
|
open_date=datetime.now(tz=timezone.utc) - timedelta(minutes=300),
|
||||||
close_date=datetime.now(tz=timezone.utc),
|
close_date=datetime.now(tz=timezone.utc),
|
||||||
interest_rate=0.0005,
|
interest_rate=0.0005,
|
||||||
|
@ -1575,7 +1575,7 @@ def test_adjust_stop_loss_short(fee):
|
|||||||
assert trade.initial_stop_loss_pct == 0.05
|
assert trade.initial_stop_loss_pct == 0.05
|
||||||
# Initial is true but stop_loss set - so doesn't do anything
|
# Initial is true but stop_loss set - so doesn't do anything
|
||||||
trade.adjust_stop_loss(0.3, -0.1, True)
|
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 == 1.05
|
||||||
assert trade.initial_stop_loss_pct == 0.05
|
assert trade.initial_stop_loss_pct == 0.05
|
||||||
assert trade.stop_loss_pct == 0.1
|
assert trade.stop_loss_pct == 0.1
|
||||||
|
Loading…
Reference in New Issue
Block a user