Need VWAP historically in Eikon API. Cannot translate Excel Rhistory to Python get_timeseries().

Hello,

I am trying to get VWAP values historically using the eikon API.

Unfortunately, the following get_data query does not return value for days other than the last one:

fields2 = ["TR.PriceClose.date","TR.VWAP"]
parameters2={"CURN": "USD", "SDate":"-60","EDate":"-1","FRQ": "D"}
df_company_details_historical, e2 = ek.get_data(stock_id, fields2, parameters2)

Out[25]:
Instrument Date Volume Weighted Average Price
0 GOOG.O 2018-12-31T00:00:00Z 1171.939739
1 GOOG.O 2019-01-02T00:00:00Z NaN
2 GOOG.O 2019-01-03T00:00:00Z NaN

I try with excel and the helpdesk gave me this formula, which cannot be translated in get_timeseries as these fields are not yet supported:

Excel:

=RHistory($A$2,"VWAP.Timestamp;VWAP.Value","INTERVAL:1D NBROWS:20",,"TSREPEAT:NO CH:Fd")

Python:
test= ek.get_timeseries(stock_id, fields=["VWAP.Timestamp","VWAP.Value"],start_date = datetime.datetime(2019, 3, 1), end_date = datetime.datetime(2019, 3, 15))

Anyone can let me know how to get VWAP historically? I cannot believe such basic data are so hard to get.

Many thanks

Charles

Best Answer

  • Try

    ek.get_data(['GOOG.O'],['TR.TSVWAP.date','TR.TSVWAP'],{'SDate':'-60','EDate':'-1','FRQ':'D'})