Initializes ExchangeInterface class Args: exchange_config (dict): A dictionary containing configuration for the exchanges.
(self, exchange_config)
| 15 | """ |
| 16 | |
| 17 | def __init__(self, exchange_config): |
| 18 | """Initializes ExchangeInterface class |
| 19 | |
| 20 | Args: |
| 21 | exchange_config (dict): A dictionary containing configuration for the exchanges. |
| 22 | """ |
| 23 | |
| 24 | self.logger = structlog.get_logger() |
| 25 | self.exchanges = dict() |
| 26 | |
| 27 | # Loads the exchanges using ccxt. |
| 28 | for exchange in exchange_config: |
| 29 | if exchange_config[exchange]['required']['enabled']: |
| 30 | new_exchange = getattr(ccxt, exchange)({ |
| 31 | "enableRateLimit": True |
| 32 | }) |
| 33 | |
| 34 | # sets up api permissions for user if given |
| 35 | if new_exchange: |
| 36 | self.exchanges[new_exchange.id] = new_exchange |
| 37 | else: |
| 38 | self.logger.error("Unable to load exchange %s", new_exchange) |
| 39 | |
| 40 | |
| 41 | @retry(retry=retry_if_exception_type(ccxt.NetworkError), stop=stop_after_attempt(3)) |
nothing calls this directly
no outgoing calls
no test coverage detected