You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "E:\workspace\python\AutoTrader\autotrader\autotrader.py", line 1468, in _main
bot = AutoTraderBot(
File "E:\workspace\python\AutoTrader\autotrader\autobot.py", line 203, in init
my_strat.create_plotting_indicators(data)
File "E:\workspace\python\AutoTrader\strategies\ema_crossover.py", line 31, in create_plotting_indicators
"data": TA.EMA(data, self.parameters["fast_ema"]),
File "C:\Users\rahul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\finta\finta.py", line 15, in wrap
args[i] = args[i].rename(columns={c: c.lower() for c in args[i].columns})
File "C:\Users\rahul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\finta\finta.py", line 15, in
args[i] = args[i].rename(columns={c: c.lower() for c in args[i].columns})
AttributeError: 'tuple' object has no attribute 'lower'
It appears that yFinance is appending the ticker symbol into the column names as well. Adding following lines in brokers/yahoo.py seems to fix this issue:
# Remove excess data
if count is not None and start_time is None and end_time is None:
data = data.tail(count)
**# fix for appending Ticker Symbol - Tested for Single Ticker download only
if isinstance(data.columns, pd.MultiIndex):
data.columns = data.columns.droplevel(1)
data.drop(columns=['Adj Close'], inplace=True)
data.columns = [col.split(" ")[-1] for col in data.columns]**
if data.index.tzinfo is None:
However, this seems to introduce another issue:
Error when updating strategy: Invalid comparison between dtype=datetime64[ns, UTC] and datetime
which looks like the data index here is not in proper format.
data.columns = [col.split(" ")[-1] for col in data.columns]
if data.index.tzinfo is None:
# Data is naive, add UTC timezone
data.index = data.index.tz_localize(timezone.utc)
else:
# Convert to UTC
data.index = data.index.tz_convert(timezone.utc)
# fix the index as well
**data.index = pd.to_datetime(data.index).tz_localize(None)**
Running a simple code with the following code results in a failure:
File "E:\workspace\python\AutoTrader\autotrader\autotrader.py", line 1468, in _main
bot = AutoTraderBot(
File "E:\workspace\python\AutoTrader\autotrader\autobot.py", line 203, in init
my_strat.create_plotting_indicators(data)
File "E:\workspace\python\AutoTrader\strategies\ema_crossover.py", line 31, in create_plotting_indicators
"data": TA.EMA(data, self.parameters["fast_ema"]),
File "C:\Users\rahul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\finta\finta.py", line 15, in wrap
args[i] = args[i].rename(columns={c: c.lower() for c in args[i].columns})
File "C:\Users\rahul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\finta\finta.py", line 15, in
args[i] = args[i].rename(columns={c: c.lower() for c in args[i].columns})
AttributeError: 'tuple' object has no attribute 'lower'
yfinance version: yfinance-0.2.50
AutoTrader version: latest/main branch.
The text was updated successfully, but these errors were encountered: