Is api.barsets() Working?

Hi ALpaca,

Is api.barsets() Working ?
i have been making request for Market data and been getting below error for last 2 days. Please do let us know if anything has changed.
below is the snippet of teh request call
“barset = api.get_barset(‘qqq’, ‘day’, limit=5)”

“requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://data.alpaca.markets/v1/bars/day?symbols=qqq&limit=5

1 Like

One issue is symbols are case sensitive and must be capitalized.

barset = api.get_barset(‘QQQ’, ‘day’, limit=5)

However, that won’t generate a 403 error. More than likely your API keys were updated but not reflected in the code. If you reset your paper trading account recently that is it. When resetting a paper trading account the API keys get reset too. Try resetting your API keys and ensure your program has the latest values.

1 Like

Thanks Dan, i have reset paper trading account recently and dint realize it would change my API Keys.
i have updated the API keys and able to stream the data now.

Thanks
Mahesh G

@mahechow6 That’s good to hear. Glad it works now. Very common issue. We’re reviewing our docs for how to make this behaviour more explicit. I’m also putting it into a new support faq we’re developing.

Good luck!

Why not retain existing keys on paper reset? It’s quite a hassle to update keys every time…

It’s like getting a new phone number every time you get a new phone in a sense, Its not really a purpose thing but a consequence of the action. It would be really cool to be able to reset paper accounts without changing API keys, but I think we all would love any Interesting features that could be added.

A subtle point about resetting a paper account is that, in actuality, one is creating an entire new account. Moreover, the old account is still there. So, the previous keys still point to the previous account. The account is ‘inactive’ which is why the keys don’t validate for fetching data. However, all the account data, orders, etc are still there. Not sure I would go so far as to call this a ‘feature’ though if for some reason one wanted to look at old paper account info it’s there.

I do agree it would be nice to copy the keys to the new ‘reset’ account just like name etc are copied. (It would save a lot of support requests for sure) However, the secret key is, how should I say, secret. For security reasons it isn’t really stored anywhere. The only way to get a matching secret key is to regenerate it.

I will however add this as a request to our issue tracker. Maybe others will have ideas on how to implement something better?

Please check out my posting. Sending to all as Alpaca suggested getting users support to see result

Hi Dan,
I have similar issue, but instead of 403 Client Error, I got 404 Client Error: Not Found for url: https://data.alpaca.markets/v1/bars/
My account was just created and it has not been reset
is api.barsets() working for paper account?
Thanks!

Alpaca Data API v1 is deprecated and not available now. You have to use v2 endpoints instead.

Thanks Oleg!
Switching over get_bars works!