Finding the ATM strike

Discussion in 'Options' started by TheBigShort, Jan 27, 2019.

  1. TheBigShort

    TheBigShort

    Does anyone know of a good way to find the atm strike for a given expiration? Currently I download the option chain from yahoo finance for a given expiration and figure out which strike is the closest to the stock price. However Yahoo option data is really unreliable for weeklys.

    Even if you could point me to a good website to scrape off of. I wrote a scraper for NASDAQ but they index the option chain expirations with numbers 1:x rather than expiration date. So I am ify on the reliability of my scraper for this going forward.

    https://www.nasdaq.com/symbol/aapl/option-chain?dateindex=1 This is feb expirations
    https://www.nasdaq.com/symbol/aapl/option-chain?dateindex=2 This is March expirations etc...

    A rest API would be ideal!

    Ps. Does anyone have some hacks to scrape off of Barchart, it looks like they will not allow users to scrape data
     
    .sigma likes this.
  2. jamesbp

    jamesbp

    ATM strike for the implied forward price
    ... is where the absolute difference between the Call and Put prices is the minimum

    You can approximate the forward price as Strike + Call price - Put price
     
  3. TheBigShort

    TheBigShort

    Thanks for the response but maybe I was not clear. I am simply looking for a website that provides an option chain (delayed is fine) where I can scrape the strike prices. And if anyone has an algorithm to choose the closest to the ATM strike. Right now my algorithm is find which strike has the minimum absolute value of the strike - the last stock price. I pull the data from yahoo finance but the weekly data is unreliable.

    The strike will then be used to get data from interactive brokers
     
  4. newwurldmn

    newwurldmn

    Does Bloomberg have a function?
     
    Nobert likes this.
  5. TommyR

    TommyR

    Yeah quantconnect has access to a library with this at i think frequency 1 min so you can go on there. For atm strike your logic is fine but note the convention for atm for expirations less than 2 years is when the call delta = -put delta (not atm spot, which you are using, or atm forward though who cares for short date when the strikes choices are discrete anyway). The code will be like 1 line:you will need to select the option chain by underlying.expiration and then for example: while(i<arraysize(option_chain){option_select(i); if (option type==call){k=strike(i),s=spot; k_atm=k*(Abs(k-s)<Abs(k_atms-s))}i+=1;} ////there are lots of examples in other languages//// In general you will want to store raw option price data in tensors of rank at least 4 like bid[time][underlying][expiration][strike]; where expirations are all the expiration dates falling in the span of the time array AND the time itself for the spot price (for time>expiration set bid = to the expiry payout or 0). It's worth getting this and storing it somewhere as it saves a lot of time in future when you want to select fixed security-expiration-time-delta regions at each time (=TimeLocal()) step.
     
  6. TommyR

    TommyR

    can also be useful as an object handler for recieving price data for when some contracts are a bit slow to get into line :)
     
  7. TommyR

    TommyR

    sorry i would need k_atm=k*(Abs(k-s)<Abs(k_atms-s))+k_atm*(Abs(k-s)>=Abs(k_atms-s)). Or more simply if(Abs(k-s)<Abs(k_atm-s)){k_atm=k;} but i find if() to be prohibitabily slow as an operator.
     
  8. tommcginnis

    tommcginnis

    Why not utilize IB as your starter, since that's where you're going anyway?

    What data are you (then) getting from IB?

    By what API path are you working with IB?

    (FWIW, I set up a QuoteMonitor page specifically for scraping purposes, and offload that to a spreadsheet from which I end up with a 3D table/chart of option data in market-v-time space. The offload takes ~3 minutes from TWS to printed results.)
     
    Last edited: Jan 27, 2019
  9. TheBigShort

    TheBigShort

    This is an at home project and will not be able to use the terminal.

    I use R with IB (I know i should really move to python for this) so my calls are limited to what is in the IBrokers package. Could you explain more about how you scrape from your quote monitor and what language you are using?
    Thanks for the input Tommy, but it looks like their libraries only hold historical data? I am seeing option chains only up until 20181130
     
  10. oldmonk

    oldmonk

    The straddle is smallest at the money, so this should work: strikes[which.min(calls + puts)]
     
    #10     Jan 27, 2019