'Using the QtTyp=P override via PYBBG bdh () function
I am trying to the get the price of a bond in my Python code using PYBBG, but the code returns the yield instead of the price. The fix for this in Excel is to add "QtTyp=P' to the function call, but i am struggling to replicate the same in my Python code.
=BDH("ZP562497 Corp","last_price", "20220101","","cols=2;rows=20", "QtTyp=P")
Returns
1/3/2022 95.875
1/4/2022 95.298
1/5/2022 94.955
1/6/2022 94.229
1/7/2022 94.321
1/10/2022 93.745
1/11/2022 93.973
=BDH("ZP562497 Corp","last_price", "20220101","","cols=2;rows=20")
but without the qtTyp parameter i get:
1/3/2022 1.685
1/4/2022 1.7475
1/5/2022 1.785
1/6/2022 1.865
1/7/2022 1.855
1/10/2022 1.9188
1/11/2022 1.8938
How can i replicate the same parameter in my python code?
I tried the following:
overrides = dict(QuoteType='P')
histBondsData = bbgReader.bdh(['ZP562497 Corp'], 'PX_LAST', dt, dt, other_request_parameters=overrides)
but i get the following exception:
Sub-element 'QuoteType' does not exist. (0x0006000d)
Can someone please help with adding the parameter to my BDP call in Python? Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
