mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-14 04:03:55 +00:00
OHLCV should be float for TA-LIB indicators in the strategy
Some exchanges (BitMEX) return integer values for Volume field. And sometimes even for OHLC -- same, on BitMEX, since price decrease is 0.5. TA-LIB functions assume floats and fail with exception. Of course, this can be fixed (converted) in ccxt for particular exchange, but TA-LIB will still fail for exchanges for that such a conversion is not implemented in ccxt code. So let's make perform this conversion here in order to be sure our strategy will not crash on a new exchange.
This commit is contained in:
parent
7248537d4a
commit
14d6cdf9b2
|
@ -29,6 +29,10 @@ def parse_ticker_dataframe(ticker: list, ticker_interval: str,
|
||||||
utc=True,
|
utc=True,
|
||||||
infer_datetime_format=True)
|
infer_datetime_format=True)
|
||||||
|
|
||||||
|
# Some exchanges return int values for volume and even for ohlc.
|
||||||
|
# Convert them since TA-LIB indicators used in the strategy assume floats and fail with exception...
|
||||||
|
frame = frame.astype(dtype={'open': 'float', 'high': 'float', 'low': 'float', 'close': 'float', 'volume': 'float'})
|
||||||
|
|
||||||
# group by index and aggregate results to eliminate duplicate ticks
|
# group by index and aggregate results to eliminate duplicate ticks
|
||||||
frame = frame.groupby(by='date', as_index=False, sort=True).agg({
|
frame = frame.groupby(by='date', as_index=False, sort=True).agg({
|
||||||
'open': 'first',
|
'open': 'first',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user