From 04dc14a74c1626120268f53b426758e54ab36804 Mon Sep 17 00:00:00 2001 From: Sam Germain Date: Thu, 4 Nov 2021 23:26:13 -0600 Subject: [PATCH] Added okex exchange class futures properties --- freqtrade/exchange/okex.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/freqtrade/exchange/okex.py b/freqtrade/exchange/okex.py index 5ab6f3147..100bf3adf 100644 --- a/freqtrade/exchange/okex.py +++ b/freqtrade/exchange/okex.py @@ -1,6 +1,7 @@ import logging -from typing import Dict +from typing import Dict, List, Tuple +from freqtrade.enums import Collateral, TradingMode from freqtrade.exchange import Exchange @@ -16,3 +17,29 @@ class Okex(Exchange): _ft_has: Dict = { "ohlcv_candle_limit": 100, } + funding_fee_times: List[int] = [0, 8, 16] # hours of the day + + _supported_trading_mode_collateral_pairs: List[Tuple[TradingMode, Collateral]] = [ + # TradingMode.SPOT always supported and not required in this list + # (TradingMode.MARGIN, Collateral.CROSS), # TODO-lev: Uncomment once supported + # (TradingMode.FUTURES, Collateral.CROSS), # TODO-lev: Uncomment once supported + # (TradingMode.FUTURES, Collateral.ISOLATED) # TODO-lev: Uncomment once supported + ] + + @property + def _ccxt_config(self) -> Dict: + # Parameters to add directly to ccxt sync/async initialization. + if self.trading_mode == TradingMode.MARGIN: + return { + "options": { + "defaultType": "margin" + } + } + elif self.trading_mode == TradingMode.FUTURES: + return { + "options": { + "defaultType": "swap" + } + } + else: + return {}