Cannot get COMEX Gold Futures Contract

Hi,

Looking to take a daily grab with the eikon API for 0#GC:

I assumed the same code I use for the Options chain (0#GC+) - where we write the options chain to a list and then pull teh fields. But with the futures prices I get blanks!

Hope you can advise


comex-grab.png

request = ek.get_data(instruments=['0#GC+'], fields=['X_RIC_NAME'])[0]


res2= True
while res2:
try:
dfs = [ek.get_data(instruments=[x], fields=['X_RIC_NAME','DSPLY_NAME'])[0] for x in request['Instrument'].tolist()]
res2=False
except Exception as E:
print (E)

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @Bruce.Alway

    You can try this code:

    request = ek.get_data(instruments=['0#GC:'], fields=['BID','ASK','PRIMACT_1','DSPLY_NAME'])[0]
    request

    The output is:

    1652936623915.png


Answers

  • @Bruce.Alway

    I used this code to get BID, ASK, and PRIMACT_1.

    dfs = [ek.get_data(instruments=[x], fields=['BID','ASK','PRIMACT_1','DSPLY_NAME'])[0] for x in request['Instrument'].tolist()]

    Then, you need to verify the data with Eikon Quote.

    1652850470071.png

    Most prices in Eikon Quote are blank too. You may need to contact the Eikon support team via MyRefinitiv to verify the content.

  • hi - thanks for looking - i cant reproduce your output - also these are the options chain 0#GC+ - which i already extract. Im having trouble with the futures prices 0#GC (the quote is as per screen shot. Can you review please.

  • thanks.. works as expected!