Add test for fetch_ohlcv (against exchange)

This commit is contained in:
Matthias 2020-10-24 13:14:45 +02:00
parent 7833d9935c
commit b7d4ff9c21

View File

@ -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 However, these tests should give a good idea to determine if a new exchange is
suitable to run with freqtrade. suitable to run with freqtrade.
""" """
import pytest import pytest
@ -16,19 +15,23 @@ from tests.conftest import get_default_conf
EXCHANGES = { EXCHANGES = {
'bittrex': { 'bittrex': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
'hasQuoteVolume': False 'hasQuoteVolume': False,
'timeframe': '5m',
}, },
'binance': { 'binance': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
'hasQuoteVolume': True 'hasQuoteVolume': True,
'timeframe': '5m',
}, },
'kraken': { 'kraken': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
'hasQuoteVolume': True 'hasQuoteVolume': True,
'timeframe': '5m',
}, },
'ftx': { 'ftx': {
'pair': 'BTC/USDT', 'pair': 'BTC/USDT',
'hasQuoteVolume': True 'hasQuoteVolume': True,
'timeframe': '5m',
} }
} }
@ -100,8 +103,13 @@ class TestCCXTExchange():
assert len(l2['asks']) == next_limit assert len(l2['asks']) == next_limit
def test_fetch_ohlcv(self, exchange): def test_fetch_ohlcv(self, exchange):
# TODO: Implement me exchange, exchangename = exchange
pass 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): def test_ccxt_get_fee(self, exchange):
exchange, exchangename = exchange exchange, exchangename = exchange