mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 12:13:57 +00:00
remove all occurence of stoploss_order_id in trade_model, update api schemas, update rpc_delete
This commit is contained in:
parent
2bb68ca53d
commit
aaa82e1fa9
|
@ -636,7 +636,6 @@ class LocalTrade:
|
||||||
'stop_loss_abs': self.stop_loss,
|
'stop_loss_abs': self.stop_loss,
|
||||||
'stop_loss_ratio': self.stop_loss_pct if self.stop_loss_pct else None,
|
'stop_loss_ratio': self.stop_loss_pct if self.stop_loss_pct else None,
|
||||||
'stop_loss_pct': (self.stop_loss_pct * 100) if self.stop_loss_pct else None,
|
'stop_loss_pct': (self.stop_loss_pct * 100) if self.stop_loss_pct else None,
|
||||||
'stoploss_order_id': self.stoploss_order_id,
|
|
||||||
'stoploss_last_update': (self.stoploss_last_update.strftime(DATETIME_PRINT_FORMAT)
|
'stoploss_last_update': (self.stoploss_last_update.strftime(DATETIME_PRINT_FORMAT)
|
||||||
if self.stoploss_last_update else None),
|
if self.stoploss_last_update else None),
|
||||||
'stoploss_last_update_timestamp': int(self.stoploss_last_update.replace(
|
'stoploss_last_update_timestamp': int(self.stoploss_last_update.replace(
|
||||||
|
@ -787,7 +786,6 @@ class LocalTrade:
|
||||||
logger.info(f'{order.order_type.upper()}_{payment} has been fulfilled for {self}.')
|
logger.info(f'{order.order_type.upper()}_{payment} has been fulfilled for {self}.')
|
||||||
|
|
||||||
elif order.ft_order_side == 'stoploss' and order.status not in ('open', ):
|
elif order.ft_order_side == 'stoploss' and order.status not in ('open', ):
|
||||||
self.stoploss_order_id = None
|
|
||||||
self.close_rate_requested = self.stop_loss
|
self.close_rate_requested = self.stop_loss
|
||||||
self.exit_reason = ExitType.STOPLOSS_ON_EXCHANGE.value
|
self.exit_reason = ExitType.STOPLOSS_ON_EXCHANGE.value
|
||||||
if self.is_open and order.safe_filled > 0:
|
if self.is_open and order.safe_filled > 0:
|
||||||
|
@ -1378,9 +1376,6 @@ class Trade(ModelBase, LocalTrade):
|
||||||
Float(), nullable=True) # type: ignore
|
Float(), nullable=True) # type: ignore
|
||||||
is_stop_loss_trailing: Mapped[bool] = mapped_column(
|
is_stop_loss_trailing: Mapped[bool] = mapped_column(
|
||||||
nullable=False, default=False) # type: ignore
|
nullable=False, default=False) # type: ignore
|
||||||
# stoploss order id which is on exchange
|
|
||||||
stoploss_order_id: Mapped[Optional[str]] = mapped_column(
|
|
||||||
String(255), nullable=True, index=True) # type: ignore
|
|
||||||
# last update time of the stoploss order on exchange
|
# last update time of the stoploss order on exchange
|
||||||
stoploss_last_update: Mapped[Optional[datetime]] = mapped_column(nullable=True) # type: ignore
|
stoploss_last_update: Mapped[Optional[datetime]] = mapped_column(nullable=True) # type: ignore
|
||||||
# absolute value of the highest reached price
|
# absolute value of the highest reached price
|
||||||
|
@ -1805,7 +1800,6 @@ class Trade(ModelBase, LocalTrade):
|
||||||
exit_order_status=data["exit_order_status"],
|
exit_order_status=data["exit_order_status"],
|
||||||
stop_loss=data["stop_loss_abs"],
|
stop_loss=data["stop_loss_abs"],
|
||||||
stop_loss_pct=data["stop_loss_ratio"],
|
stop_loss_pct=data["stop_loss_ratio"],
|
||||||
stoploss_order_id=data["stoploss_order_id"],
|
|
||||||
stoploss_last_update=(
|
stoploss_last_update=(
|
||||||
datetime.fromtimestamp(data["stoploss_last_update_timestamp"] // 1000,
|
datetime.fromtimestamp(data["stoploss_last_update_timestamp"] // 1000,
|
||||||
tz=timezone.utc)
|
tz=timezone.utc)
|
||||||
|
|
|
@ -299,7 +299,6 @@ class TradeSchema(BaseModel):
|
||||||
stop_loss_abs: Optional[float] = None
|
stop_loss_abs: Optional[float] = None
|
||||||
stop_loss_ratio: Optional[float] = None
|
stop_loss_ratio: Optional[float] = None
|
||||||
stop_loss_pct: Optional[float] = None
|
stop_loss_pct: Optional[float] = None
|
||||||
stoploss_order_id: Optional[str] = None
|
|
||||||
stoploss_last_update: Optional[str] = None
|
stoploss_last_update: Optional[str] = None
|
||||||
stoploss_last_update_timestamp: Optional[int] = None
|
stoploss_last_update_timestamp: Optional[int] = None
|
||||||
initial_stop_loss_abs: Optional[float] = None
|
initial_stop_loss_abs: Optional[float] = None
|
||||||
|
|
|
@ -978,12 +978,13 @@ class RPC:
|
||||||
except (ExchangeError):
|
except (ExchangeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# cancel stoploss on exchange ...
|
# cancel stoploss on exchange orders ...
|
||||||
if (self._freqtrade.strategy.order_types.get('stoploss_on_exchange')
|
if (self._freqtrade.strategy.order_types.get('stoploss_on_exchange')
|
||||||
and trade.stoploss_order_id):
|
and trade.has_open_sl_orders):
|
||||||
|
|
||||||
|
for oslo in trade.open_sl_orders:
|
||||||
try:
|
try:
|
||||||
self._freqtrade.exchange.cancel_stoploss_order(trade.stoploss_order_id,
|
self._freqtrade.exchange.cancel_stoploss_order(oslo.order_id, trade.pair)
|
||||||
trade.pair)
|
|
||||||
c_count += 1
|
c_count += 1
|
||||||
except (ExchangeError):
|
except (ExchangeError):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue
Block a user