MantaRisk API

Getting Started (API)

17min

This section provides you will all you need to get started using the API. Should you have any issues however, please to not hesitate to contact us with the following means:

1 - API Account

To use our API, you must first create a MantaAPI account. You can create a Trial account here which is free of charge, or you can choose from one of our plans here.

For security reasons, the Trial plan will require a credit card to be entered, however no money will be taken from your account. The subscription process is instantaneaous.

2 - API Key

The next step is to generate a key which you will use to programmatically authenticate when using the API.

Once logged into MantaRisk, go to Access -> Your Account (see screenshot below). Here press the Generate button. The key will be generated and associated to your account.

Document image


Please make note of the key! For security reasons, it will disappear as soon as you exit the page and cannot be retrieved. If you happen to have lost your API key, then a new one needs to be generated by pressing the Generate button.

An account can only ever have one API key. Generating a new key will discard your old one and any system using the old key will no longer be able to access our API.

3 - Test Environment

Our API documentation is hosted on swagger and is available here:

Here you can choose to test against one of four environments:

  • SwaggerHub Mock which serves pre-canned responses to your requests. This is free and constitutes a good way to develop your application against our API. Any random API key can be used for this service as it is not validated.
  • MantaRisk Production. This is the real risk engine which performs on-demand analytics. To use this you need the API key generated in the previous step. Calls to this service are charged as per usual.
  • MantaRisk Staging. This is our stable test environment. It matches the production environment in terms of functionality and is used to run specific tests our clients require. Access to this environment is provided on demand.
  • MantaRisk Development. This is where the latest features of our engine are available prior to going live. Our clients can access this environment to start their development ahead of time. Access to this environment is provided on demand.
Document image


4 - First Workflow

4.1 - Portfolio Creation

To add a portfolio composition, you must make a PUT call to the /portfolio endpoint.

The clientReference field refers to the unique name / identifier you would like to give this portfolio. It will allow you to use and retrieve this portfolio in other API calls.

If you have just started, you will be setup with our built-in data source. You can learn more about Data Sources and their coverage here. Please reach out to us if you require coverage for other asset types such as fixed income.

Make sure your portfolio contains at least 2 instruments. Here is an example portfolio to get you started.

Important note: asynchronous caching and calculations are triggered when a portfolio is loaded. It is good practice to wait until these calculation have completed before making use of the portfolio in other API calls. The status of the portfolio can be obtained by making a call to the GET /portfolio endpoint passing in the relevant client_reference. The status us available in the field "data_load": "100%".

4.2 - Portfolio Analytics

Your are now ready to obtain your first set of analytics. To do this you must use the GET /portfolio/analytics endpoint refering the clientReference from the previous step.

4.3 - Portfolio Optimisation

The portfolio optimisation strategy is controlled from our UI. If you are logged in, you can access the strategy builder here, else click on Login -> MantaRisk API.

We suggest you use our default strategy to start with. Make note of the number preceeding the name of the strategy. This is the strategyid and you will need it for later. In the example below 183.

Document image


Your are now ready to optimise your portfolio. To do this you must use the /portfolio/rebalance endpoint refering the clientReference and strategyid from the previous steps.

5 - Loading Your Own Pricing Data

Whilst MantaRisk provides a default pricing data source, clients may find it desirable to load their own pricing data into the system. Use cases include:

  • Ensuring consistency of analytics across the organisation as pricing data sources may have discrepancies; and
  • Inputing custom instruments or price curves for the purpose of analytics.

As a client, you retain ownership of any proprietary data uploaded to the platform and can delete it at any point in time. MantaRisk ensures strict confidentiality and does not use nor share your data with any third parties unless required by law.

5.1 - Introduction

To add add pricing data you will need:

5.1 - Instrument Object

The instrument object contains the following fields (* denotes a mandatory field):

Identification fields

  • instrument_code*: a unique identifier which will allow you to reference this instrument in other API calls.
  • symbol*
  • name*
  • currency*: in ISO 4217 standard

Costs calculation fields

  • fixed_commission
  • variable_commission
  • spread_points

Classification fields

  • sector: as per GICS: Energy, Materials, Industrials, Consumer Discretionary, Consumer Staples, Health Care, Financials, Information Technology, Communication Services, Utilities, Real Estate.
  • industry: refer to the 74 GICS industries
  • primary_country
  • asset_type*: currently supports American Depositary Receipt, Bond, Bond Fund, Closed-end Fund, Common Stock, Depositary Receipt, Digital Currency, ETF, Exchange-Traded Note, Global Depositary Receipt, Index, Limited Partnership, Mutual Fund, Physical Currency, Preferred Stock, REIT, Right, Structured Product, Trust, Unit, and Warrant

Important note: to perform Portfolio Attribution Analysis, instruments must have all Classification fields populated. These are likely to become mandatory in the future.

5.2 - History Object

  • datetime*: start of the period (candle) in RFC 3339 section 5.6 format
  • open*: open price
  • high*: highest price in that period
  • low*: lowest price in that period
  • close*: close price
  • volume*: can be left to 0 if unavailable

5.3 - Loading & Using the Data

To load the data, a call to the PUT /History endpoint must be made. The history will be loaded into MantaRisk for future use.

To use your data in other API calls, you will also need an apiid. This can be obtained by making a call to GET /history/api and noting the apiid corresponding to "api_name": "User Feed"

6 - Performance Attribution Analysis

MantaRisk's risk and portfolio attribution methodology employs an enhanced Brinson model to decompose risk and performance across the following dimensions: sectors, asset classes, and domiciles. This detailed analysis provides insights into the following key components:

  • Allocation Effect: Measures the performance impact resulting from overweighting or underweighting specific sectors, asset classes, or domiciles relative to the benchmark.
  • Selection Effect: Quantifies the value added or subtracted by selecting specific securities within each sector, asset class, or domicile compared to the benchmark.
  • Interaction Effect: Captures the combined, and often non-additive, performance impact of allocation and selection decisions.
  • Marginal Contribution to Risk (Volatility): Determines the individual marginal contribution of each sector, asset class, or domicile to the overall portfolio volatility and compares it the marginal contribution to risk to the overall benchmark volatility"
  • Average Returns: Provides the average returns of the each component over the last day and last month periods.

6.1 - Attribution Analysis Against an Index / ETF

To analyse a portfolio against a specific Index or ETF:

  • Use the GET Index endpoint to consult the list of benchmark Indexes / ETFs available. If what you require is not in the list then please message us. We have access to all major indexes as well as circa 9000 ETFs so if there is anything missing, we should be able to add it.
  • Use the GET /index/attribution endpoint to run the analysis.

6.2 - Attribution Analysis Against a Portfolio

To analyse a portfolio against another (benchmark) portfolio:

  • Load the relevant portfolios using the PUT /portfolio endpoint as usual.
  • The attribution analysis can then be run with a call to the GET /portfolio/attribution endpoint using the client_reference of the portfolio you want to analyse and the client_reference of the portfolio you want to use as benchmark.