2024-05-12 14:58:33 +00:00
|
|
|
"""HTX exchange subclass"""
|
|
|
|
|
2022-01-14 18:39:09 +00:00
|
|
|
import logging
|
|
|
|
from typing import Dict
|
|
|
|
|
2022-10-26 05:12:49 +00:00
|
|
|
from freqtrade.constants import BuySell
|
2022-01-14 18:39:09 +00:00
|
|
|
from freqtrade.exchange import Exchange
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2024-01-20 16:13:09 +00:00
|
|
|
class Htx(Exchange):
|
2022-01-14 18:39:09 +00:00
|
|
|
"""
|
2024-01-20 16:13:09 +00:00
|
|
|
HTX exchange class. Contains adjustments needed for Freqtrade to work
|
2022-01-14 18:39:09 +00:00
|
|
|
with this exchange.
|
|
|
|
"""
|
|
|
|
|
|
|
|
_ft_has: Dict = {
|
2022-01-30 13:15:07 +00:00
|
|
|
"stoploss_on_exchange": True,
|
2023-09-28 17:33:59 +00:00
|
|
|
"stop_price_param": "stopPrice",
|
|
|
|
"stop_price_prop": "stopPrice",
|
2022-02-26 09:44:38 +00:00
|
|
|
"stoploss_order_types": {"limit": "stop-limit"},
|
2022-02-25 14:50:45 +00:00
|
|
|
"ohlcv_candle_limit": 1000,
|
2022-02-27 10:56:22 +00:00
|
|
|
"l2_limit_range": [5, 10, 20],
|
|
|
|
"l2_limit_range_required": False,
|
2024-05-26 13:49:48 +00:00
|
|
|
"ohlcv_candle_limit_per_timeframe": {
|
|
|
|
"1w": 500,
|
|
|
|
"1M": 500,
|
|
|
|
},
|
2022-01-14 18:39:09 +00:00
|
|
|
}
|
2022-01-30 13:15:07 +00:00
|
|
|
|
2022-10-26 05:12:49 +00:00
|
|
|
def _get_stop_params(self, side: BuySell, ordertype: str, stop_price: float) -> Dict:
|
2022-02-26 09:44:38 +00:00
|
|
|
params = self._params.copy()
|
2024-05-12 14:58:33 +00:00
|
|
|
params.update(
|
|
|
|
{
|
|
|
|
"stopPrice": stop_price,
|
|
|
|
"operator": "lte",
|
|
|
|
}
|
|
|
|
)
|
2022-02-26 09:44:38 +00:00
|
|
|
return params
|