polygon-io / issues

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

OPRA Flat Files - Missing Option Trades #308

Open strcat32 opened 1 month ago

strcat32 commented 1 month ago

I am using flat files for option trades. I noticed that starting in mid of June almost every day trades seem to be cut off in the middle of the trading session for very large tickers. And I think everyone agrees that it would be odd if ALL SPY option contracts stopped trading around 15:30 ET when the session continues to 16:00 and 16:15 for late option trades.

Here is very quick code to check "us_options_opra/trades_v1/2024/06/2024-06-10.csv.gz"


import polars as pl

pl.Config().set_tbl_width_chars(2000)

ticker = "SPY"
df = pl.read_csv(f"F:\\poly_data\\opt_trades\\2024-06-10.csv.gz")
df = df.with_columns(pl.col("sip_timestamp").cast(pl.Datetime("ns", time_zone="US/Eastern")))
df = df.sort("sip_timestamp")
df = df.filter(pl.col("ticker").str.contains(ticker))

print(df.tail(5))
print(f"Last known trade for {ticker}: {df['sip_timestamp'].to_list()[-1]}")
O:SPY240610P00536000 | 209 | 0 | 313 | 0.93 | 2024-06-10 15:31:59.849000-04:00 | 
O:SPY240610P00535000 | 209 | 0 | 304 | 0.27 | 2024-06-10 15:31:59.914000-04:00 | 
O:SPY240610P00535000 | 209 | 0 | 304 | 0.27 | 2024-06-10 15:31:59.914000-04:00 | 
O:SPY240610C00536000 | 209 | 0 | 300 | 0.1  | 2024-06-10 15:31:59.943000-04:00 | 
O:SPY240611P00535000 | 209 | 0 | 303 | 0.98 | 2024-06-10 15:31:59.984000-04:00 |

Last known trade for SPY: 2024-06-10 15:31:59.984000-04:00

No Option trades after 15:31 for SPY? Unlikely.

So i expanded this test with checking these tickers: ["SPY", "QQQ", "DIA", "AAPL"] And i tested May 2024 and June 2024. With this script: https://gist.github.com/strcat32/8590ec6b2a845e1362651d2740f15de7

Results for May 2024: MAY

Notice that May looks completely fine. All ETFs trade until around 16:15 ET and a stock like AAPL until 16:00. So no problems here.

Results for June 2024: JUNE

From June 10th we begin to see problems. Where in the middle of the trading session around 15:xx ET no more option trades occur for all tested tickers.

So what is going on? Where are the missing trades?

*This is a crosspost. I originally posted this on reddit, when i was not aware of this issue page. https://www.reddit.com/r/PolygonIO/comments/1e0s2q6/mission_option_trades_in_flat_files/

kevashcraft commented 1 month ago

I am seeing the same thing via the API, and the issue appears to be new.

For example, the trades for NVDA call O:NVDA240712C00130000 on 2024-06-12, as retrieved on 2024-06-13 (the day after) contained trades up until 4pm. However, when the same trades are retrieved now, they stop at 2:20pm est.

It appears as though current day data does not have this issue. Today's TSLA contracts, pulled today after 4pm, have trades up until 4pm, however the previous day stops at 3pm.

Here's an example query that demonstrates the issue. This should return the final 10 trades on 2024-07-19, however the final timestamp is 1721411393449000000 (1:49pm).

https://api.polygon.io/v3/trades/O:TSLA240719C00200000?timestamp=2024-07-19&limit=10&apiKey=

Could you please confirm the issue?

AHangstefer commented 1 month ago

Thanks for reaching out! I am looking into this

AHangstefer commented 1 month ago

Thank you for bringing this to our attention. We have a ticket open and the backend team is looking into this.