Dowloading Traded Volume using Python (Eikon API) - get_data

Hi,

I'm trying to download the traded volume (accumulated volume) for bonds between two specific dates. In Excel, the syntax is :

=TR(Bond Identifier,"TR.ACCUMULATEDVOLUME","Frq:W TRANSPOSE:YES CALCMETHOD:SUM SDate:05/23/19 EDate:05/30/19").

I'm trying this:

TV, err = ek.get_data(Bond Identifier,[{'TR.BidPrice':{'params':{'SDate':"05/23/2019", 'EDate':"05/30/2019"}}}], debug = False)

but only NaN values shows up. Can you help me translate that into Python syntax? Thank you!

Best Answer

  • Try

    ek.get_data('US345370BR09',['TR.BidPrice'],
    {'SDate':'05/23/2019', 'EDate':'05/30/2019'}

Answers

  • Thanks Alex, but I was meant to download 'ACCUMULATEDVOLUME' not Bid Price. Bid Price works fine but ACCUMULATEDVOLUME does not seem to work...

  • Ah. OK. Here's the expression that exactly replicates =TR function you mentioned.

    ek.get_data('345370BR0=FINR',['TR.ACCUMULATEDVOLUME'],
    {'SDate':'05/23/2019', 'EDate':'05/30/2019',
    'CALCMETHOD':'SUM', 'FRQ':'W'})
  • Amazing, thank you!