Merge pull request #6340 from TheJoeSchr/frequi-datetime

freqUI: fix can't import backtest with missing datetime data
This commit is contained in:
Matthias
2022-02-09 07:21:30 +01:00
committed by GitHub
2 changed files with 32 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ from datetime import datetime, timedelta, timezone
from pathlib import Path
from unittest.mock import ANY, MagicMock, PropertyMock
import pandas as pd
import pytest
import uvicorn
from fastapi import FastAPI
@@ -1181,6 +1182,24 @@ def test_api_pair_candles(botclient, ohlcv_history):
0.7039405, 8.885e-05, 0, 0, 1511686800000, None, None]
])
ohlcv_history['sell'] = ohlcv_history['sell'].astype('float64')
ohlcv_history.at[0, 'sell'] = float('inf')
ohlcv_history['date1'] = ohlcv_history['date']
ohlcv_history.at[0, 'date1'] = pd.NaT
ftbot.dataprovider._set_cached_df("XRP/BTC", timeframe, ohlcv_history)
rc = client_get(client,
f"{BASE_URI}/pair_candles?limit={amount}&pair=XRP%2FBTC&timeframe={timeframe}")
assert_response(rc)
assert (rc.json()['data'] ==
[['2017-11-26 08:50:00', 8.794e-05, 8.948e-05, 8.794e-05, 8.88e-05, 0.0877869,
None, 0, None, None, 1511686200000, None, None],
['2017-11-26 08:55:00', 8.88e-05, 8.942e-05, 8.88e-05,
8.893e-05, 0.05874751, 8.886500000000001e-05, 1, 0.0, '2017-11-26 08:55:00',
1511686500000, 8.893e-05, None],
['2017-11-26 09:00:00', 8.891e-05, 8.893e-05, 8.875e-05, 8.877e-05,
0.7039405, 8.885e-05, 0, 0.0, '2017-11-26 09:00:00', 1511686800000, None, None]
])
def test_api_pair_history(botclient, ohlcv_history):