alpacahq / Alpaca-API

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

Requests for AAPL 1 day price bar return negative volume on 2012-02-15 and 2012-03-14 #101

Open nhwalker opened 4 years ago

nhwalker commented 4 years ago

I was fetching historical data to run some tests and found that, once I had fetched daily price barsfor all current SP500 stocks from the begining of 2008 to present (split across 15 or so requests) that there were exactly 2 price bars with negative volume, which I don't think is supposed to be a thing.

Looking at the logs it appears that the issue is AAPL on 2012-02-15 and 2012-03-14.

Below is the output for two more isolated requests I ran to confirm the issue was repeatable.

RestRequest [api=Alpaca, id=1, url=https://data.alpaca.markets/v1/bars/1D?start=2012-02-14T00%3A00%3A00-05%3A00&until=2012-02-17T00%3A00%3A00-05%3A00&symbols=AAPL&limit=1000]
{
  "AAPL": [
    {
      "t": 1329195600,
      "o": 10.299,
      "h": 10.401,
      "l": 10.247,
      "c": 10.399,
      "v": 722852227
    },
    {
      "t": 1329282000,
      "o": 10.499,
      "h": 10.74,
      "l": 10.14,
      "c": 10.154,
      "v": -1747801877
    },
    {
      "t": 1329368400,
      "o": 10.027,
      "h": 72.127,
      "l": 9.929,
      "c": 10.251,
      "v": 854417128
    }
  ]
}

RestRequest [api=Alpaca, id=2, url=https://data.alpaca.markets/v1/bars/1D?start=2012-03-13T00%3A00%3A00-04%3A00&until=2012-03-16T00%3A00%3A00-04%3A00&symbols=AAPL&limit=1000]
{
  "AAPL": [
    {
      "t": 1331611200,
      "o": 11.38,
      "h": 11.594,
      "l": 11.34,
      "c": 11.591,
      "v": 1145940201
    },
    {
      "t": 1331697600,
      "o": 11.797,
      "h": 12.137,
      "l": 11.743,
      "c": 12.031,
      "v": -1948238172
    },
    {
      "t": 1331784000,
      "o": 85.641,
      "h": 85.716,
      "l": 11.81,
      "c": 11.95,
      "v": 903796687
    }
  ]
}