API based on normalised, curated data, allowing you to perform custom calculations in the Bloomberg cloud. It can perform data processing in the query to partially replace the function of Excel.
consolidate fields to make custom fields.
reduce the number of tickers you need to use (for example, study sectors).
functions to aggregate or group fields (such as average or sum).
Why BQL
In this manner, it saves query data.
How to use BQL
BQL Builder ; BQL and BQL.Query.
BQL Format
# Comparison: Ability to extend query points, apply formula, override data items=BDP("AAPL US Equity", "PX_LAST")=BDP("AAPL US Equity", "VOLUME")=BQL("AAPL US Equity", "PX_LAST, PX_VOLUME")=BQL("AAPL US Equity", "PX_LAST*100/PX_VOLUME")=BQL("APPL US Equity", "PX_LAST(CURRENCY=EUR)*100/PX_VOLUME")
# A list of tickers (separated by commas)# The results of a screening# Entire universes, filtered down to a subset.Universe=BQL("members('SPX Index')", "LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d)))))")=BQL("filter(members('SPX Index'), LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d)))))>2)", "LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d)))))")
=BQL("IBM US Equity", "PX_LAST")# Date range of data ; exclude non-trading datas ; =BQL("IBM US Equity", " PX_LAST(dates=range(-30d,0d))")=BQL("IBM US Equity", "DROPNA(PX_LAST(dates=range(-30d,0d)))")# Apply Aggregate function=BQL("IBM US Equity", " AVG(DROPNA(PX_LAST(dates=range(-30d,0d))))")=BQL("IBM US Equity", " ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d))))")=BQL("IBM US Equity", "LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d)))))")
=BQL("IBM US Equity","EBIT(FA_PERIOD_REFERENCE=RANGE(2012,2016))"# This query will return 5 data points with (LTM) EBIT values for IBM for 2012, 2013, 2014, 2015 and 2016=BQL("IBM US Equity","AVG(EBIT(FA_PERIOD_REFERENCE=RANGE(2010,2016)))")#This query will return a single data point with the 5-year average EBIT value of IBM=BQL("IBM US Equity","IS_EPS(FA_PERIOD_OFFSET=0)")# This query will return the last 12-month (LTM) EPS actual value for IBM=BQL("IBM US Equity","IS_EPS(FA_PERIOD_OFFSET=1,FA_ACT_EST_DATA=E,EST_SOURCE=BST)")=BQL("IBM US Equity","IS_EPS(FA_PERIOD_OFFSET=1,FA_ACT_EST_DATA=E,EST_SOURCE=CGD)")# Next 12-months from the latest reported fiscal period# Estimates Data ; AE for both acutal and estimate# Bloomberg Standard Consensus ; Company Guidance=BQL("SIE GR Equity","EBIT(FA_PERIOD_REFERENCE=RANGE(2011,2020),FA_PERIOD_TYPE=A)")# standing at the point 2016, we can have data from the past and in tehr future
BQL.Query
let: Define some variables to use below (optional)
get: What do you want to know?
for: Who do you want to know about?
Use BQL to show BQL.query=BQL("filter(members('SPX Index'), LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d)))))>2)", "LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d)))))", "showQuery=True")A sample of BQL.queryget( LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d)))))for (filter(members('SPX Index'), LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d)))))>2 ) )We can write in a more organized mannerlet(#myvar=LAST(ZSCORE(DROPNA(PX_LAST(dates=range(-30d,0d))))) ;)get(#myvar)for(filter(members('SPX Index'), #myvar>2))Call the BQL.Query=BQL.Query("entire-query") or=BQL.Query(cell-ref)=BQL.Query(A3)
Data Type Example
single-point data
=BQL("IBM US Equity","EBIT")
time-series data
=BQL("IBM US Equity","EBIT(FA_PERIOD_REFERENCE=RANGE(2012,2016))"
Actuals, Estimates, Guidance
# AE for both acutal and estimate# actual: last 12-month (LTM) EPS actual value for IBM=BQL("IBM US Equity","IS_EPS(FA_PERIOD_OFFSET=0)")# estimates: # Next 12-months from the latest reported fiscal period ; Bloomberg Standard Consensus ;=BQL("IBM US Equity","IS_EPS(FA_PERIOD_OFFSET=1,FA_ACT_EST_DATA=E,EST_SOURCE=BST)")# estimates: # Next 12-months from the latest reported fiscal period ; Company Guidance=BQL("IBM US Equity","IS_EPS(FA_PERIOD_OFFSET=1,FA_ACT_EST_DATA=E,EST_SOURCE=CGD)")# a time series version=BQL("SIE GR Equity","EBIT(FA_PERIOD_REFERENCE=RANGE(2011,2020),FA_PERIOD_TYPE=A)")
Calendarization of financial reporting calendar
=BQL("COST US Equity,WMT US Equity,TGT US Equity,DLTR US Equity,FIVE US Equity,BIG US Equity,DOL CN Equity","IS_EPS(FA_PERIOD_REFERENCE=2016Q4,FA_PERIOD_YEAR_END=C1231)")# FA_PERIOD_YEAR_END parameter is set to a calendar year ending on December 31: 2016-12-31 -> calendar quarter 2016-10-01 tto 2016-12-31# the query above will return for each company the fiscal quarters (highlighted) that overlap the most with the calendar quarter 2016 Q4.=BQL("COST US Equity,WMT US Equity,TGT US Equity,DLTR US Equity,FIVE US Equity,BIG US Equity,DOL CN Equity","IS_EPS(FA_PERIOD_REFERENCE=2016Q4,FA_PERIOD_YEAR_END=F)")# return the actual fiscal quarter for each company
blended data
=BQL("VOD LN Equity","EBIT(FA_PERIOD_TYPE=BA, # Blended Annual period FA_PERIOD_YEAR_END=C1231, # ending on December 31, 2015 FA_PERIOD_REFERENCE=2015)" ) # time-weighted average
Blended Trailing
# current date 2017-03-31=BQL("VOD LN Equity","EBIT(AS_OF_DATE=2017-03-22, FA_PERIOD_TYPE=BT, FA_PERIOD_OFFSET=1 )" )
latest-12-month period (LTM): default for FA_PERIOD_TYPE parameter
For a detailed overview of the Bloomberg Query Language syntax run HELP BQLX <GO> on the Bloomberg Terminal.
For a detailed overview of the BQL Fundamentals parameters, parameter default values and available parameter inputs consult the BQL Fundamentals Technical Documentation in the Brochures section on HELP BQLX <GO>.
For templates in Excel powered by BQL, run XLTP BQL <GO>.