PDF Bloomberg API

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 permit 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, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 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 SOFTWARE 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

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download