pdblp 中 bdh() 的字段覆盖
Field override for bdh() in pdblp
Bloomberg 的帮助对他们 API 帮助不大。谁能解释一下如何用股息调整后的价格字段替换 PX_LAST
。我尝试了以下但没有成功
import pdblp
con = pdblp.BCon()
con.start()
df2 = con.bdh(['NQ1 Index', 'DM1 Index'], ['PX_LAST'],
'20061227', '20061231', elms=[("periodicityAdjustment", "ACTUAL")])
查找此信息的最佳位置是 BLOOMBERG OPEN API – REFERENCE SERVICES & SCHEMAS GUIDE
。要访问它,请从彭博终端转到 WAPI <GO>
-> API Developer's Guide
.
这些来自第 20 页 BLOOMBERG OPEN API – REFERENCE SERVICES & SCHEMAS GUIDE
adjustmentSplit {TRUE, FALSE}
Adjust historical pricing and/or volume to reflect: Spin-Offs, Stock
Splits/Consolidations, Stock Dividend/Bonus, Rights Offerings/
Entitlement.
adjustmentFollowDPDF {TRUE, FALSE}
Setting to true follows the DPDF BloombergProfessional service
function. True is default setting for this option
这方面的一个例子显示了 Apple 是否合并了分割调整。
import pdblp
con = pdblp.BCon().start()
con.bdh("AAPL US Equity", "PX_LAST", "20140604", "20140610",
elms=[("adjustmentSplit", True)])
ticker AAPL US Equity
field PX_LAST
date
2014-06-04 92.1171
2014-06-05 92.4786
2014-06-06 92.2243
2014-06-09 93.7000
2014-06-10 94.2500
con.bdh("AAPL US Equity", "PX_LAST", "20140604", "20140610",
elms=[("adjustmentSplit", False)])
ticker AAPL US Equity
field PX_LAST
date
2014-06-04 644.82
2014-06-05 647.35
2014-06-06 645.57
2014-06-09 93.70
2014-06-10 94.25
可以在 pdblp
之上尝试另一个包装器库:xbbg
可以使用与 Excel 中相同的覆盖并直接使用 kwargs
。调整前:
from xbbg import blp
blp.bdh(
'AAPL US Equity', 'Px_Last', '20140604', '20140610',
CshAdjNormal=False, CshAdjAbnormal=False, CapChg=False,
)
输出:
ticker AAPL US Equity
field Px_Last
date
2014-06-04 644.82
2014-06-05 647.35
2014-06-06 645.57
2014-06-09 93.70
2014-06-10 94.25
拆分调整:
blp.bdh(
'AAPL US Equity', 'Px_Last', '20140604', '20140610',
CshAdjNormal=True, CshAdjAbnormal=True, CapChg=True,
)
输出:
ticker AAPL US Equity
field Px_Last
date
2014-06-04 85.12
2014-06-05 85.45
2014-06-06 85.22
2014-06-09 86.58
2014-06-10 87.09
Bloomberg 的帮助对他们 API 帮助不大。谁能解释一下如何用股息调整后的价格字段替换 PX_LAST
。我尝试了以下但没有成功
import pdblp
con = pdblp.BCon()
con.start()
df2 = con.bdh(['NQ1 Index', 'DM1 Index'], ['PX_LAST'],
'20061227', '20061231', elms=[("periodicityAdjustment", "ACTUAL")])
查找此信息的最佳位置是 BLOOMBERG OPEN API – REFERENCE SERVICES & SCHEMAS GUIDE
。要访问它,请从彭博终端转到 WAPI <GO>
-> API Developer's Guide
.
这些来自第 20 页 BLOOMBERG OPEN API – REFERENCE SERVICES & SCHEMAS GUIDE
adjustmentSplit {TRUE, FALSE}
Adjust historical pricing and/or volume to reflect: Spin-Offs, Stock Splits/Consolidations, Stock Dividend/Bonus, Rights Offerings/ Entitlement.
adjustmentFollowDPDF {TRUE, FALSE}
Setting to true follows the DPDF BloombergProfessional service function. True is default setting for this option
这方面的一个例子显示了 Apple 是否合并了分割调整。
import pdblp
con = pdblp.BCon().start()
con.bdh("AAPL US Equity", "PX_LAST", "20140604", "20140610",
elms=[("adjustmentSplit", True)])
ticker AAPL US Equity
field PX_LAST
date
2014-06-04 92.1171
2014-06-05 92.4786
2014-06-06 92.2243
2014-06-09 93.7000
2014-06-10 94.2500
con.bdh("AAPL US Equity", "PX_LAST", "20140604", "20140610",
elms=[("adjustmentSplit", False)])
ticker AAPL US Equity
field PX_LAST
date
2014-06-04 644.82
2014-06-05 647.35
2014-06-06 645.57
2014-06-09 93.70
2014-06-10 94.25
可以在 pdblp
之上尝试另一个包装器库:xbbg
可以使用与 Excel 中相同的覆盖并直接使用 kwargs
。调整前:
from xbbg import blp
blp.bdh(
'AAPL US Equity', 'Px_Last', '20140604', '20140610',
CshAdjNormal=False, CshAdjAbnormal=False, CapChg=False,
)
输出:
ticker AAPL US Equity
field Px_Last
date
2014-06-04 644.82
2014-06-05 647.35
2014-06-06 645.57
2014-06-09 93.70
2014-06-10 94.25
拆分调整:
blp.bdh(
'AAPL US Equity', 'Px_Last', '20140604', '20140610',
CshAdjNormal=True, CshAdjAbnormal=True, CapChg=True,
)
输出:
ticker AAPL US Equity
field Px_Last
date
2014-06-04 85.12
2014-06-05 85.45
2014-06-06 85.22
2014-06-09 86.58
2014-06-10 87.09