polygon-io / issues

Quickly track and report problems with polygon.io
29 stars 0 forks source link

Aggs endpoint contains incorrect first result #1

Closed clickingbuttons closed 4 years ago

clickingbuttons commented 4 years ago

URL Calling https://api.polygon.io/v2/aggs/ticker/GGE/range/1/day/2004-02-05/2020-02-03 at 200 times per second for 36k calls gives incorrect results for between 2-100 calls. When incorrect results are returned sometimes it's in spurts, which leads me to believe this is a caching issue.

Result The first results[0] is:

{
  "T":"X:BTCUSD",
  "v":516831.5165334968,
  "vw":17.1859,
  "o":7821.73,
  "c":17.251,
  "h":8988,
  "l":17.015,
  "t":1305518400000,
  "n":1
}

The rest of the results are correct.

Expected Result I expect the first results[0] to be:

{
  "v":11446,
  "vw":17.1859,
  "o":17.1,
  "c":17.251,
  "h":17.32,
  "l":17.015,
  "t":1305518400000,
  "n":1
}

Additional context This problem has been reported on Slack a few times and about 6mo ago was not occurring. If you would like a program that reproduces this, try running "Jack.java" at https://github.com/clickingbuttons/polyquest and look for errors on stdout like bad JSON from .... If you would like an exhaustive list of URLs this has occurred for me on, I have logs for about 200 occurenences.

jbonzo commented 4 years ago

We identified the source of the problem, it was a race condition in between and within our aggregate service. This fix should also resolve #2

clickingbuttons commented 4 years ago

I can confirm both are fixed. Thank you very much @jbonzo !