|
|
|
|
@ -740,17 +740,7 @@ class RPC:
|
|
|
|
|
self._freqtrade.wallets.update()
|
|
|
|
|
return {'result': f'Created sell order for trade {trade_id}.'}
|
|
|
|
|
|
|
|
|
|
def _rpc_force_entry(self, pair: str, price: Optional[float], *,
|
|
|
|
|
order_type: Optional[str] = None,
|
|
|
|
|
order_side: SignalDirection = SignalDirection.LONG,
|
|
|
|
|
stake_amount: Optional[float] = None,
|
|
|
|
|
enter_tag: Optional[str] = 'force_entry',
|
|
|
|
|
leverage: Optional[float] = None) -> Optional[Trade]:
|
|
|
|
|
"""
|
|
|
|
|
Handler for forcebuy <asset> <price>
|
|
|
|
|
Buys a pair trade at the given or current price
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def _force_entry_validations(self, pair: str, order_side: SignalDirection):
|
|
|
|
|
if not self._freqtrade.config.get('force_entry_enable', False):
|
|
|
|
|
raise RPCException('Force_entry not enabled.')
|
|
|
|
|
|
|
|
|
|
@ -760,11 +750,26 @@ class RPC:
|
|
|
|
|
if order_side == SignalDirection.SHORT and self._freqtrade.trading_mode == TradingMode.SPOT:
|
|
|
|
|
raise RPCException("Can't go short on Spot markets.")
|
|
|
|
|
|
|
|
|
|
if pair not in self._freqtrade.exchange.get_markets(tradable_only=True):
|
|
|
|
|
raise RPCException('Symbol does not exist or market is not active.')
|
|
|
|
|
# Check if pair quote currency equals to the stake currency.
|
|
|
|
|
stake_currency = self._freqtrade.config.get('stake_currency')
|
|
|
|
|
if not self._freqtrade.exchange.get_pair_quote_currency(pair) == stake_currency:
|
|
|
|
|
raise RPCException(
|
|
|
|
|
f'Wrong pair selected. Only pairs with stake-currency {stake_currency} allowed.')
|
|
|
|
|
|
|
|
|
|
def _rpc_force_entry(self, pair: str, price: Optional[float], *,
|
|
|
|
|
order_type: Optional[str] = None,
|
|
|
|
|
order_side: SignalDirection = SignalDirection.LONG,
|
|
|
|
|
stake_amount: Optional[float] = None,
|
|
|
|
|
enter_tag: Optional[str] = 'force_entry',
|
|
|
|
|
leverage: Optional[float] = None) -> Optional[Trade]:
|
|
|
|
|
"""
|
|
|
|
|
Handler for forcebuy <asset> <price>
|
|
|
|
|
Buys a pair trade at the given or current price
|
|
|
|
|
"""
|
|
|
|
|
self._force_entry_validations(pair, order_side)
|
|
|
|
|
|
|
|
|
|
# check if valid pair
|
|
|
|
|
|
|
|
|
|
# check if pair already has an open pair
|
|
|
|
|
|