Update order_types to use entry/exit definition

This commit is contained in:
Matthias
2022-03-07 20:32:16 +01:00
parent 1ce55e88b4
commit e492bf3159
11 changed files with 41 additions and 41 deletions

View File

@@ -138,11 +138,11 @@ class UnfilledTimeout(BaseModel):
class OrderTypes(BaseModel):
buy: OrderTypeValues
sell: OrderTypeValues
emergencysell: Optional[OrderTypeValues]
forcesell: Optional[OrderTypeValues]
forcebuy: Optional[OrderTypeValues]
entry: OrderTypeValues
exit: OrderTypeValues
emergencyexit: Optional[OrderTypeValues]
forceexit: Optional[OrderTypeValues]
forceentry: Optional[OrderTypeValues]
stoploss: OrderTypeValues
stoploss_on_exchange: bool
stoploss_on_exchange_interval: Optional[int]

View File

@@ -708,7 +708,7 @@ class RPC:
trade.pair, refresh=False, side=trade.exit_side)
sell_reason = SellCheckTuple(sell_type=SellType.FORCE_SELL)
order_type = ordertype or self._freqtrade.strategy.order_types.get(
"forcesell", self._freqtrade.strategy.order_types["sell"])
"forceexit", self._freqtrade.strategy.order_types["exit"])
self._freqtrade.execute_trade_exit(
trade, current_rate, sell_reason, ordertype=order_type)
@@ -731,7 +731,7 @@ class RPC:
trade_filter=[Trade.id == trade_id, Trade.is_open.is_(True), ]
).first()
if not trade:
logger.warning('forcesell: Invalid argument received')
logger.warning('forceexit: Invalid argument received')
raise RPCException('invalid argument')
_exec_forcesell(trade)
@@ -780,7 +780,7 @@ class RPC:
# execute buy
if not order_type:
order_type = self._freqtrade.strategy.order_types.get(
'forcebuy', self._freqtrade.strategy.order_types['buy'])
'forceentry', self._freqtrade.strategy.order_types['entry'])
if self._freqtrade.execute_entry(pair, stake_amount, price,
ordertype=order_type, trade=trade,
is_short=is_short,

View File

@@ -944,7 +944,7 @@ class Telegram(RPCHandler):
return
try:
msg = self._rpc._rpc_forceexit(trade_id)
self._send_msg('Forcesell Result: `{result}`'.format(**msg))
self._send_msg('Forceexit Result: `{result}`'.format(**msg))
except RPCException as e:
self._send_msg(str(e))