freqtrade_origin/freqtrade/exchange/huobi.py

40 lines
1.0 KiB
Python
Raw Normal View History

2022-01-14 18:39:09 +00:00
""" Huobi exchange subclass """
import logging
from typing import Dict
from freqtrade.exchange import Exchange
logger = logging.getLogger(__name__)
class Huobi(Exchange):
"""
Huobi exchange class. Contains adjustments needed for Freqtrade to work
with this exchange.
"""
_ft_has: Dict = {
2022-01-30 13:15:07 +00:00
"stoploss_on_exchange": True,
2022-02-26 09:44:38 +00:00
"stoploss_order_types": {"limit": "stop-limit"},
"ohlcv_candle_limit": 1000,
2022-02-27 10:56:22 +00:00
"l2_limit_range": [5, 10, 20],
"l2_limit_range_required": False,
2022-01-14 18:39:09 +00:00
}
2022-01-30 13:15:07 +00:00
def stoploss_adjust(self, stop_loss: float, order: Dict) -> bool:
"""
Verify stop_loss against stoploss-order value (limit or price)
Returns True if adjustment is necessary.
"""
return order['type'] == 'stop' and stop_loss > float(order['stopPrice'])
2022-02-26 09:44:38 +00:00
def _get_stop_params(self, ordertype: str, stop_price: float) -> Dict:
2022-01-30 13:15:07 +00:00
2022-02-26 09:44:38 +00:00
params = self._params.copy()
params.update({
"stopPrice": stop_price,
"operator": "lte",
})
return params