MCPcopy Create free account
hub / github.com/CryptoSignal/Crypto-Signal / __init__

Method __init__

app/exchange.py:17–38  ·  view source on GitHub ↗

Initializes ExchangeInterface class Args: exchange_config (dict): A dictionary containing configuration for the exchanges.

(self, exchange_config)

Source from the content-addressed store, hash-verified

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))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected