Skip to main content
API: Creating Baskets

Securely add a basket of securities, allowing any model to reference a basket via its unique ticker as if it were any other security.

Edgar Nuñez avatar
Written by Edgar Nuñez
Updated over 5 years ago

The Omega Point developer's platform facilitates mapping underlying constituents to a custom basket's ticker through the Swaps API. 

[[Please note, Omega Point incorrectly labeled baskets as swaps, so you may see reference to the Swap API since the API nodes have not been updated / deprecated. This will be soon be fixed.]]

Once created, the basket and its constituents are recognized by any model universe — as long as the underlying constituents are included in a model's coverage.

Swaps API

Creating a basket is very similar to creating a portfolio. Start by setting up a custom ticker using the  mutation.createSwap node. The application is now ready to find this basket by this unique ticker:

mutation{
  createSwap(swap: {
    ticker: "MYSWAP"
    description: "Augmenting my portfolio with a custom basket"
    }
  ){
    ticker
    description
  }
}

Once a basket is created, this ticker can be populated with its constituents using mutation.uploadSwapDate

mutation{
  uploadSwapDate(ticker: "MYSWAP" data:{
    date: "2018-04-30"
    equities:[{
      id: {sedol:"1234567"}
      economicExposure: 1000000
    },{
      id: {sedol:"7654321"}
      economicExposure: 1000000
    }]
  }]
  }){
    ok
  }
}

This basket is now available throughout the API and the application.

For example, searching for the basket by its ticker can display its security profile like any other security:

If a basket does not change its constituents (or their weights), then the application will handle transferring constituent information to subsequent days. These basket will “rollover” and automatically adjusting the position size based on the daily returns of all equities in the swap. If and when a swap needs to be winded down, the updateSwap mutation can be used to provide a termination date.

mutation{
  updateSwap(ticker:"MYSWAP" swap: {
    terminationDate: "2019-01-30"
    }
  ){
    ticker
    description
    availableFrom
    terminationDate
  }
}

With basket operations available via the API, portfolios that contain basket will now more accurately capture a basket's contribution to the portfolio. The Swaps API is a way to augment the model with any custom ticker that corresponds to a basket of securities.

Viewing Baskets

Once a swap has been created and populated with the mutation functions, the query functions can be used to pull down swap information, including seeing the composition and constituents of the swap on the provided date range.

To get a full list of swaps that have been created, the swaps query node will return all swaps for your account

{
  swaps{
    ticker
    description
    availableFrom
    terminationDate
  }
}


Pulling down swap-specific data is a matter of using the swap  query node, using the swap's unique ticker, as seen below. This query returns the equities and their composition:

{
  swap(ticker:"SWAP_TCKR"){
    ticker
    description
    availableFrom
    terminationDate
    dates(from:"2019-01-02" to:"2019-01-02" modelId:"AXWW4-MH"){
      date
      equity
      equities{
        id{
          ticker
          sedol
        }
        economicExposure
      }
    }
  }
}

Using Swaps

Swaps can be used throughout the Omega Platform as a security. Whenever a swap is included in a portfolio or a positionSet, the application will recognize its underlying constituents and calculate its impact alongside all other securities.

When uploading swaps via the API or using swaps in a positionSet, it is important to include the unique swap ticker under the swap asset type.

For example, this simulation with a positionSet input correctly includes equities and swaps, listing the securities into their respective asset type:

{
  model(id: "AXWW4-MH") {
    simulation(
      from: "2019-01-02",
      to: "2019-01-02",
      positionSet:{
        dates: [{
          date: "2019-01-02",
          equities: [{
            id: {ticker: "AAPL", mic: "XNAS"},
            economicExposure: 1000000
          },{
            id: {ticker: "MSFT", mic: "XNAS"},
            economicExposure: 1000000
          }],
          swaps: [{
            id: "SWAP_TCKR",
            economicExposure: 1000000
          },{
            id: "ANOTHER_SWAP",
            economicExposure: 1000000
          }]
        }]
      }) {
      risk {
        date
        total
        attribution {
          summary {
            factors
            specific
          }
        }
      }
    }
  }
}

Conclusion

In this article, we reviewed how to create a swap identified by its unique ticker, populate the swap with data, as well as, how to view the swap.

This article also gave one example on how to use custom swaps via the Omega Point API. This demonstrates that anywhere a positionSet is used -- in creating portfolios, running simulations or optimization, among others -- a custom swap can be included in the swap  asset category.

Did this answer your question?