question

Upvotes
Accepted
13 1 2 5

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)
eikoneikon-data-apipythonapi
comex-grab.png (46.8 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
86.2k 292 53 79

@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



1652936623915.png (22.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
86.2k 292 53 79

@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.


1652850470071.png (61.6 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
13 1 2 5

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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
13 1 2 5

thanks.. works as expected!

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.