Rblp / Rblpapi

R package interfacing the Bloomberg API from https://www.bloomberglabs.com/api/
Other
166 stars 75 forks source link

bdh #302

Closed cdspqi closed 4 years ago

cdspqi commented 4 years ago

https://github.com/cdspqi/quickfix/issues/1#issue-561876802

(Edited by @eddelbuettel to repair this)

In the example below, overrides don't seem to be working:

start_date <- as.Date("2020-02-05")
end_date <- start_date
field_name <- "EQY_WEIGHTED_AVG_PX"
ticker <- "FXI US Equity"
bbg_overrides<-c(VWAP_START_TIME="14:00", VWAP_END_TIME="15:00")

bdh(ticker,fields=field_name,start.date=start_date,
        end.date=end_date,overrides=bbg_overrides)

yields

date EQY_WEIGHTED_AVG_PX
1 2020-02-05 41.4351

The value returned above is for the whole day. The actual value for the time period I specified should be 41.3959 (note that the default time zone on my host machine is CST)

johnlaing commented 4 years ago

Perhaps you meant to open the linked issue here rather than in your own copy of the project?

Anyway, unfortunately I have no insight into how to specify vwap overrides. We pass the overrides as text into the API - perhaps the problem is date/time formatting. This is more a question for the helpdesk. They won't know anything about Rblpapi but in theory someone should be able to help with the C++ API, which we are just a wrapper around.

cdspqi commented 4 years ago

Thanks John. Yes, I did intend to open this issue here...rookie mistake. I will check on the VWAP_START_TIME / END_TIME formatting with the helpdesk - although it does work as a character string through Excel.

eddelbuettel commented 4 years ago

@cdspqi You can still edit the entry above. Go to the issue you linked, click on '...', select edit, copy the content and then do the same above.

But as @johnlaing said: likely not our issue here as we just 'transmit' the value via the API as a transport means to have the request resolved at their end. At it is that last bit that coughs here.

eddelbuettel commented 4 years ago

I suggest you press F1 on your Bloomberg terminal and discuss that with the help desk. We do not process the answer which is what you get. Your time window may be off (timezones?), or the field may be wrong, or ...

cdspqi commented 4 years ago

636738954_APP_API_Services_USRG_170831.pdf Page 51 (VWAP SCHEMA) of the attached reference guide outlines the VWAP schema subscription options. It appears that my call above is consistent with these options. Also, it is not a timezone problem as my terminal time zone (TZDF) is set to Central Daylight Time.

johnlaing commented 4 years ago

The schema you reference is for the streaming vwap service, but what you seem to be looking for is a historical price average. Apples to oranges.

You say that it works correctly in Excel. It would be helpful to see what you're doing there, because I get the same results in Excel as in R.

cdspqi commented 4 years ago

Looks like I made a mistake. Excel implementation for bdh() doesn't expose VWAP_START_TIME / VWAP_END_TIME as per full override list when you look at FLDS function in bbg terminal.

eddelbuettel commented 4 years ago

Ok to close then?

cdspqi commented 4 years ago

Yes. Thanks!

On Feb 12, 2020, at 11:28 AM, Dirk Eddelbuettel notifications@github.com wrote:



Ok to close then?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FRblp%2FRblpapi%2Fissues%2F302%3Femail_source%3Dnotifications%26email_token%3DAOP3CIQZF6GEY7ESK2PE4E3RCQWVPA5CNFSM4KSDEOE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELRUTPQ%23issuecomment-585320894&data=01%7C01%7Ccdardanes%40sterlingpartnersqi.com%7C8d9538b7f4914e7b996b08d7afe109b9%7Cc986f6fc26fe4fe688f332d03ef45b47%7C0&sdata=wvo2J5XTqJd1vxT98xlohfnYMLHxzxrW3dSbYlgsVeI%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOP3CIUFKB5LOYN3BUBVMCLRCQWVPANCNFSM4KSDEOEQ&data=01%7C01%7Ccdardanes%40sterlingpartnersqi.com%7C8d9538b7f4914e7b996b08d7afe109b9%7Cc986f6fc26fe4fe688f332d03ef45b47%7C0&sdata=iDBJ9ti7Hupjz17W%2BImHoQsY2%2FjJKX8lsntB9P5KpiE%3D&reserved=0.

travis-leith commented 2 years ago

Just popping in here to say that the field you used is for a BDP request, not a BDH request. Probably why you don't get the results you expect.