Alpaca /v2/calendar REST API Endpoint Doesn't Respect start and end Parameters

Viewed 11

I am using the Alpaca Calendar API to try to see when the stock market is open on a given day. See - https://alpaca.markets/docs/api-references/trading-api/calendar/. However, the API endpoint doesn't appear to be respecting the start and end parameters, and always returns a range of dates between 1970 and 2029. Here is the query I am trying ->

curl -X GET -H "APCA-API-KEY-ID: " -H "APCA-API-SECRET-KEY: " https://paper-api.alpaca.markets/v2/calendar?start=2006-01-02&end=2006-01-03

Why does the API not respect the start and end times and instead always return a giant list of dates?

1 Answers

The problem was the command prompt wasn't interpreting the query URL correctly because of the special characters (I think the '&' character specifically was causing problems). I put the query URL in quotes and it works fine now -

curl -X GET -H "APCA-API-KEY-ID: " -H "APCA-API-SECRET-KEY: " "https://paper-api.alpaca.markets/v2/calendar?start=2006-01-02&end=2006-01-03"

Related