TV datafeed is not suported? #972
Unanswered
FelipeMariotti
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone!
I'm trying use Trading View data feed for my backtest analysis and i got an issue that backtesting.py only need OHLC and (optionally) Volume for analysis, and I come here ask for help for the issue:
ValueError Traceback (most recent call last)
Cell In[48], line 22
19 elif crossover(self.ma_bound, self.rsi):
20 self.buy()
---> 22 bt = Backtest(petr4_data, RsiOscillator, cash=10_000, commission=.002)
23 stats = bt.run()
24 bt.plot()
File ~\anaconda3\lib\site-packages\backtesting\backtesting.py:1067, in Backtest.init(self, data, strategy, cash, commission, margin, trade_on_close, hedging, exclusive_orders)
1065 raise ValueError('OHLC
data
is empty')1066 if len(data.columns.intersection({'Open', 'High', 'Low', 'Close', 'Volume'})) != 5:
-> 1067 raise ValueError("
data
must be a pandas.DataFrame with columns "1068 "'Open', 'High', 'Low', 'Close', and (optionally) 'Volume'")
1069 if data[['Open', 'High', 'Low', 'Close']].isnull().values.any():
1070 raise ValueError('Some OHLC values are missing (NaN). '
1071 'Please strip those lines with
df.dropna()
or '1072 'fill them in with
df.interpolate()
or whatever.')ValueError:
data
must be a pandas.DataFrame with columns 'Open', 'High', 'Low', 'Close', and (optionally) 'Volume'The DF that i'm trying to use comes with datetime, OHLC and volume, I try to reorder or delete but the py still not accept.
Beta Was this translation helpful? Give feedback.
All reactions