polygon-io / issues

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

No quotes on 2022-03-15 and 2022-03-16 #204

Closed marcel-dehaan closed 1 year ago

marcel-dehaan commented 2 years ago

Same issue as #192 and #109.

from datetime import datetime
from dateutil import tz
import requests
import pandas as pd

API_KEY = ""
ny_tz = tz.gettz("America/New_York")
header = {"Authorization": f"Bearer {API_KEY}"}
symbol = "AAPL"
for pydate in [datetime(2022, 3, 15), datetime(2022, 3, 16)]:
    ts_start = int(pydate.replace(tzinfo=ny_tz).timestamp() * 1e9)
    url = f"https://api.polygon.io/vX/quotes/{symbol}?timestamp.gte={ts_start}&limit=50000&order=asc"
    ticks = requests.get(url, headers=header).json()["results"]
    print(
        pd.Timestamp(ts_start),
        pd.Timestamp(ticks[0]["sip_timestamp"]),
        pd.Timestamp(ticks[-1]["sip_timestamp"]),
    )

-> 2022-03-15 04:00:00 2022-03-17 08:00:00.060702740 2022-03-17 13:36:23.407783492
-> 2022-03-16 04:00:00 2022-03-17 08:00:00.060702740 2022-03-17 13:36:23.407783492

This issue has stark consequences for subscribers like me that leverage ticks in their live trading systems, so please address the underlying issue this time around.