From b7d4ff9c216c7e37d906e5dc06e20daf3c463b35 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 24 Oct 2020 13:14:45 +0200 Subject: [PATCH] Add test for fetch_ohlcv (against exchange) --- tests/exchange/test_ccxt_compat.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/exchange/test_ccxt_compat.py b/tests/exchange/test_ccxt_compat.py index c1b8ab6f3..fa3bd45c8 100644 --- a/tests/exchange/test_ccxt_compat.py +++ b/tests/exchange/test_ccxt_compat.py @@ -3,7 +3,6 @@ Tests in this file do NOT mock network calls, so they are expected to be fluky a However, these tests should give a good idea to determine if a new exchange is suitable to run with freqtrade. - """ import pytest @@ -16,19 +15,23 @@ from tests.conftest import get_default_conf EXCHANGES = { 'bittrex': { 'pair': 'BTC/USDT', - 'hasQuoteVolume': False + 'hasQuoteVolume': False, + 'timeframe': '5m', }, 'binance': { 'pair': 'BTC/USDT', - 'hasQuoteVolume': True + 'hasQuoteVolume': True, + 'timeframe': '5m', }, 'kraken': { 'pair': 'BTC/USDT', - 'hasQuoteVolume': True + 'hasQuoteVolume': True, + 'timeframe': '5m', }, 'ftx': { 'pair': 'BTC/USDT', - 'hasQuoteVolume': True + 'hasQuoteVolume': True, + 'timeframe': '5m', } } @@ -100,8 +103,13 @@ class TestCCXTExchange(): assert len(l2['asks']) == next_limit def test_fetch_ohlcv(self, exchange): - # TODO: Implement me - pass + exchange, exchangename = exchange + pair = EXCHANGES[exchangename]['pair'] + timeframe = EXCHANGES[exchangename]['timeframe'] + pair_tf = (pair, timeframe) + ohlcv = exchange.refresh_latest_ohlcv([pair_tf]) + assert isinstance(ohlcv, list) + assert len(exchange.klines(pair_tf)) > 200 def test_ccxt_get_fee(self, exchange): exchange, exchangename = exchange