Historical data for Bloomberg with metadata

9 vues (au cours des 30 derniers jours)
Maite
Maite le 20 Mar 2025
Commenté : Maite le 26 Mar 2025
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

Réponses (1)

Shaunak
Shaunak le 24 Mar 2025
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 commentaire
Maite
Maite le 26 Mar 2025
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Bloomberg B-PIPE dans Help Center et File Exchange

Produits


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by