Invalid TimeFrame in getbars for hourly
See original GitHub issueHello when I try to use the example, I get an error:
api.get_bars("AAPL", TimeFrame.Hour, "2021-02-08", "2021-02-08", limit=10, adjustment='raw').df
"""
Traceback (most recent call last):
File "/home/kyle/.virtualenv/lib/python3.8/site-packages/alpaca_trade_api/rest.py", line 160, in _one_request
resp.raise_for_status()
File "/home/kyle/.virtualenv/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://data.alpaca.markets/v2/stocks/AAPL/bars?timeframe=1Hour&adjustment=raw&start=2021-02-08&end=2021-02-08&limit=10
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run_hourly.py", line 231, in make_df
tdf = api.get_bars("AAPL", TimeFrame.Hour, "2021-02-08", "2021-02-08", limit=10, adjustment='raw').df
File "/home/kyle/.virtualenv/lib/python3.8/site-packages/alpaca_trade_api/rest.py", line 625, in get_bars
bars = list(self.get_bars_iter(symbol,
File "/home/kyle/.virtualenv/lib/python3.8/site-packages/alpaca_trade_api/rest.py", line 611, in get_bars_iter
for bar in bars:
File "/home/kyle/.virtualenv/lib/python3.8/site-packages/alpaca_trade_api/rest.py", line 535, in _data_get_v2
resp = self.data_get('/stocks/{}/{}'.format(symbol, endpoint),
File "/home/kyle/.virtualenv/lib/python3.8/site-packages/alpaca_trade_api/rest.py", line 192, in data_get
return self._request(
File "/home/kyle/.virtualenv/lib/python3.8/site-packages/alpaca_trade_api/rest.py", line 139, in _request
return self._one_request(method, url, opts, retry)
File "/home/kyle/.virtualenv/lib/python3.8/site-packages/alpaca_trade_api/rest.py", line 168, in _one_request
raise APIError(error, http_error)
alpaca_trade_api.rest.APIError: invalid timeframe
Minute data seems to work.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:7 (2 by maintainers)
Top Results From Across the Web
HTTP Error on get_barset - Alpaca Account Troubleshooting
It returned an HTTP error. Here is the code snippet: quote = conn_rest.get_barset('IVV', limit=1, timeframe='minute'). Here ...
Read more >Handling bars and instruments - AgenaScript Documentation
GetBar outputs the first bars (from oldest to newest) that correspond to the specified ... //Usage within a 30 minute chart TimeFrame tf...
Read more >Draw object from one timeframe on another timeframe - cTrader
The code below draws a horizontal line at the high of each hourly ... GetBars(TimeFrame.Hour);. } public override void Calculate(int index).
Read more >Alpaca Trading API Guide - A Step-by-step Guide
We can easily change this for other time frames. ... the entire loop in a try/except block as the Alpaca API raises an...
Read more >Getting Historical Bars from Binance API with Python
Function to get bars from Binance: ... To get data for a long period of time (more than 1k bars) you have to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have opened an issue in the API issue tracker. It seems to be a problem with the API itself rather than the SDK. You can follow up that as well. Issue #178
closing the issue. let me know if there are still problems.