Fix migrations to use unique key
This commit is contained in:
parent
2ca6547baf
commit
1a305ea8b0
@ -1263,7 +1263,9 @@ class FreqtradeBot:
|
||||
except InvalidOrderException as exception:
|
||||
logger.warning('Unable to fetch order %s: %s', order_id, exception)
|
||||
return False
|
||||
|
||||
trade.update_order(order)
|
||||
|
||||
# Try update amount (binance-fix)
|
||||
try:
|
||||
new_amount = self.get_real_amount(trade, order, order_amount)
|
||||
|
@ -108,14 +108,14 @@ def migrate_trades_table(decl_base, inspector, engine, table_back_name: str, col
|
||||
|
||||
def migrate_open_orders_to_trades(engine):
|
||||
engine.execute("""
|
||||
insert into orders (trade_id, order_id, ft_order_side)
|
||||
select id, open_order_id,
|
||||
insert into orders (trade_id, ft_pair, order_id, ft_order_side)
|
||||
select id trade_id, pair ft_pair, open_order_id,
|
||||
case when close_rate_requested is null then 'buy'
|
||||
else 'sell' end ft_order_side
|
||||
from trades
|
||||
where open_order_id is not null
|
||||
union all
|
||||
select id, stoploss_order_id, 'stoploss'
|
||||
select id trade_id, pair ft_pair, stoploss_order_id order_id, 'stoploss' ft_order_side
|
||||
from trades
|
||||
where stoploss_order_id is not null
|
||||
""")
|
||||
|
@ -1396,7 +1396,7 @@ def test_handle_stoploss_on_exchange_trailing(mocker, default_conf, fee,
|
||||
}))
|
||||
|
||||
cancel_order_mock = MagicMock()
|
||||
stoploss_order_mock = MagicMock()
|
||||
stoploss_order_mock = MagicMock(return_value={'id': 13434334})
|
||||
mocker.patch('freqtrade.exchange.Exchange.cancel_stoploss_order', cancel_order_mock)
|
||||
mocker.patch('freqtrade.exchange.Exchange.stoploss', stoploss_order_mock)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user