Views:

Horizon > SIX API

You can integrate SIX Group's SIX API with your LUSID domain to fetch real-time prices for your instruments as you perform valuations or rebalance portfolios. Rather than importing data and storing it in LUSID, the data is fetched from SIX and displayed as needed in LUSID to ensure you only see the latest available prices.

To get started connecting SIX API to your LUSID domain:

If your domain has been provisioned with Horizon: SIX API and you have access to a SIX API account, you can use the following steps as a guide to perform your own real-time valuations:

Step 1: Populate instruments with SIX instrument identifiers

In order for LUSID to fetch real-time prices for an instrument, the instrument must have at least one of the following LUSID instrument identifier types populated:

LUSID instrument identifier typeCan be mapped from SIX identifier type
SixIsin_BCISIN_BC
SixValoren_BCVALOR_BC
SixSedol_BCSEDOL_BC
SixCusip_BCCUSIP_BC
SixTicker_BCTICKER_BC

Note: If your LUSID domain does not have access to the above LUSID instrument identifier types, please contact support.

For example, you might populate an Apple instrument with the SixValoren_BC value 908440_13 to retrieve real-time prices from the Frankfurt Stock Exchange when you perform a valuation.

There are two ways you can populate your instruments with the above instrument identifiers:

Note your SIX API account must have the appropriate entitlements to access data for the exchange you specify a BorseCode (BC) for.

Step 2: Supply your LUSID domain with your SIX API credentials

To allow LUSID to access and fetch price data, you must supply your SIX API credentials to LUSID securely via the Configuration Store. You can follow these instruction to learn how to do this.

Step 3: Create a SIX-specific recipe

With your LUSID domain linked up to the SIX API, you can create a recipe that allows you to value portfolios using real-time market prices supplied by SIX. To ensure your recipe uses SIX data, you must specify at least one market data rule containing the following:

  • A key specifying Quote.<IdentifierType>.<IdentifierValue> where <IdentifierType> is one of the SIX-specific instrument identifier types from step 1.
  • A quoteType of Price.
  • A supplier value of SIX.
  • A sourceSystem value of SIX/Streaming.
  • A dataScope of NotUsed.

Note it is currently only possible to retrieve real-time prices for equities.

For example, to create a simple recipe that might be suitable to value a portfolios of equities containing instruments with the SixValoren_BC identifier populated, you could call the UpsertConfigurationRecipe API and pass in the following: 

curl -X POST "https://<your-domain>.lusid.com/api/api/recipes" 
  -H "Content-Type: application/json-patch+json" 
  -H "Authorization: Bearer <your-API-access-token>" 
  -d '{
 "configurationRecipe": {
   "scope": "Finbourne-Examples",
   "code": "SixEquitiesRealtimePricing",
   "market": {
     "marketRules": [
       {
         "key": "Quote.SixValoren_BC.*",
         "supplier": "SIX",
         "dataScope": "NotUsed",
         "quoteType": "Price",
         "field": "Last",
         "sourceSystem": "SIX/Streaming"           
       },
       {
         "key": "Fx.CurrencyPair.*",
         "supplier": "Lusid",
         "dataScope": "realtime-valuation",
         "quoteType": "Rate",
         "field": "mid"       
       }
     ],
     "options": {
        "defaultSupplier": "Lusid",
        "defaultInstrumentCodeType": "LusidInstrumentId",
        "defaultScope": "Finbourne-Examples",
        "attemptToInferMissingFx": true
      }
   },
   "pricing": {
      "options": { "allowPartiallySuccessfulEvaluation": true }
    },
   "description": "Simple recipe to value equities using SIX real-time prices along with some supporting FX rates"
 }
}'

Step 4: Perform a valuation using your recipe

Now you have a recipe, you can use it to value a portfolio containing instruments with the relevant identifier types populated.

For example, to perform a real-time valuation on a portfolio of US equity instruments with the SixValoren_BC identifier populated, you can sign in to the LUSID web app and navigate to Dashboard > Valuations, selecting your Portfolio and Recipe. You can adjust the refresh rate to ensure you always see the latest prices:

Note the following:

  • Prices update as changes are made available via the SIX API.
  • The valuation effectiveAt datetime doesn't have an impact on real-time valuations; LUSID always retrieves the latest available price from SIX.
  • LUSID only displays real-time prices when a specified exchange is open. You can specify additional marketRules in your recipe to implement fallback logic if a real-time price cannot be retrieved.

You can also use real-time prices to help you rebalance your portfolios using the latest market data. Read more on rebalancing in LUSID.

For more information, you can work through this Jupyter Notebook tutorial.