(self, config: ConstructorArgs = {})
| 407 | synchronous = True |
| 408 | |
| 409 | def __init__(self, config: ConstructorArgs = {}): |
| 410 | self.aiohttp_trust_env = self.aiohttp_trust_env or self.trust_env |
| 411 | self.requests_trust_env = self.requests_trust_env or self.trust_env |
| 412 | |
| 413 | self.limits = dict() if self.limits is None else self.limits |
| 414 | self.exceptions = dict() if self.exceptions is None else self.exceptions |
| 415 | self.headers = dict() if self.headers is None else self.headers |
| 416 | self.balance = dict() if self.balance is None else self.balance |
| 417 | self.orderbooks = dict() if self.orderbooks is None else self.orderbooks |
| 418 | self.fundingRates = dict() if self.fundingRates is None else self.fundingRates |
| 419 | self.tickers = dict() if self.tickers is None else self.tickers |
| 420 | self.bidsasks = dict() if self.bidsasks is None else self.bidsasks |
| 421 | self.trades = dict() if self.trades is None else self.trades |
| 422 | self.transactions = dict() if self.transactions is None else self.transactions |
| 423 | self.ohlcvs = dict() if self.ohlcvs is None else self.ohlcvs |
| 424 | self.liquidations = None if self.liquidations is None else self.liquidations |
| 425 | self.myLiquidations = None if self.myLiquidations is None else self.myLiquidations |
| 426 | self.currencies = dict() if self.currencies is None else self.currencies |
| 427 | self.options = self.get_default_options() if self.options is None else self.options # Python does not allow to define properties in run-time with setattr |
| 428 | self.decimal_to_precision = decimal_to_precision |
| 429 | self.number_to_string = number_to_string |
| 430 | |
| 431 | # version = '.'.join(map(str, sys.version_info[:3])) |
| 432 | # self.userAgent = { |
| 433 | # 'User-Agent': 'ccxt/' + __version__ + ' (+https://github.com/ccxt/ccxt) Python/' + version |
| 434 | # } |
| 435 | |
| 436 | self.origin = self.uuid() |
| 437 | self.userAgent = default_user_agent() |
| 438 | |
| 439 | settings = self.deep_extend(self.describe(), config) |
| 440 | |
| 441 | for key in settings: |
| 442 | if hasattr(self, key) and isinstance(getattr(self, key), dict): |
| 443 | setattr(self, key, self.deep_extend(getattr(self, key), settings[key])) |
| 444 | else: |
| 445 | setattr(self, key, settings[key]) |
| 446 | |
| 447 | self.after_construct() |
| 448 | |
| 449 | if self.safe_bool(config, 'sandbox') or self.safe_bool(config, 'testnet'): |
| 450 | self.set_sandbox_mode(True) |
| 451 | |
| 452 | # convert all properties from underscore notation foo_bar to camelcase notation fooBar |
| 453 | cls = type(self) |
| 454 | for name in dir(self): |
| 455 | if name[0] != '_' and name[-1] != '_' and '_' in name: |
| 456 | parts = name.split('_') |
| 457 | # fetch_ohlcv → fetchOHLCV (not fetchOhlcv!) |
| 458 | exceptions = {'ohlcv': 'OHLCV', 'le': 'LE', 'be': 'BE', 'adl': 'ADL'} |
| 459 | camelcase = parts[0] + ''.join(exceptions.get(i, self.capitalize(i)) for i in parts[1:]) |
| 460 | attr = getattr(self, name) |
| 461 | if isinstance(attr, types.MethodType): |
| 462 | setattr(cls, camelcase, getattr(cls, name)) |
| 463 | else: |
| 464 | if hasattr(self, camelcase): |
| 465 | if attr is not None: |
| 466 | setattr(self, camelcase, attr) |
nothing calls this directly
no test coverage detected