Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
22 4 5 8

Annual Total Traded Volume of Commodity

I need the total traded volume (annually) for Natural Gas commodity at NYMEX. For that purpose, if I write this code in Python API, I need to clarify what volumes does this code provides?Even if it provides the monthly total volume, it is still for just these future contracts and how to retrieve for all contracts in a single code line?
req = ek.get_timeseries(["NGc1", 'NGc2', 'NGc3', 'NGc4', 'NGc5'],['VOLUME'], start_date = "2011-01-01", end_date = "2020-12-31", interval="monthly")

Any lead will be highly appreciated.

eikon-data-apicommoditiesvolume
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.

<AHS>

Hi @jason.ramchandani01

Could you please help the client with the follow-up question?

<AHS>

Hi @jason.ramchandani01

Could you please help the client with the follow-up question?

hi @saad.ali

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.


Thanks,
AHS

Upvotes
Accepted
14.2k 30 5 10

hi @saad.ali

The field Accumulated Volume is the sum of the volume in each calendar year as shown in the screenshot of DIB posted by Jason above.

1641299493324.png

Plus, to get contracts of NGc1 till NGc158, you may use the code below

rics = []
for i in range (158):
    rics.append('NGc'+str(i+1))
print(rics)

req,err = ek.get_data(rics,['TR.ACCUMULATEDVOLUME.date','TR.ACCUMULATEDVOLUME'],parameters= {'SDate':"2011-01-01", 'EDate':"2020-12-31",'Frq':"CY",'CALCMETHOD':'SUM'})

req

1641300082416.pngHope this could help


1641299493324.png (132.4 KiB)
1641300082416.png (77.1 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
10.2k 18 6 9

@saad.ali Please try the following:

req,err = ek.get_data(["NGc1", 'NGc2', 'NGc3', 'NGc4', 'NGc5'],['TR.ACCUMULATEDVOLUME.date','TR.ACCUMULATEDVOLUME'],parameters= {'SDate':"2011-01-01", 'EDate':"2020-12-31",'Frq':"CY",'CALCMETHOD':'SUM'})

req

1637233151808.png

Is this OK for you?

Regarding descriptions for fields you can use the Data Item Browser app which allows you to look for all fields for an instrument and get the descriptions, parameters as well as values - seee below - noote in the bottom right of the app you can see the field formula being built up for you as you select parameters - which allows you to easily copy paste into the get data function say.

1637233432259.png

I hope this can help.


1637233151808.png (145.7 KiB)
1637233432259.png (277.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
22 4 5 8

@jason.ramchandani01 Thank you very much for your response. Yes, it has surely helped a lot. But I need clarification regarding one thing. What I actually need is the overall volume traded annually. Your formula works but the future contracts aren't just limited to these 5 contracts for natural gas. In fact, they are several of them round about till NGc158.

So the actual traded volume would be the sum of all these contracts for an year if I understood it right?

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.

Hello @jason.ramchandani01 ,

Your answer was very helpful!

Please take a look at the follow-up question from the developer, can you help?

Thanks

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.