removed binance constructor, added fill_leverage_brackets call to exchange constructor

This commit is contained in:
Sam Germain 2021-10-22 06:37:56 -06:00
parent 0329da1a57
commit f07555fc84
2 changed files with 6 additions and 8 deletions

View File

@ -2,7 +2,7 @@
import json import json
import logging import logging
from pathlib import Path from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple from typing import Dict, List, Optional, Tuple
import arrow import arrow
import ccxt import ccxt
@ -38,12 +38,6 @@ class Binance(Exchange):
# (TradingMode.FUTURES, Collateral.ISOLATED) # TODO-lev: Uncomment once supported # (TradingMode.FUTURES, Collateral.ISOLATED) # TODO-lev: Uncomment once supported
] ]
def __init__(self, config: Dict[str, Any], validate: bool = True) -> None:
super().__init__(config, validate)
self._leverage_brackets: Dict = {}
if self.trading_mode != TradingMode.SPOT:
self.fill_leverage_brackets()
@property @property
def _ccxt_config(self) -> Dict: def _ccxt_config(self) -> Dict:
# Parameters to add directly to ccxt sync/async initialization. # Parameters to add directly to ccxt sync/async initialization.

View File

@ -179,6 +179,10 @@ class Exchange:
self.markets_refresh_interval: int = exchange_config.get( self.markets_refresh_interval: int = exchange_config.get(
"markets_refresh_interval", 60) * 60 "markets_refresh_interval", 60) * 60
self._leverage_brackets: Dict = {}
if self.trading_mode != TradingMode.SPOT:
self.fill_leverage_brackets()
def __del__(self): def __del__(self):
""" """
Destructor - clean up async stuff Destructor - clean up async stuff
@ -1635,7 +1639,7 @@ class Exchange:
""" """
Assigns property _leverage_brackets to a dictionary of information about the leverage Assigns property _leverage_brackets to a dictionary of information about the leverage
allowed on each pair allowed on each pair
Not used by most exchanges, only used by Binance at time of writing Not used if the exchange has a static max leverage value for the account or each pair
""" """
return return