How to select PRICE instead of the default YIELD value returned by BLP.HISTORY in MATLAB?
52 views (last 30 days)
Show older comments
I am trying to replicate the following excel formula in matlab using history to pull in bloomberg data:
=BDH("EI703520 Corp","PX_LAST","12/31/2010","12/31/2011","qttyp=p")
The ticker, "EI703520 Corp" is a bond ticker and I am looking to pull in historical prices for the bond. Bloomberg has both historical prices and historical yields, but the default value when you pull in the field "PX_LAST" is the yield. In excel you can specifically request bond prices by adding "qttyp=p" to the request formula (qttyp = quote type). Is there a way to do the same thing in matlab using a history function call?
As an example, below I am pulling in the field "Px_Last" for this bond:
c = blp;
data = history(c, 'EI703520 Corp', 'PX_LAST', floor(now)-366, floor(now)-1);
close(c);
The data returned here for Px_Last is the yield instead of price. Is there an option to specify the quote type in MATLAB?
Accepted Answer
MathWorks Support Team
on 23 Aug 2012
The following example demonstrates the use of the 'pricingOption' field to BLP.HISTORY which allows you to override the default PRICE field:
[d, sec] = history(blpConn, 'EI601189 Corp', 'PX_LAST', datenum('4/18/2012'), datenum('4/18/2012'), [], [], 'pricingOption', 'PRICING_OPTION_YIELD')
The 'pricingOption' field can either be : PRICING_OPTION_YIELD or PRICING_OPTION_PRICE.
Using PRICING_OPTION_PRICE should allow you to be able to get the PRICE instead of the YIELD.
A list of all the options and fields can be in the BLOOMBERG V3 documentation.
To access the documentation, open your Bloomberg teminal and execute:
WAPI<GO>
0 Comments
More Answers (0)
See Also
Categories
Find more on Bloomberg Server in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!