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



Best Answer

  • pf
    pf
    Answer ✓

    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']

Answers

  • 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


  • 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 ?