handle stop loss on exchange added
This commit is contained in:
@@ -178,7 +178,7 @@ class Trade(_DECL_BASE):
|
||||
# absolute value of the initial stop loss
|
||||
initial_stop_loss = Column(Float, nullable=True, default=0.0)
|
||||
# absolute value of the highest reached price
|
||||
stoploss_order_id = Column(Integer, nullable=True, index=True)
|
||||
stoploss_order_id = Column(String, nullable=True, index=True)
|
||||
max_rate = Column(Float, nullable=True, default=0.0)
|
||||
sell_reason = Column(String, nullable=True)
|
||||
strategy = Column(String, nullable=True)
|
||||
@@ -250,6 +250,9 @@ class Trade(_DECL_BASE):
|
||||
self.open_order_id = None
|
||||
elif order_type == 'limit' and order['side'] == 'sell':
|
||||
self.close(order['price'])
|
||||
elif order_type == 'stop_loss_limit':
|
||||
self.stoploss_order_id = None
|
||||
self.close(order['price'])
|
||||
else:
|
||||
raise ValueError(f'Unknown order type: {order_type}')
|
||||
cleanup()
|
||||
|
Reference in New Issue
Block a user