Bloomberg.Query
The answer to a BQL query, Bloomberg's query language, as a table.
Group: Online services. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Bloomberg.Query(query as text, optional options as nullable record) as table
| Parameter | Type | Description |
|---|---|---|
query | text | The BQL query, as get(px_last) for(['SPX Index']). |
options | nullable record optional | Host and Port of the Terminal or server. |
Returns
table. ID (the security), the columns BQL adds (DATE, CURRENCY ...), and a column per field asked for.
Remarks
- Several fields in one query are put side by side, joined where the security and any shared columns (such as DATE) agree.
- It asks a Bloomberg Terminal running on this computer, signed in, through its Desktop API; the computer's Python, with Bloomberg's blpapi and pandas, sends the request. Host and Port in the options point to a Terminal elsewhere, or a B-PIPE server (localhost and 8194 unless you say).
BQL.Queryis the same function under its earlier name.
Compared with Power Query
Power BI's Bloomberg connector also takes Bloomberg's SQL, answered by Bloomberg's cloud. OpenBI reads through your Terminal, so it takes BQL; a query that starts with SELECT or WITH is refused with a message.
Examples
Last prices of an index's members
Bloomberg.Query("get(px_last) for(members(['OBX Index']))")
Result: not shown here: it needs a Bloomberg Terminal, running and signed in.
Two fields side by side
Bloomberg.Query("get(px_last, px_volume) for(['SPX Index', 'OBX Index'])")
Result: not shown here: it needs a Bloomberg Terminal, running and signed in.
Related functions
BQL.Query, Bloomberg.ReferenceData, Bloomberg.HistoricalData.