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
1 0 0 0

Retrieving stock's volume. Mismatch between excel and python api

Hi

I am looking for Microsoft's volume.

I try

=@TR("MSFT.O";"AVG(TR.Volume);TR.Volume;TR.TURNOVER;TR.ACCUMULATEDVOLUME";"SDate=0D EDate=0D-29D";B9)

and the output is


25281455,920829953780019275720829953


It seems good

Unfortunatly, i try on python and i obtain different value :

df=ek.get_data(listRIC, ['TR.PriceClose.date','TR.MarketCapLocalCurn','AVG(TR.VOLUME(SDate=-29D,EDate=0D))'], {'SDate':'-0D', 'EDate':'-0D'})

The output is

Pandas(Index=0, Instrument='MSFT.OQ', Date='2024-01-09T00:00:00Z', _3=2792969860614.91, _4=8974470.66666667)

It looks like the turnover and not the volume.

Do you have any idea how to obtain the same result ?

Best regards,

Matthieu



#contentpython apivolumemarket-price
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.

@m.barr

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your 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
1.3k 3 2 4

Hi @m.barr

As MSFT.O is the best match with US5949181045, I confirm the second choice is the right one:

r = ek.get_symbology("US5949181045", from_symbol_type="ISIN", to_symbol_type="RIC")
ric = r["RIC"][0]

If you manage a list of ISIN codes, you can retrieve all best matches in one call.

Ex:

r = ek.get_symbology(
    ["US5949181045", "US0378331005"],
    from_symbol_type="ISIN",
    to_symbol_type="RIC",
)
ric = list(r["RIC"]) 

=> ric = ['MSFT.O', 'AAPL.O']

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
98 5 5 15

dear @matthieu.barrailler

you get differt average volume betwwen Excel and Python because you don't submit the same ric.

as highlighted below, if you submit the same (MSFT.O), you will get the same average volume

1704897324253.png



1704897324253.png (16.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
1 0 0 0

Hi, Thank you for your answer.

Unfortunatly, i obtained this ric with the following formula :

ek.get_data(['US5949181045'], ['TR.RIC'])

Is there a way to obtain msft.O or accessing the entire available volume ?

It seems i could have the "main" ric with :

ek.get_symbology(['US5949181045'], from_symbol_type='ISIN', to_symbol_type='RIC')

What is the best way ?

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.