This is a demo javascript app to demonstrate how to parse Tastyworks equity and equity option symbols and open a websocket connection with our quote provider.
This code shall not be used in production applications. This is for learning purposes only.
Equity symbols contain only alphanumeric characters (A-Z, 0-9) with an occasional /
. A few examples:
AAPL
BRK/A
Tastyworks uses the same conventions as the OCC for equity option symbols. You can read more about OCC symbology here.
In short, there are 4 pieces that make up an equity option symbol:
- Root symbol - 6 alphanumeric digits with whitespace padding.
AAPL
FB
BRK/A
- Expiration date - 6 numeric digits with format
yymmdd
. - Option type -
P
orC
- Strike price - 8 numeric digits front-padded with 0s. No decimals. Multiply strike by 1000.
- 64.0 strike:
00064000
- 1050.55 strike:
01050550
- 0.50 strike:
00000500
- 64.0 strike:
Example equity option symbols:
AAPL June 17, 2022 150 Put: AAPL 220617P00150000
SPY Nov 18, 2022 400 Call: SPY 221118C00400000
SPX May 20, 2022 4025 Call: SPXW 220520C04025000
Replace the demo token
and wsUrl
in quote-streamer.tsx
with a tastyworks account streamer token and url.
To run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.