예제 #1
0
async def test_initialize_impl(exchange_manager):
    ccxt_exchange = exchange_connectors.CCXTExchange(exchange_manager.config,
                                                     exchange_manager)

    class MockCCXT:
        def __init__(self):
            self.symbols = ["BTC/USDT", "ETH/USDT", "ETH/BTC", "ETH/USDT"]
            self.timeframes = ["1h", "2h", "4h", "2h"]

        async def load_markets(self):
            pass

        def setSandboxMode(self, is_sandboxed):
            pass

    with mock.patch.object(ccxt_exchange, 'client', new=MockCCXT()):
        await ccxt_exchange.initialize_impl()
        assert ccxt_exchange.symbols == {
            "BTC/USDT",
            "ETH/USDT",
            "ETH/BTC",
        }
        assert ccxt_exchange.time_frames == {
            "1h",
            "2h",
            "4h",
        }
    def __init__(self, config, exchange_manager):
        super().__init__(config, exchange_manager)
        self.connector = exchange_connectors.CCXTExchange(
            config,
            exchange_manager,
            additional_ccxt_config=self.get_additional_connector_config()
        )

        self.connector.client.options['defaultType'] = self.get_default_type()
예제 #3
0
async def test_initialize_impl_with_empty_symbols_and_timeframes(
        exchange_manager):
    ccxt_exchange = exchange_connectors.CCXTExchange(exchange_manager.config,
                                                     exchange_manager)

    class MockCCXT:
        def __init__(self):
            self.symbols = []
            self.timeframes = []

        async def load_markets(self):
            pass

        def setSandboxMode(self, is_sandboxed):
            pass

    with mock.patch.object(ccxt_exchange, 'client', new=MockCCXT()):
        await ccxt_exchange.initialize_impl()
        assert ccxt_exchange.symbols == set()
        assert ccxt_exchange.time_frames == set()
 def __init__(self, config, exchange_manager):
     super().__init__(config, exchange_manager)
     self.connector = exchange_connectors.CCXTExchange(
         config,
         exchange_manager,
         additional_ccxt_config=self.get_additional_connector_config())
 def __init__(self, config, exchange_manager):
     super().__init__(config, exchange_manager)
     self.connector = exchange_connectors.CCXTExchange(config, exchange_manager)