Historical data for Bloomberg with metadata

5 ビュー (過去 30 日間)
Maite
Maite 2025 年 3 月 20 日
コメント済み: Maite 2025 年 3 月 26 日
I would like to know if is it posible to download through matlab bloomberg api some metadata. I'll give you and example:
% Establece conexión con Bloomberg
c = blp;
c.DataReturnFormat = 'table';
myAsset = 'AAPL UW Equity';
% Set Bloomberg options
period = {'monthly','non_trading_weekdays','previous_value'};
currency = 'USD';
fromdate = datestr(Dates(1,1), "mm/dd/yyyy");
todate = datestr(Dates(end,1), "mm/dd/yyyy");
BloombergTicker = myAsset;
Data = history(c,BloombergTicker, 'RETURN_COM_EQY',fromdate,todate,period,currency)
using excel api, I can request some metada in the next way:
=BQL("aapl us equity", "return_com_eqy().period_end_date, return_com_eqy().revision_date")
would it be posible to do the same through the matlab API?
Thank you

回答 (1 件)

Shaunak
Shaunak 2025 年 3 月 24 日
Hi Maite,
You can use the “getdata function to retrieve similar results and then perform additional post-processing in MATLAB.
For example, to achieve a similar result to your Excel API command, you could use:
% Establish connection with Bloomberg
c = blp;
c.DataReturnFormat = 'table';
% Define asset and fields
myAsset = 'AAPL US Equity';
fields = {'RETURN_COM_EQY', 'PERIOD_END_DATE', 'REVISION_DATE'}; % Check if these fields are available
% Retrieve data
try
Data = getdata(c, myAsset, fields);
disp(Data);
catch ME
disp('Error retrieving data:');
disp(ME.message);
end
You may refer to the following link for further information about the getData function:
  1 件のコメント
Maite
Maite 2025 年 3 月 26 日
Hi,
I tryed this code:
% Matlab Technical Support Case
% Establece conexión con Bloomberg
c = blp;
c.DataReturnFormat = 'table';
% Set Bloomberg options
period = {'monthly','non_trading_weekdays','previous_value'};
currency = 'USD';
fromdate = '03/20/2020';
todate = '03/20/2025';
BloombergTicker = 'AAPL UW Equity';
% Download data from Bloomberg
Data1 = history(c,BloombergTicker,...
{'RETURN_COM_EQY', 'PERIOD_END_DATE', 'REVISION_DATE'},...
fromdate,todate,period,currency);
Data1.DATE = datetime(Data1.DATE, "ConvertFrom", "datenum");
save('Data1', 'Data1')
Data2 = getdata(c,BloombergTicker,...
{'RETURN_COM_EQY', 'PERIOD_END_DATE', 'REVISION_DATE'});
save('Data2', 'Data2')
It doesn’t work
I want historical data. getdata doesn't retrive historical data.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBloomberg B-PIPE についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by