Code to get Open interest ek.get_data('/SBc1',[TR.OPENINTEREST']) has stopped working

Hi, the python code below was used to get the open interest for sugar no11 and no.5, it used to work but has recently stopped working and returns NoneType.

open_int, err = ek.get_data('/SBc1', ['TR.OPENINTEREST.date',

'TR.OPENINTEREST',

{'SDate': '2023-01-01', "EDate": str(datetime.date.today())})


Is there a different code that I need to use?


Best Answer

  • aramyan.h
    Answer ✓

    Hi @BSeed ,


    Thank you for your question. I just checked it works for me:

    screenshot-2023-03-31-at-155147.png

    It seems you are just missing "]" after 'TR.OPENINTEREST'. Please have a look at the complete code below:

    open_int, err = ek.get_data('/SBc1', ['TR.OPENINTEREST.date','TR.OPENINTEREST'],
    {'SDate': '2023-01-01', "EDate": str(datetime.date.today())})
    open_int


    Best regards,

    Haykaz