samplealgo01
samplealgo01 copied to clipboard
Still seeing the same issue on TypeError for barset.df
File "/app/samplealgo/algo.py", line 50, in _get_prices 2019-01-31T17:02:13.116398+00:00 app[worker.1]: return barset.df 2019-01-31T17:02:13.116402+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/alpaca_trade_api/entity.py", line 102, in df 2019-01-31T17:02:13.116581+00:00 app[worker.1]: df = bars.df.copy() 2019-01-31T17:02:13.116585+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/alpaca_trade_api/entity.py", line 84, in df 2019-01-31T17:02:13.116746+00:00 app[worker.1]: df.index * 1e9, utc=True, 2019-01-31T17:02:13.116750+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/core/ops.py", line 176, in invalid_op 2019-01-31T17:02:13.116959+00:00 app[worker.1]: "{typ}".format(name=name, typ=type(self).name)) 2019-01-31T17:02:13.116983+00:00 app[worker.1]: TypeError: cannot perform mul with this index type: Index
Running locally and see this error:
File "main.py", line 5, in
I fixed it myself by converting it to int64
if not df.empty:
df.index = pd.to_datetime(
(df.index * 1e9).astype('int64'), utc=True,
).tz_convert(NY)
I fixed it myself by converting it to int64
if not df.empty: df.index = pd.to_datetime( (df.index * 1e9).astype('int64'), utc=True, ).tz_convert(NY)
Where did you put this block of code? I am running into the same issue.
in the enity.py file. Make sure your running the latest alpaca-trade-api (0.24) on line 84: if not df.empty: df.index = pd.to_datetime( (df.index * 1e9).astype('int64'), utc=True, ).tz_convert(NY) else: df.index = pd.to_datetime( df.index, utc=True )
Use api version 0.26