2024-07-14 07:14:44 +00:00
|
|
|
"""Hyperliquid exchange subclass"""
|
|
|
|
|
|
|
|
import logging
|
|
|
|
from typing import Dict
|
|
|
|
|
2024-09-02 04:57:02 +00:00
|
|
|
from freqtrade.enums import TradingMode
|
2024-07-14 07:14:44 +00:00
|
|
|
from freqtrade.exchange import Exchange
|
2024-09-04 05:15:17 +00:00
|
|
|
from freqtrade.exchange.exchange_types import FtHas
|
2024-07-14 07:14:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class Hyperliquid(Exchange):
|
|
|
|
"""Hyperliquid exchange class.
|
|
|
|
Contains adjustments needed for Freqtrade to work with this exchange.
|
|
|
|
"""
|
|
|
|
|
2024-09-04 05:15:17 +00:00
|
|
|
_ft_has: FtHas = {
|
2024-07-14 07:14:44 +00:00
|
|
|
# Only the most recent 5000 candles are available according to the
|
|
|
|
# exchange's API documentation.
|
2024-07-29 17:42:20 +00:00
|
|
|
"ohlcv_has_history": False,
|
2024-07-14 07:14:44 +00:00
|
|
|
"ohlcv_candle_limit": 5000,
|
|
|
|
"trades_has_history": False, # Trades endpoint doesn't seem available.
|
|
|
|
"exchange_has_overrides": {"fetchTrades": False},
|
|
|
|
}
|
2024-08-13 07:49:46 +00:00
|
|
|
|
2024-09-02 04:57:02 +00:00
|
|
|
@property
|
|
|
|
def _ccxt_config(self) -> Dict:
|
|
|
|
# Parameters to add directly to ccxt sync/async initialization.
|
|
|
|
# ccxt defaults to swap mode.
|
|
|
|
config = {}
|
|
|
|
if self.trading_mode == TradingMode.SPOT:
|
|
|
|
config.update({"options": {"defaultType": "spot"}})
|
|
|
|
config.update(super()._ccxt_config)
|
|
|
|
return config
|