Main Content

createUniverse

Create Bloomberg Hypermedia universe for data requests

Since R2023b

Description

example

[universeID,response] = createUniverse(c,userCatalog,payload) creates a Bloomberg® Hypermedia universe for data requests, where c is the Bloomberg Hypermedia connection object, userCatalog is the user's catalog ID, and payload is a structure that defines the universe.

Examples

collapse all

Access historical and current market data by creating a universe of securities.

Create a Bloomberg Hypermedia connection object by using the API key provided by Bloomberg.

credentialsString = '{"client_id":"89beaeab724bbdf5e186b733c58af2","client_secret":"77050429aee81eb31793fb10fa4301c54911db545de8b2990252ffe2b56b11","name":"BloombergHAIDevelopment","scopes":["eap","beapData","reportingapi"],"expiration_date":1699198358934,"created_date":1651764758934}'
c = bloombergHypermedia(credentialsString)
c = 
 
  bloombergHypermedia with properties:

      TimeOut: 200.00

Specify your catalog ID and create the payload structure that holds the essential query information required by the Bloomberg Hypermedia data server. Replace "123" with your login credentials for the catalog you want to access.

userCatalog = "123";
payload.type = "Universe";
payload.identifier = "u" + bloombergHypermedia.generateResourcePostfix;
payload.title = "Test Universe";
payload.description = "Test historical data universe";
payload.contains.type = "Identifier";
payload.contains.identifierType = "TICKER";
payload.contains.identifierValue = "XYZ US Equity";
 

Use the createUniverse function to create the universe for the Hypermedia connection.

[universeID,response] = createUniverse(c,userCatalog,payload)
universeID = 
  
    "u2022052413354920f366"
  
response = 
  
    ResponseMessage with properties:
  
      StatusLine: 'HTTP/1.1 201 CREATED'
      StatusCode: Created
          Header: [1×14 matlab.net.http.HeaderField]
            Body: [1×1 matlab.net.http.MessageBody]
       Completed: 1

You can use the universe ID to create a data request using the createRequest function.

Input Arguments

collapse all

Bloomberg Hypermedia connection, specified as a Bloomberg Hypermedia object.

User catalog identifier, specified as a character vector or string scalar.

Universe information, specified as a structure array.

Output Arguments

collapse all

Universe identifier, returned as a string scalar.

HTTP request response, returned as a ResponseMessage object. For details, see matlab.net.http.ResponseMessage.

Version History

Introduced in R2023b