def setUp(self):
     super().setUp()
     self.dummy_exchange = models.Exchange(id=3, name="coinbase")
     self.on_event_mock = MagicMock()
     self.coinbase_listener = CoinbaseListener(self.dummy_exchange,
                                               self.on_event_mock)
     self.coinbase_listener.session = self.session
Exemple #2
0
 def setUp(self):
     self.dummy_exchange = models.Exchange(id=1338, name="dummy")
     self.on_event_mock = MagicMock()
     self.hitbtc_listener = HitBTCListener(self.dummy_exchange,
                                           self.on_event_mock)
     self.hitbtc_listener._all_symbols = [
         dict(id="ETHBTC", baseCurrency="ETH", quoteCurrency="BTC"),
         dict(id="LTCBTC", baseCurrency="LTC", quoteCurrency="BTC"),
     ]
    def test_get_existing_markets(self):
        dummy_db.insert_coins(self.session)
        dummy_db.insert_exchanges(self.session)
        dummy_db.insert_markets(self.session)
        dummy_db.insert_exchange_markets(self.session)
        self.session.flush()
        markets = [em.original_name for em in self.session.query(models.ExchangeMarket).all()]

        dummy_idex_exchange = models.Exchange(id=1, name="idex")
        idex_listener = IdexListener(
            dummy_idex_exchange,
            self.on_event_mock,
            session=self.session,
            markets=markets,
            max_markets=3,
        )
        self.assertEqual(len(idex_listener.markets), 3)
        expected_markets = ["ETH_FTM", "ETH_LTO", "ETH_FSN"]
        self.assertEqual(idex_listener.markets, expected_markets)
Exemple #4
0
def insert_exchanges(session):
    session.add_all([
        models.Exchange(name='hitbtc', id=1),
        models.Exchange(name='binance', id=2),
        models.Exchange(name='coinbase', id=3)
    ])
 def setUp(self):
     super().setUp()
     self.dummy_exchange = models.Exchange(id=1337, name="dummy")
     self.on_event_mock = MagicMock()
     self.idex_listener = IdexListener(self.dummy_exchange, self.on_event_mock)
Exemple #6
0
 def test_exchange_repr(self):
     exchange = models.Exchange(name="idex")
     self.assertEqual(str(exchange), "Exchange(name='idex')")
 def setUp(self):
     self.mock_session = MagicMock()
     self.dummy_exchange = models.Exchange(id=1337, name="dummy")
     query_exchange_ret = "query.return_value.filter_by.return_value.one.return_value"
     self.mock_session.configure_mock(**{query_exchange_ret: self.dummy_exchange})
     self.orchestrator = Orchestrator(["dummy"], session=self.mock_session, commit_interval=3)
Exemple #8
0
 def setUp(self):
     self.dummy_exchange = models.Exchange(id=1338, name="dummy")
     self.on_event_mock = MagicMock()
     self.binance_listener = BinanceListener(self.dummy_exchange,
                                             self.on_event_mock)
Exemple #9
0
 def setUp(self):
     self.exchange = models.Exchange(name="foo")
     self.on_event = MagicMock()