Main Content

bloombergHypermedia

Create Bloomberg Hypermedia connection

Since R2023b

Description

The bloombergHypermedia function creates an object that represents a Bloomberg® Hypermedia connection. After you create a bloombergHypermedia object, you can create universes, field lists, triggers, and data requests.

Accessing Bloomberg Hypermedia requires a data license. For details on obtaining a license, see Bloomberg Data License. Bloomberg supplies the user credentials for login.

From MATLAB®, you can retrieve Bloomberg data by following these steps:

  1. Create a Hypermedia connection using bloombergHypermedia.

  2. Create a universe of securities using the createUniverse function.

  3. Create a field list of data items using the createFieldList function.

  4. Create a trigger to schedule a data request using the createTrigger function.

  5. Create a data request using the createRequest function.

After following these steps, you can download the data set directly into MATLAB. For details, see Bloomberg HAPI Documentation.

Creation

Description

c = bloombergHypermedia(credentialString) creates a connection to the Bloomberg Hypermedia data server using login credentials from Bloomberg.

example

c = bloombergHypermedia(___,timeOut,url,mediaType,debugModeValue) sets the timeout value, the Bloomberg enterprise access point (EAP) URL, the REST API call mediaType, and the MATLAB HTTP library debug value for the connection to the Bloomberg Hypermedia data server.

example

Input Arguments

expand all

API key supplied by Bloomberg for access to the Hypermedia API, specified as a character vector or string scalar.

Example: '{"client_id":"89beaeab72154bbdf5e186b733c58af2","client_secret":"77050429aee81eb31793fb6b10fa4301c512345b545de8b2990252ffe2b56b11","name":"BloombergHAIDevelopment","scopes":["eap","beapData","reportingapi"],"expiration_date":1699198358934,"created_date":1651764758934}'

Bloomberg Hypermedia request timeout value, in seconds, specified as a positive number. This argument sets the TimeOut property.

Example: 300

Bloomberg enterprise access point URL, specified as a character vector or string scalar. This argument sets the URL property.

REST API call media type, specified as a character vector or string scalar. This argument sets the mediaType property.

MATLAB HTTP library debug mode, specified as 0 or 2. To return verbose output for HTTP requests, set this value to 2. This argument sets the debugModeValue property.

Properties

expand all

Public Properties

Timeout value, in seconds, used when making Bloomberg connections and data requests. This property is set by the timeOut argument.

Hidden Properties

Client ID used in the credentialString input argument.

Client Secret used in the credentialString input argument.

Client secret bytes.

MATLAB http library debug value.

REST API call media type. This property is set by the mediaType argument.

Bloomberg enterprise access point URL. This property is set by the url argument.

Object Functions

expand all

createUniverseCreate Bloomberg Hypermedia universe for data requests
createFieldListCreate Bloomberg Hypermedia field list for data requests
createRequestCreate Bloomberg Hypermedia data request
createTriggerCreate Bloomberg Hypermedia trigger for data requests
getUniversesRetrieve Bloomberg Hypermedia universe information
getFieldListsRetrieve Bloomberg Hypermedia field list information
getTriggersRetrieve Bloomberg Hypermedia trigger information
getFieldsRetrieve Bloomberg Hypermedia field information
getDataRetrieve Bloomberg Hypermedia data for a given request
getRequestsRetrieve Bloomberg Hypermedia request information

Examples

collapse all

Use the API key provided by Bloomberg to build the credentialString input argument.

First, load the credentialString into the MATLAB workspace

credentialsJson = '{"client_id":"89beaeab72154bbdf5e186b733c58af2",
"client_secret":"77050429aee81eb31793fb6b10fa4301c512345b545de8b2990252ffe2b56b11",
"name":"BloombergHAIDevelopment","scopes":["eap","beapData","reportingapi"],
"expiration_date":1699198358934,"created_date":1651764758934}'

and then create the Bloomberg connection object.

c = bloombergHypermedia(credentialsJson)
returns 

c = 
 
  bloombergHypermedia with properties:

      TimeOut: 200.00
      

After creating the connection object, you can use it to create a field list by using the createFieldList function.

Version History

Introduced in R2023b