How to properly download expired commodity futures data

Being unable to get open interest data with the get_timeseries method, I tried to get all data with the get_data method. I am unable to get identical close prices with the two methods, here's an example. The way I get time series data which gives me the correct results excluding open interest:

ek.get_timeseries('BOH8^1','CLOSE',start_date='2018-02-28') I get the data up to 14-03-2018.

If I use the get_data method: ek.get_data('BOH8^1', ['TR.CLOSEPRICE.Date', 'TR.CLOSEPRICE'], {'SDate':'2018-02-28','EDate':'2018-03-18'})

I get data up to 12-03-2018. The Close price on that day according to the get_data output equals 31.43, but according to the get_timeseries output it is 31.56. What is going wrong here? There are many differences between the two timeseries.

The open interest does get me data up to 14-03-2018 as expected. ek.get_data('BOH8^1', ['TR.OPENINTEREST.Date', 'TR.OPENINTEREST'], {'SDate':'2018-02-28','EDate':'2018-03-18'})

Best Answer

  • Alex Putkov.1
    Answer ✓

    For these futures TR.CLOSEPRICE represents the last trade price, whereas what you're looking for is the settlement price. The latter can be obtained using TR.SETTLEMENTPRICE field.
    See this thread for prior discussion on similar topic.