How can I get price data of historical/expired option?

If I use get_data function to get .SPX option data like this:

df,error= ek.get_data('0#SPX*.U',['CF_LAST','CF_BID','CF_ASK','CF_DATE','EXPIR_DATE','STRIKE_PRC'],{"SDate":'2017-12-21', "EDate":'2018-01-01'})

I can only get the latest snapshot of the option data, even if I have specified the date range. Can anyone help? Thanks in advance.

Best Answer

  • Zhenya Kovalyov
    Answer ✓

    The fields that you are using only exist in the real-time context.

    You can get the historical values for the last, bid and ask with a using TR.BIDPRICE, TR.ASKPRICE and TR.CLOSEPRICE.

Answers