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 CenterFile Exchange에서 Bloomberg B-PIPE에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by