Beispiel #1
0
    def test_save_pair_orderbook_for_not_existing_pair(self):
        orderbook = CexioCrawler.parse_pair_orderbook(self.orderbook_response)

        exchange_pair = ExchangePair()
        result = CexioCrawler.save_pair_orderbook(exchange_pair, orderbook[0], orderbook[1])

        self.assertFalse(result)
Beispiel #2
0
    def test_save_pair_orderbook_for_valid_pair_and_empty_orderbook(self):
        exchange = self.exchange
        crawler = CexioCrawler(exchange)

        result = CexioCrawler.save_pair_orderbook(crawler.exchange.pairs.first(), [], [])

        self.assertFalse(result)
Beispiel #3
0
    def test_save_pair_orderbook_for_valid_inputs(self):
        orderbook = CexioCrawler.parse_pair_orderbook(self.orderbook_response)
        exchange = self.exchange
        crawler = CexioCrawler(exchange)
        exchange_pair = crawler.exchange.pairs.first()

        result = CexioCrawler.save_pair_orderbook(exchange_pair, orderbook[0], orderbook[1])
        self.assertTrue(result)
        self.assertEqual(exchange_pair.bids, self.saved_orderbook_bids)
        self.assertEqual(exchange_pair.asks, self.saved_orderbook_asks)
Beispiel #4
0
    def test_save_pair_orderbook_for_invalid_pair(self):
        orderbook = CexioCrawler.parse_pair_orderbook(self.orderbook_response)

        result = CexioCrawler.save_pair_orderbook(None, orderbook[0], orderbook[1])

        self.assertFalse(result)