https://www.bloomberg.com/professional/support/api-library/如果您查看BLPAPI Core Developer Guide
下的15.3 BDS(): BULK DATA (STATIC)
,该指南会向您显示一个非常简单的BDS()
转化。
我正在尝试获取细分数据。这是我试图转换的Excel公式:
BDS("MSFT","PG_REVENUE","PG_HIERARCHY_LEVEL=1","NUMBER_OF_PERIODS=-11","REVERSE_PERIOD_ORDER=N","PRODUCT_GEO_OVERRIDE=P","FUND_PER","FQ")
这是我的代码:
from tia.bbg import LocalTerminal
ticker=['MSFT US Equity']
overrides=["PG_HIERARCHY_LEVEL=1","PRODUCT_GEO_OVERRIDE=P",'FUND_PER','FQ']
resp = LocalTerminal.get_reference_data(ticker,"PG_REVENUE",overrides)
a=resp.as_map()
似乎无论我放入overrides
变量。我得到相同的输出。
defaultdict(<type 'dict'>, {'MSFT US Equity': {'PG_REVENUE': Metric Name Product Geographic Hierarchy Level \
0 More Personal Computing 1
1 Productivity and Business Processes 1
2 Intelligent Cloud 1
3 Corporate and other 1
4 Commercial 1
5 Commercial Other 2
6 Commercial Licensing 2
7 Devices and Consumers 1
8 D & C Other 2
9 D & C Hardware 2
10 D & C Licensing 2
Period 1 Value Period 2 Value Period 3 Value Period 4 Value \
0 4.046000e+04 4.316000e+04 3.840700e+04 -2.424536e-14
1 2.648700e+04 2.643000e+04 2.697200e+04 -2.424536e-14
2 2.504200e+04 2.371500e+04 2.173200e+04 -2.424536e-14
3 -6.669000e+03 2.750000e+02 -2.780000e+02 4.030000e+02
4 -2.424536e-14 -2.424536e-14 -2.424536e-14 4.534600e+04
5 -2.424536e-14 -2.424536e-14 -2.424536e-14 5.660000e+03
6 -2.424536e-14 -2.424536e-14 -2.424536e-14 3.968600e+04
7 -2.424536e-14 -2.424536e-14 -2.424536e-14 3.210000e+04
8 -2.424536e-14 -2.424536e-14 -2.424536e-14 6.618000e+03
9 -2.424536e-14 -2.424536e-14 -2.424536e-14 6.461000e+03
10 -2.424536e-14 -2.424536e-14 -2.424536e-14 1.902100e+04
Period 5 Value
0 -2.424536e-14
1 -2.424536e-14
2 -2.424536e-14
3 -4.850000e+02
4 4.177000e+04
5 4.644000e+03
6 3.712600e+04
7 3.243800e+04
8 6.203000e+03
9 6.740000e+03
10 1.949500e+04 }})
我不确定如何按季度获得输出。
答案 0 :(得分:0)
实际上,您不必使用引号来覆盖。
overrides=[PG_HIERARCHY_LEVEL=1]
请参阅tia GitHub页面中的示例jupyter notebook: http://nbviewer.jupyter.org/github/bpsmith/tia/blob/master/examples/v3api.ipynb