alpacahq / Alpaca-API

The Alpaca API is a developer interface for trading operations and market data reception through the Alpaca platform.
https://alpaca.markets/
143 stars 13 forks source link

https://data.alpaca.markets/v1/bars/day?symbols=AAPL returning 404 #100

Closed jackbader closed 4 years ago

jackbader commented 4 years ago

I'm trying to hit the /v1/bars endpoint and all I'm getting is 404's, accompanied by a cors error (the cors error is most likely a result of the endpoint not being found. Other endpoints work fine.

Im using const accountResponse = await fetch( "https://data.alpaca.markets/v1/bars/day?symbols=AAPL&limit=1&start=2019-02-01&end=2019-02-10", { method: "GET", // or 'PUT' headers: { "APCA-API-KEY-ID": process.env.REACT_APP_ALPACA_KEY_ID, "APCA-API-SECRET-KEY": process.env.REACT_APP_ALPACA_SECRET_KEY } } );

Screen Shot 2020-01-30 at 10 14 24 PM

Thanks guys!

phiat commented 4 years ago

Same issue still present. I've tried a bunch of symbols and get same "Not Found". Do you have any that actually return Bar data?

curl -H "APCA-API-KEY-ID: $APCA-API-KEY-ID"  -H "APCA-API-SECRET-KEY: $APCA-API-SECRET-KEY"  "https://paper-api.alpaca.markets/v1/bars/1D?symbols=AAPL&limit=100"
Not Found%          
jackbader commented 4 years ago

@phiat It actually does seem to be working...

Most people tell me cors errors are usually just happening because there is something wrong with the request formatting. And in this case it's true.

I was able to run the same request in Postman and it returned the results just fine.

phiat commented 4 years ago

Ah yes. Thanks @jackbader for the sanity check. I had the wrong subdomain (https://**paper-api**.alpaca.markets vs https://**data**.alpaca.markets) as well as erroneous env vars! :100:

curl -H "APCA-API-KEY-ID: $APCA_API_KEY" -H "APCA-API-SECRET-KEY: $APCA_API_SECRET" "https://data.alpaca.markets/v1/bars/1D?symbols=AAPL
{"AAPL":[{"t":1571112000,"o":236.39,"h":237.65,"l":234.88,"c":235.32,"v":3
7286507}  ...

works. I think this issue can be closed.

EDIT: If your issue is with CORS, then maybe keep open if not addressed. Sorry should've read a bit more.

umitanuki commented 4 years ago

FYI, CORS for data.alpaca.markets are addressed.