Bloomberg API Version 3.x Developer’s Guide June 30, 2014 Version 2.54 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to per- mit persons to whom the Software is furnished to do so, subject to the following conditions: The copyright notice below and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, IN- CLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU- LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT- WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. BLOOMBERG is a registered trademark of Bloomberg Finance L.P. or its affiliates. All other trademarks and registered trademarks are the property of their respective owners. Table of Contents Preface: About this Document..................................................................................................9 Purpose...................................................................................................................................9 Audience.................................................................................................................................9 Document History ...................................................................................................................9 Customer Support Information..............................................................................................10 1 Introduction to the Bloomberg API.....................................................................................12 1.1 Overview of the Bloomberg API.....................................................................................12 1.1.1 Features................................................................................................................13 1.1.2 The Bloomberg Platform.......................................................................................15 1.1.3 B-PIPE..................................................................................................................16 1.1.4 The Desktop API and Server API..........................................................................17 1.2 APITypical Application Structure...................................................................................20 1.3 Overview of this Guide...................................................................................................21 2 Sample Programs in Two Paradigms..................................................................................22 2.1 Overview........................................................................................................................22 2.2 The Two Paradigms.......................................................................................................23 2.2.1 Request/Response................................................................................................23 2.2.2 Subscription..........................................................................................................24 2.3 Using the Request/Response Paradigm........................................................................24 2.4 Using the Subscription Paradigm...................................................................................28 3 Sessions and Services.........................................................................................................31 3.1 Sessions........................................................................................................................31 3.2 Services.........................................................................................................................31 3.3 Event Handling..............................................................................................................31 3.3.1 Synchronous Event Handling................................................................................33 3.3.2 Asynchronous Event Handling..............................................................................34 3.4 Multiple Sessions...........................................................................................................38 4 Requests and Responses....................................................................................................39 4.1 The Programming Example...........................................................................................39 4.2 Elements........................................................................................................................40 4.3 Request Details..............................................................................................................40 4.4 Response Details...........................................................................................................42 5 Subscriptions........................................................................................................................47 5.1 Starting a Subscription...................................................................................................47 Table of Contents 2 5.2 Receiving Data from a Subscription..............................................................................49 5.3 Modifying an Existing Subscription................................................................................50 5.4 Stopping a Subscription.................................................................................................51 5.5 Overlapping Subscriptions.............................................................................................51 5.6 Conflation and the Interval Option.................................................................................52 5.7 Delayed Data.................................................................................................................52 5.8 Subscription Life Cycle..................................................................................................52 6 Authorization and Permissioning Systems........................................................................54 6.1 Overview........................................................................................................................54 6.2 Underlying Concepts.....................................................................................................54 6.2.1 EIDs......................................................................................................................54 6.2.2 Requirement for the Terminal...............................................................................54 6.2.3 The //blp/apiauth service.......................................................................................55 6.2.4 The V3 Identity Object..........................................................................................55 6.2.5 V3 Permissioning Models.....................................................................................55 6.2.6 Authorization Lifetime...........................................................................................55 6.3 Server API Authorization...............................................................................................56 6.3.1 Authorization by IP Address..................................................................................56 6.4 B-PIPE Authorization.....................................................................................................62 6.4.1 Authentication.......................................................................................................63 6.4.2 Token Generation.................................................................................................65 6.4.3 Identity Object.......................................................................................................67 6.5 Authorization..................................................................................................................67 6.6 Permissioning................................................................................................................69 6.6.1 Entitlements..........................................................................................................69 6.6.2 User Mode............................................................................................................72 6.6.3 Content Based......................................................................................................72 6.7 Specific Application Types (B-PIPE only)......................................................................74 6.7.1 Single-User...........................................................................................................74 6.7.2 Multi-User..............................................................................................................74 6.7.3 Derived Data / Non-Display..................................................................................74 6.8 V2 Authorization and Permissioning Models.................................................................74 6.8.1 User Mode............................................................................................................74 6.8.2 All-or-None............................................................................................................75 6.8.3 Content-Based / Per-Product / Per-Security.........................................................75 6.8.4 Validating Logon Status........................................................................................76 Table of Contents 3 7 Core Services........................................................................................................................77 7.1 Common Concepts........................................................................................................77 7.1.1 Security/Securities................................................................................................77 7.1.2 Pricing Source.......................................................................................................78 7.1.3 Fields....................................................................................................................79 7.1.4 Overrides..............................................................................................................79 7.1.5 Relative Dates.......................................................................................................80 7.2 Reference Data Service.................................................................................................81 7.2.1 Reference Data Request and Response Overview..............................................82 7.2.2 Historical Data Request........................................................................................83 7.2.3 Intraday Tick Request...........................................................................................84 7.2.4 Intraday Bar Services............................................................................................85 7.2.5 Portfolio Data Request..........................................................................................86 7.2.6 BEQS Request......................................................................................................86 7.3 Market Data Service......................................................................................................87 7.4 Custom VWAP Service..................................................................................................88 7.5 Market Bar Subscription Service...................................................................................88 7.6 API Field Information Service........................................................................................90 7.6.1 Field Information Request.....................................................................................90 7.6.2 Field Search Request...........................................................................................91 7.6.3 Categorized Field Search Request.......................................................................91 7.7 Page Data Service.........................................................................................................93 7.8 Technical Analysis Service............................................................................................96 7.8.1 Historical End of Day study request......................................................................96 7.8.2 Intraday bar study request....................................................................................98 7.8.3 Real time study request......................................................................................100 7.9 API Authorization.........................................................................................................101 7.10 Instruments Service...................................................................................................101 7.10.1 Security Lookup Request..................................................................................101 7.10.2 Curve Lookup Request.....................................................................................102 7.10.3 Government Lookup Request...........................................................................102 7.10.4 Response Behaviors.........................................................................................103 7.10.5 Code Example..................................................................................................105 8 Publishing...........................................................................................................................106 8.1 Overview......................................................................................................................106 8.2 The Programming Examples.......................................................................................106 Table of Contents 4 8.3 Simple Broadcast.........................................................................................................106 8.3.1 Creating a Session..............................................................................................106 8.3.2 Authorization.......................................................................................................107 8.3.3 Creating a Topic..................................................................................................109 8.3.4 Publishing...........................................................................................................110 8.4 Interactive Publication..................................................................................................111 8.4.1 Registration.........................................................................................................112 8.4.2 Event Handling....................................................................................................113 8.4.3 Publication..........................................................................................................115 9 B-Pipe ................................................................................................................................117 9.1 Overview......................................................................................................................117 9.2 B-Pipe Services...........................................................................................................117 9.2.1 Market Depth Service.........................................................................................117 9.2.2 Market List Service.............................................................................................138 9.2.3 Source Reference Service..................................................................................154 A Schemas.............................................................................................................................162 A.1 Overview.....................................................................................................................162 A.2 Reference Data Service //blp/refdata..........................................................................162 A.2.1 Operations..........................................................................................................162 A.2.2 ReferenceDataRequest: Sequence....................................................................162 A.2.3 ReferenceDataResponse: Choice......................................................................164 A.2.4 HistoricalDataRequest: Sequence......................................................................165 A.2.5 HistoricalDataResponse: Choice........................................................................170 A.2.6 IntradayTickRequest: Sequence ................................................................171 A.2.7 IntradayTickResponse: Choice...........................................................................173 A.2.8 IntradayBarRequest: Sequence.........................................................................175 A.2.9 IntradayBarResponse: Choice............................................................................177 A.2.10 PortfolioDataRequest: Sequence.....................................................................178 A.2.11 PortfolioDataResponse: Choice.......................................................................179 A.2.12 BEQSRequest: Sequence................................................................................180 A.2.13 BEQSResponse: Choice..................................................................................181 A.2.14 Reference Data Service Response..................................................................182 A.3 Schema for API Field Service //blp//apiflds.................................................................185 A.3.1 Requests: Choice...............................................................................................185 A.3.2 Responses: Choice............................................................................................185 A.3.3 Field Information Request..................................................................................185 Table of Contents 5 A.3.4 Field Search Request.........................................................................................187 A.3.5 Categorized Field Search Request.....................................................................191 A.3.6 Field List Request...............................................................................................194 A.3.7 Field Service Response Elements......................................................................196 A.3.8 Field Service Response Values..........................................................................197 A.4 Market Bar Subscription..............................................................................................198 A.4.1 Market Bar Subscription Settings.......................................................................198 A.4.2 Market Bar Subscription: Data Events Response..............................................198 A.5 Schema for Market Data and Custom VWAP.............................................................201 A.5.1 MarketDataEvents: Choice.................................................................................201 A.5.2 Market Data Service Subscription Options.........................................................201 A.5.3 MarketDataEvents: Sequence............................................................................201 A.5.4 Market VWAP Service Subscription Options......................................................212 A.6 Schema for API Authorization.....................................................................................213 A.6.1 Authorization Request........................................................................................213 A.6.2 Authorization Request Response.......................................................................214 A.6.3 Logon Status Request........................................................................................215 A.6.4 Logon Status Request Response.......................................................................215 A.6.5 User Entitlements Request.................................................................................216 A.6.6 User Entitlements Request Response................................................................216 A.6.7 Security Entitlements Request...........................................................................217 A.6.8 Security Entitlements Request Response..........................................................217 A.6.9 Authorization Token Request.............................................................................218 A.6.10 Authorization Token Request Response..........................................................218 A.6.11 Field Service Response Elements....................................................................219 A.6.12 Field Service Request Values..........................................................................219 B Error Codes........................................................................................................................220 B.1 General........................................................................................................................220 B.2 //BLP/APIAUTH...........................................................................................................221 B.2.1 AUTHORIZATION_STATUS, REQUEST_STATUS, RESPONSE and PARTIAL_RESPONSE Events......................................................................221 B.2.2 REQUEST_STATUS, RESPONSE and PARTIAL_RESPONSE Events (B-Pipe ONLY)............................................................................................................223 B.2.3 TOKEN_STATUS Event (B-Pipe ONLY)............................................................224 B.3 //BLP/MKTDATA and //BLP/MKTVWAP.....................................................................224 B.3.1 (SUBSCRIPTION_DATA and SUBSCRIPTION_STATUS Events)...................224 Table of Contents 6 B.4 //BLP/REFDATA..........................................................................................................225 B.4.1 For All Requests.................................................................................................225 B.4.2 HistoricalDataRequest........................................................................................225 B.4.3 IntradayBarRequest and IntradayTickRequest ..................................................226 B.4.4 ReferenceDataRequest......................................................................................226 B.4.5 categorizedFieldSearchRequest........................................................................226 B.4.6 fieldInfoRequest..................................................................................................226 B.4.7 fieldSearchRequest............................................................................................226 C Java Examples...................................................................................................................227 C.1 Request Response Paradigm.....................................................................................228 C.1.1 Request Response Paradigm Output.................................................................230 C.2 Subscription Paradigm................................................................................................231 C.3 Asynchronous Event Handling....................................................................................235 C.3.1 Asynchronous Event Handling: Output .............................................................238 C.4 Request Response Multiple........................................................................................239 C.4.1 Request Response Multiple: Output...................................................................242 C.5 Subscription Multiple...................................................................................................243 C.5.1 Multiple Subscription: Output ................................................................246 C.6 Authorization by IP Address .........................................................................253 D .Net Examples.....................................................................................................................259 D.1 RequestResponseParadigm.......................................................................................260 D.1.1 Request Response Paradigm Output.................................................................262 D.2 Subscription Paradigm................................................................................................263 D.3 Asynchronous Event Handling....................................................................................269 D.3.1 Asynchronous Event Handling: Output .............................................................273 D.4 Request Response Multiple ....................................................................................274 D.4.1 Request Response Multiple: Output...................................................................277 D.5 Subscription Multiple ..............................................................................................278 D.5.1 Multiple Subscription: Output ...................................................................281 E C++ Examples.....................................................................................................................286 E.1 RequestResponseParadigm.......................................................................................287 E.2 Subscription Paradigm................................................................................................290 E.3 Asynchronous Event Handling....................................................................................295 E.4 Request Response Multiple........................................................................................299 E.5 Subscription Multiple...................................................................................................303 Table of Contents 7 F C Examples.........................................................................................................................312 F.1 RequestResponseParadigm........................................................................................313 F.2 Subscription Paradigm................................................................................................318 F.3 Asynchronous Event Handling....................................................................................327 F.4 Request Response Multiple.........................................................................................332 F.5 Subscription Multiple...................................................................................................340 Table of Contents 8 Preface: About this Document Purpose This document provides a guide to developing applications using the Bloomberg API. Audience This document is intended for developers who use the Bloomberg API. Document History Version Date Description of Changes 2.0 11/05/09 This is the first release of the Bloomberg API Developer’s Guide. 2.41 10/03/12 Corrected items in Table 9-4, “Chain Subservice Examples,” on page 142 and Table 9-4, “Chain Subservice Examples,” on page 142. 2.42 11/14/12 Updated “IntradayTickResponse: Choice” on page 173. 2.43 12/21/12 Updated “IntradayBarRequest: Sequence” on page 175. 2.44 01/04/13 Added footnote to Table 9-14, “Enumeration Values,” on page 156 and updated Table 9-4, “Chain Subservice Examples,” on page 142. 2.45 01/14/13 Updated “B-Pipe” on page 117. 2.46 01/29/13 Added “Instruments Service” on page 101. Updated MD_BOOK_TYPE table on page 125. 2.47 03/21/13 Updated MD_BOOK_TYPE table on page 125 and Notes on page 133. 2.48 06/05/13 Product name change from Managed B-PIPE to B-PIPE. 2.49 07/10/13 Fixed a typo on page 77 (comdy to comdty). 2.50 01/21/14 Updated fields in Table A.5.3, “MarketDataEvents: Sequence,” on page 201. 2.51 04/16/14 Added “Error Codes” on page 220. 2.5 04/17/14 Updated “Intraday Tick Request” on page 84. 2.53 05/12/14 Updated “REQUEST_STATUS, RESPONSE and PARTIAL_RESPONSE Events (B-Pipe ONLY)” on page 223. 2.54 06/30/14 Updated “Market Bar Subscription Service” on page 88, “Market Bar Subscription” on page 198 and Table 9-4 on page 142. Preface: About this Document 9 Customer Support Information Urgent and Operational Support For any urgent operational issues contact the Production Support team. Please have the following information available: Firm Name For B-PIPE the BPID/BMDS instance(s) impacted For Server API the ASID number Issue description Time issue occurred Error messages Supporting information, such as, example securities and data SDK logs (if possible) Contact information Client name/E-mail address/Phone numbers You can reach the Production Support team at: Americas: +1-212-617-4390 Europe: +44-20-3216-4380 Japan: +81-3 3201-2780 Hong Kong: +852-2293-1238 Singapore: +65 6212-1180 Australia: +612-9777-7210 If you are a Server API user, please have your ASID number and ASID Serial Number ready when requesting support. You can find this information in the bin/clientid.txt file (located in the root directory that you specified as part of the Server API installation procedure). Server API Related Questions Press the HELP key twice on a Bloomberg keyboard. Press F1 twice on a standard keyboard. If you are a Server API user, the first line of your request should state that you are a Server API user and include your ASID number to ensure that your request is routed quickly and correctly. Preface: About this Document 10
Description: