Improve migrations

This commit is contained in:
Matthias 2023-08-13 14:56:05 +02:00
parent ae9f730624
commit 6b9547a9ad
2 changed files with 5 additions and 3 deletions

View File

@ -88,8 +88,9 @@ def migrate_trades_and_orders_table(
stop_loss_pct = get_column_def(cols, 'stop_loss_pct', 'null')
initial_stop_loss = get_column_def(cols, 'initial_stop_loss', '0.0')
initial_stop_loss_pct = get_column_def(cols, 'initial_stop_loss_pct', 'null')
is_stop_loss_trailing = get_column_def(cols, 'is_stop_loss_trailing',
'stop_loss_pct <> initial_stop_loss_pct')
is_stop_loss_trailing = get_column_def(
cols, 'is_stop_loss_trailing',
f'coalesce({stop_loss_pct}, 0.0) <> coalesce({initial_stop_loss_pct}, 0.0)')
stoploss_order_id = get_column_def(cols, 'stoploss_order_id', 'null')
stoploss_last_update = get_column_def(cols, 'stoploss_last_update', 'null')
max_rate = get_column_def(cols, 'max_rate', '0.0')

View File

@ -52,4 +52,5 @@ def test_strategy_test_v3(dataframe_1m, fee, is_short, side):
side=side) is True
assert strategy.custom_stoploss(pair='ETH/BTC', trade=trade, current_time=datetime.now(),
current_rate=20_000, current_profit=0.05) == strategy.stoploss
current_rate=20_000, current_profit=0.05, after_fill=False
) == strategy.stoploss