Update hdf5 handler to reset index on load
This commit is contained in:
parent
0bbb6faeba
commit
48352b8a37
@ -81,6 +81,7 @@ class HDF5DataHandler(IDataHandler):
|
|||||||
raise ValueError("Wrong dataframe format")
|
raise ValueError("Wrong dataframe format")
|
||||||
pairdata = pairdata.astype(dtype={'open': 'float', 'high': 'float',
|
pairdata = pairdata.astype(dtype={'open': 'float', 'high': 'float',
|
||||||
'low': 'float', 'close': 'float', 'volume': 'float'})
|
'low': 'float', 'close': 'float', 'volume': 'float'})
|
||||||
|
pairdata = pairdata.reset_index(drop=True)
|
||||||
return pairdata
|
return pairdata
|
||||||
|
|
||||||
def ohlcv_append(
|
def ohlcv_append(
|
||||||
|
@ -366,7 +366,13 @@ def test_generic_datahandler_ohlcv_load_and_resave(
|
|||||||
timerange = TimeRange.parse_timerange(f"{startdt.replace('-', '')}-{enddt.replace('-', '')}")
|
timerange = TimeRange.parse_timerange(f"{startdt.replace('-', '')}-{enddt.replace('-', '')}")
|
||||||
|
|
||||||
ohlcv = dhbase.ohlcv_load(pair, timeframe, timerange=timerange, candle_type=candle_type)
|
ohlcv = dhbase.ohlcv_load(pair, timeframe, timerange=timerange, candle_type=candle_type)
|
||||||
ohlcv1 = dh1.ohlcv_load('UNITTEST/NEW', timeframe, timerange=timerange, candle_type=candle_type)
|
if datahandler == 'hdf5':
|
||||||
|
ohlcv1 = dh1._ohlcv_load('UNITTEST/NEW', timeframe, timerange, candle_type=candle_type)
|
||||||
|
if candle_type == 'mark':
|
||||||
|
ohlcv1['volume'] = 0.0
|
||||||
|
else:
|
||||||
|
ohlcv1 = dh1.ohlcv_load('UNITTEST/NEW', timeframe,
|
||||||
|
timerange=timerange, candle_type=candle_type)
|
||||||
|
|
||||||
assert len(ohlcv) == len(ohlcv1)
|
assert len(ohlcv) == len(ohlcv1)
|
||||||
assert ohlcv.equals(ohlcv1)
|
assert ohlcv.equals(ohlcv1)
|
||||||
|
Loading…
Reference in New Issue
Block a user