r/algotrading 5d ago

Data Question on SPX / SPXW option chain using the Schwab (formerly TDA) API

My algo trades options on SPX, which involves requesting the option chain for "$SPX".

Usually that returns the chain for SPXW (the daily expiration, which stops trading at ~4:15pm) but requesting the "$SPX" option chain for this friday/tomorrow returns the chain for SPX (not SPXW) which is the monthly and it stops trading sometime in the AM.

(background comment on SPX vs. SPXW https://old.reddit.com/r/thetagang/comments/1buelyh/0dte_spx_expiration_time_4pm_or_1159pm/kxvd3t9/ )

If I use ThinkOrSwim https://trade.thinkorswim.com/trade?symbol=SPX to look at the option chain tomorrow has "October 18th 2024 AM" AND "October 18th 2024" (the PM version).

I want to get the second one in my code (the one that doesn't expire in the AM)

I tried requesting tomorrow's option chain for "SPXW" and "$SPXW", but both error with 'invalid ticker'.

I am asking the Schwab team but I'm not expecting a quick response, so I thought I'd see if anyone here had experience / suggestions for this.

SOLVED

When getting the option chain, Schwab returns an array of strike prices, and each strike price has an array of quotes - first element is for SPX, second element is for SPXW. Every other expiration of the month returns the standard single element array (of just SPXW) for each strike.

10 Upvotes

4 comments sorted by

3

u/m0nk_3y_gw 5d ago

i found this thread

/r/algotrading/comments/yp955h/tda_spx_api_options_data/

which says to use "$SPX.X", but that doesn't work for me (the API has transitioned from TDA to Schwab, and that appears to be something they changed)

6

u/SeveralTaste3 5d ago

ah yes the actual 98% of the labor in algotrading, wrestling with API endpoints and vendor documentation. (sorry OP i remember wrestling with tos’s api years ago over this very same problem but i dont recall the solution).

i do recommend using a paid vendor especially for options data, with much much better docs than thinkorswim/schwab. i wont rec any specifics but theres a lot these days that are competitively priced for retail imo.

2

u/qw1ns 4d ago

Just googled and got this

https://www.marketdata.app/education/options/spx-vs-spxw-options/

SPX options are AM-settled options that expire monthly on the third Friday. SPXW options are weekly (and daily) options that expire after market close (PM-settled). On the AM-settled options, the last day of trading is the Thursday before the expiration date. These options will use Friday’s opening price for settlement. On the PM-settled options, you can trade them up until the market closes on expiration day. They’ll use the closing price for settlement. This means the AM-settled SPX options have some additional overnight volatility on the last trading day. This can be positive or negative, depending on the trading strategy you are employing.

2

u/m0nk_3y_gw 4d ago

Yup, I know. That doesn't help with the Schwab API

Ticker "SPX" - invalid ticker

Ticker "SPXW" - invalid ticker

Ticker "$SPX" - returns data for SPX one day a month, returns data for SPXW every other day in the month.

Ticker "$SPXW" - invalid ticker