彭博社
Bloomberg APIv3 獲取參考數據覆蓋
我有一個要移動到 Python 中的 Excel 函式。BDP 函式為:
=BDP("IBM US Equity","BEST_EBITDA","BEST_FPERIOD_OVERRIDE","1FY")
from tia.bbg import LocalTerminal resp = LocalTerminal.get_reference_data("IBM US Equity", "BEST_EBITDA")
如何向此請求添加覆蓋?
我試過了:
resp = LocalTerminal.get_reference_data("IBM US Equity", "BEST_EBITDA",["BEST_FPERIOD_OVERRIDE","1FY"])
resp = LocalTerminal.get_reference_data("IBM US Equity", "BEST_EBITDA","BEST_FPERIOD_OVERRIDE","1FY")
resp = LocalTerminal.get_reference_data("IBM US Equity", "BEST_EBITDA",["BEST_FPERIOD_OVERRIDE=1FY"])
overrides=[BEST_FPERIOD_OVERRIDE=1FY]
,然後將 get_reference_data 中的覆蓋作為最後一個參數傳遞。
這對我有用。
resp = LocalTerminal.get_reference_data('spx index', 'indx_members') members = resp.as_map()['spx index']['indx_members'] members = members.iloc[:, 0].apply(lambda x: x.split()[0] + ' US EQUITY') mnemonics = [ '5YR_AVG_RETURN_ON_INVESTED_CPTL', 'BEST_EPS_NXT_YR' ] overrides = [ 'BEST_FPERIOD_OVERRIDE = 1FY' ] resp = LocalTerminal.get_reference_data(members, mnemonics, overrides) resp.as_frame().head()