Historical data for Bloomberg with metadata

4 visualizaciones (últimos 30 días)
Maite
Maite el 20 de Mzo. de 2025
Comentada: Maite el 26 de Mzo. de 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

Respuestas (1)

Shaunak
Shaunak el 24 de Mzo. de 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 comentario
Maite
Maite el 26 de Mzo. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Bloomberg B-PIPE en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by