Environment
Language
Python
Alpaca SDK Version
pylivetrader 0.6.0
Other Environment Details
If there’s anything else you’d like to invlude about the environment you’re running your code in - operating System, cloud provider, etc. - list it here.
Problem
Summary
Since v1 API end point is discontinued, we need to migrate to v2. I upgrade our pylivetrader package to 0.6.0, however, when running, it is still hitting the v1 endpoint
Paper or Live Tradng?
Both
Example Code
Here’s the error stack I am getting
[2022-03-17 09:40:01.292774-0700] WARNING: Alpaca: 404 Client Error: Not Found for url: https://data.alpaca.markets/v1/bars/minute?symbols=TQQQ&limit=1&start=2022-03-17T12%3A39%3A00-04%3A00&end=2022-03-17T12%3A40%3A00-04%3A00
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pylivetrader/executor/executor.py", line 67, in wrapper
func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pylivetrader/executor/executor.py", line 88, in every_bar
handle_data(algo, current_data, dt_to_use)
File "/usr/local/lib/python3.6/site-packages/pylivetrader/misc/events.py", line 218, in handle_data
dt,
File "/usr/local/lib/python3.6/site-packages/pylivetrader/misc/events.py", line 237, in handle_data
self.callback(context, data)
File "/usr/local/lib/python3.6/site-packages/pylivetrader/algorithm.py", line 236, in handle_data
self._handle_data(self, data)
File "TQQQ_Trading_Minute_Bar_v2.py", line 36, in handle_data
trading_logic.handle_data_internal(context, data, TRADING_ENV)
File "/work/Trading_Logic.py", line 155, in handle_data_internal
shared_data_current = data.current(security, 'price')
File "/usr/local/lib/python3.6/site-packages/pylivetrader/data/bardata.py", line 86, in current
results = parallelize(fetch)(fetch_args)
File "/usr/local/lib/python3.6/site-packages/pylivetrader/misc/parallel_utils.py", line 42, in wrapper
task_result = task.result()
File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/pylivetrader/data/bardata.py", line 72, in fetch
self.data_frequency
File "/usr/local/lib/python3.6/site-packages/pylivetrader/data/data_portal.py", line 56, in get_spot_value
assets, field, dt, data_frequency, self.quantopian_compatible
File "/usr/local/lib/python3.6/site-packages/pylivetrader/backend/alpaca.py", line 470, in get_spot_value
results = self._get_spot_bars(symbols, field)
File "/usr/local/lib/python3.6/site-packages/pylivetrader/backend/alpaca.py", line 506, in _get_spot_bars
limit=1)
File "/usr/local/lib/python3.6/site-packages/pylivetrader/backend/alpaca.py", line 602, in _fetch_bars_from_api
return pd.concat(result, axis=1)
File "/usr/local/lib/python3.6/site-packages/pandas/core/reshape/concat.py", line 212, in concat
copy=copy)
File "/usr/local/lib/python3.6/site-packages/pandas/core/reshape/concat.py", line 263, in __init__
raise ValueError('All objects passed were None')
ValueError: All objects passed were None