mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Fix some tests to use dataframe
This commit is contained in:
parent
1c5031b468
commit
34ea214f7c
|
@ -32,6 +32,7 @@ def parse_ticker_dataframe(ticker: list) -> DataFrame:
|
|||
'volume': 'max',
|
||||
})
|
||||
frame.drop(frame.tail(1).index, inplace=True) # eliminate partial candle
|
||||
logger.debug('Droppling last candle')
|
||||
return frame
|
||||
|
||||
|
||||
|
|
|
@ -339,7 +339,7 @@ def test_load_partial_missing(caplog) -> None:
|
|||
# timedifference in 5 minutes
|
||||
td = ((end - start).total_seconds() // 60 // 5) + 1
|
||||
assert td != len(tickerdata['UNITTEST/BTC'])
|
||||
start_real = arrow.get(tickerdata['UNITTEST/BTC'][0][0] / 1000)
|
||||
start_real = tickerdata['UNITTEST/BTC'].iloc[0, 0]
|
||||
assert log_has(f'Missing data at start for pair '
|
||||
f'UNITTEST/BTC, data starts at {start_real.strftime("%Y-%m-%d %H:%M:%S")}',
|
||||
caplog.record_tuples)
|
||||
|
@ -354,7 +354,8 @@ def test_load_partial_missing(caplog) -> None:
|
|||
# timedifference in 5 minutes
|
||||
td = ((end - start).total_seconds() // 60 // 5) + 1
|
||||
assert td != len(tickerdata['UNITTEST/BTC'])
|
||||
end_real = arrow.get(tickerdata['UNITTEST/BTC'][-1][0] / 1000)
|
||||
# Shift endtime with +5 - as last candle is dropped (partial candle)
|
||||
end_real = arrow.get(tickerdata['UNITTEST/BTC'].iloc[-1, 0]).shift(minutes=5)
|
||||
assert log_has(f'Missing data at end for pair '
|
||||
f'UNITTEST/BTC, data ends at {end_real.strftime("%Y-%m-%d %H:%M:%S")}',
|
||||
caplog.record_tuples)
|
||||
|
|
|
@ -10,6 +10,7 @@ import numpy as np
|
|||
import pytest
|
||||
from pandas import DataFrame, to_datetime
|
||||
|
||||
from freqtrade.data.converter import parse_ticker_dataframe
|
||||
from freqtrade.edge import Edge, PairInfo
|
||||
from freqtrade.strategy.interface import SellType
|
||||
from freqtrade.tests.conftest import get_patched_freqtradebot
|
||||
|
@ -280,7 +281,8 @@ def mocked_load_data(datadir, pairs=[], ticker_interval='0m', refresh_pairs=Fals
|
|||
123.45
|
||||
] for x in range(0, 500)]
|
||||
|
||||
pairdata = {'NEO/BTC': ETHBTC, 'LTC/BTC': LTCBTC}
|
||||
pairdata = {'NEO/BTC': parse_ticker_dataframe(ETHBTC),
|
||||
'LTC/BTC': parse_ticker_dataframe(LTCBTC)}
|
||||
return pairdata
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ def test_datesarray_to_datetimearray(ticker_history_list):
|
|||
def test_common_datearray(default_conf) -> None:
|
||||
strategy = DefaultStrategy(default_conf)
|
||||
tick = load_tickerdata_file(None, 'UNITTEST/BTC', '1m')
|
||||
tickerlist = {'UNITTEST/BTC': tick}
|
||||
tickerlist = {'UNITTEST/BTC': parse_ticker_dataframe(tick)}
|
||||
dataframes = strategy.tickerdata_to_dataframe(tickerlist)
|
||||
|
||||
dates = common_datearray(dataframes)
|
||||
|
|
Loading…
Reference in New Issue
Block a user