Yahoo option chain web page changed

Discussion in 'App Development' started by kiev, Jul 12, 2016.

  1. Great tip, John. Thank you.
    Is there a way to get all the expiration dates in one page?
    Thanks again.
    Arturo
     
    #11     Nov 10, 2016
  2. No, you have to loop through all the expiries.

    Call a simplified version of the URL:
    https://query1.finance.yahoo.com/v7/finance/options/APPL

    That gets you a json response with underlying info, a list
    of expiries and strikes, and the first expiries option chain.

    If you are using python get the expiry list like this:


    url = 'https://query1.finance.yahoo.com/v7/finance/option/AAPL'
    uConn = urllib2.urlopen(url)
    ii = uConn.readline()
    ii = demjson.decode(ii)
    uConn.close()
    uaExpiries = ii['optionChain']['result'][0]['expirationDates']
     
    #12     Nov 10, 2016
  3. Thanks, Kevin. Appreciated.
     
    #13     Nov 10, 2016
  4. Last edited: Nov 15, 2016
    #14     Nov 15, 2016
  5. bln

    bln

    Tip, here how one can convert from epoch on Linux:

    date -d @1469145600

    or with a custom format:

    date -d @1469145600 +"%d-%m-%Y %T %z"

    get the current time in epoch:

    date +%s
     
    #17     Nov 16, 2016
    gkishot likes this.