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

Calendar API can get confused about dates #157

Open spazmodius opened 3 years ago

spazmodius commented 3 years ago

Describe the bug

When asked for market days between 1900-01-01 and 1900-12-31, the calendar API returns a single day, 1970-01-02.

To Reproduce GET https://paper-api.alpaca.markets/v2/calendar?start=1900-01-01&end=1900-12-31

Expected behavior I'd expect it to return an empty array, that is, no days. Or an error indicating data for that time is unknown.

Additional context

response {
  method: 'GET',
  path: 'https://paper-api.alpaca.markets/v2/calendar?start=1900-01-01&end=1900-12-31',
  statusCode: 200,
  statusMessage: 'OK',
  headers: {
    server: 'nginx/1.16.1',
    date: 'Sat, 30 Jan 2021 00:11:54 GMT',
    'content-type': 'application/json; charset=UTF-8',
    'content-length': '99',
    connection: 'keep-alive',
    'access-control-allow-credentials': 'true',
    vary: 'Origin'
  },
  body: [
    {
      date: '1970-01-02',
      open: '09:30',
      close: '16:00',
      session_open: '0700',
      session_close: '1900'
    }
  ]
}