alpha-xone / xbbg

An intuitive Bloomberg API
https://xbbg.readthedocs.io/
Apache License 2.0
246 stars 52 forks source link

Is BQR MSG1 supported? #22

Closed OdinCosta closed 3 years ago

OdinCosta commented 3 years ago

Hi, Congrats and thanks for the amazing work put so far! I'm wondering if the actual library would support the BQR excel function?

I've looked into WAPI and it seems to suggest that you can build a proxy using the intraday tick data.

Here is the snippet:

How do I emulate the BQR() Bloomberg formula in Microsoft Excel via the API interfaces?

To emulate the BQR formulas using the Desktop or Server API is a two step process. Under the hood of the formula in Microsoft Excel, these are the requests being made:

An Intraday Tick Request, which is using the //blp/refdata service and the "IntradayTickRequest" operation (i.e. request type). A subscription to BID, ASK, BEST_BID and BEST_ASK for that same instrument. This uses the //blp/mktdata service.

For example, if you have the Microsoft Excel formula:

=BQR("IBM/ MSG1 Corp","-2D","","query=time,broker,bid,ask")

Under the hood, we are calculating 2 days back and determining the absolution startdate/time and setting the enddate/time to now. We are then setting the EventTypes property (i.e. element) to BID and also to ASK. For the "Broker", we are setting the "includeBrokerCodes" property to "true". Along with the security ("IBM/ MSG1 Corp"), this makes up our intraday tick request.

Once you get this data back, you will then subscribe to this security, along with BEST_BID, BEST_ASK, BID and ASK. Unfortunately, we do not provide an example of this, so it will be up to you to develop this. You can obtain most of the information you need from the IntradayTickExample and the SimpleSubscriptionExample examples in the Desktop API or the Server API SDK.

I was wondering if I could try it on with your blp.bdib using the /MSG1 source, but not sure if I need to modify anything on the root files. Any idea?

Thank you!

alpha-xone commented 3 years ago

Not much experience in the fixed income area. See if anyone could contribute to this direction.