MantaAPI
Getting Started (MantaAPI)
21 min
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 https //wa me/41795503141 https //mantarisk com/v2 account found on your account page (login or access > your account) 1 credentials & servers 1 1 api account to use our api, you must first create a mantaapi account you can create a https //mantarisk com/signup which is free of charge, or you can https //mantarisk com/v2 pricing 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 1 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 please make note of the key! 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 1 3 test environment our api documentation is hosted on swagger and is available here https //app swaggerhub com/apis docs/mantarisk/rest/0 1 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 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 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 access to this environment is provided on demand 2 instruments identification we propose two methods for instrument identification a coverage endpoint where the user provides a file (csv or json) of isin and currency pairs and the endpoint returns a list of single chosen instruments here the user does not have to choose the instrument, our platform does it automatically this is the preferred method for instrument identification we are also able to extend this method based on client demand to use other identifiers e g ticker and mic pairs or figi please contact us directly for such requests a search endpoint where free text, symbol or isin can be used in conjunction with mic and currency to identify a list of instruments matching does parameters whilst this list is ordered in terms of best match, the user still has to pick the matching instrument irrespective of the method, the following applies the search results are dependent on the data packages the user subscribes to e g if you are not subscribed to the fixed income data package, no fixed income instruments will be displayed the user must make not of both the instrument code and apiid to use the chosen instrument in the rest of our application we suggest this is saved on the user's side so as to avoid calling any of these two endpoints again 2 1 instrument coverage (preferred method) the put https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/price%20history%20management/put history coverage endpoint allows a user to match a list of isin / currency pairs to a list of unique instrument code / apiid pairs the method returns the best matching instrument for each isin / currency pair or an explanation ( coverage status ) as to why the instrument has not been matched 2 2 instrument search the get https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/price%20history%20management/put history coverage endpoint allows a user to search our database for specific instruments this endpoint returns a list of instruments ordered from best matching to least 3 portfolio creation & analytics 3 1 portfolio creation to add a portfolio composition, you must make a put call to the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/portfolio%20data%20management/put portfolio the client reference 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 docid\ oscyj5b9caqznpdxhgyra 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 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%" 3 2 portfolio analytics your are now ready to obtain your first set of analytics to do this you must use the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/analytics/get portfolio analytics refering the client reference from the previous step 4 portfolio optimisation / rebalancing 4 1 creating a strategy through the ui the portfolio optimisation strategy is controlled from our ui if you are logged in, you can https //mantarisk com/strategy builder , 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 strategy id and you will need it for later in the example below 183 4 2 creating a strategy through the api the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/strategy offer a programmatic way of creating and managing optimisation and risk management strategies the put / strategy endpoint uses references for constraints (e g rule id 21 corresponds to tracking error minimisation) and rules which can be found under the /reference endpoints 4 3 optimising a portfolio your are now ready to optimise your portfolio to do this you must use the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/analytics/get portfolio rebalance refering the client reference and strategy id from the previous steps 4 4 backtesting the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/analytics/get portfolio backtest endpoints allows the backtesting of a strategy against a specific portfolio the backtesting is conducted asynchronously as it can take multiple minutes to complete the get method can be called to check on the state of the calculations using the status field 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 an instrument a time series (history) to make a call to the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/price%20history%20management/put history 5 2 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 important note to perform portfolio attribution analysis, instruments must have all classification fields populated these are likely to become mandatory in the future 5 3 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 4 loading & using the data to load the data, a call to the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/price%20history%20management/put history 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 https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/price%20history%20management/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 a portfolio to analyse a portfolio against another (benchmark) portfolio load the relevant portfolios using the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/portfolio%20data%20management/put portfolio endpoint as usual the attribution analysis can then be run with a call to the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/performance%20attribution/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 6 2 attribution analysis against a benchmark to analyse a portfolio against a specific benchmark (fund or etf) use the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/performance%20attribution/get index to consult the list of benchmark indexes / etfs available if what you require is not in the list then https //docs mantarisk com/getting started api we have access to all major etfs as well as a wide range of funds so if there is anything missing, we should be able to add it use the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/performance%20attribution/get index attribution endpoint to run the analysis 6 3 composite benchmarks mantarisk also supports composite benchmarks allowing you to run a performance attribution analysis against a benchmark made of 60% spy and 40% agg for instance step 1 create a synthetic instrument the first step is to create a composite benchmark is to create a synthetic instrument which will be used to reference it throughout the system to do so, a call to the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/price%20history%20management/put history is required with a payload such as this { "instrument" { "instrument code" "myuniquecode", "asset type" "fund", "currency" "usd", "name" "my composite benchmark", }, "history" \[ ] } step 2 find your user feed api id call the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/user%20management/get history api and store the apiid associated with the api name "user feed" this is the unique api id associated with your account which allows you to enter your own time series step 3 create the composite benchmark to compose the benchmark, a call to the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/performance%20attribution/put index must be made in this case instrument code will be myuniquecode apiid will be the api id you stored in step 2 the payload here will look like this \[ { "apiid" 8, "instrument code" "csspx xswx", "ratio" 0 6, "decompose" true }, { "apiid" 8, "instrument code" "agg arcx", "ratio" 0 4, "decompose" false } ] the decompose flag indicates whether the instrument should be used as is or decomposed into its individual holdings when we are carrying the analysis step 4 run the performance attribution analysis finally, the https //app swaggerhub com/apis docs/mantarisk/rest/0 1#/performance%20attribution/get index attribution must be called to carry the analysis, with the following parameters client reference the reference of your portfolio (see the https //docs mantarisk com/getting started mantaapi#r fqf for more details) instrument code as per step 1 apiid as per step 2 horizon period over which the analysis will be carried all analytics will be expressed in relation to this period model see docid\ wezpcnpqje1qz3gogupug for more details