historyAnalyticsGet
Single instrument analytics
Returns the following analytics for the given price curve: - **Correlation based exposure** to MantaRisk's risk factors. Each factor exposure carries a beta coefficient, and factors are typed as one of: government, moneymarket, geographic, sector, currency, style, crypto, commodity or corporate (fixed income is represented via the government, corporate and moneymarket types). Only the most relevant factors are provided in any given analysis. - **Idiosyncratic risk**: the residual (error term) in the regression; random fluctuations not explained by factors. Returned per horizon (daily, weekly, monthly, quarterly, year-to-date and yearly). - **Alpha**: the intercept of the regression; the expected return not explained by factor exposures. - **R-squared**: the regression's goodness of fit, i.e. the proportion of variation explained by the factors. - **CVAR** over daily, weekly and monthly periods for the 2.5%, 5% and 10% quantiles - **VAR** over daily, weekly and monthly periods for the 2.5%, 5% and 10% quantiles - **Volatility** over daily, weekly and monthly periods - **Sample based expected returns**: defined as the average return over 5 years. Provided either equally or exponentially weighted and over daily, weekly, monthly, quarterly, year-to-date and yearly timeframes. These are price returns (dividend/split-adjusted for equities and funds, clean for fixed income) and exclude coupon income, which is forecast separately by the cashflow endpoint. - **Factor based expected returns**: model that calculates an asset's anticipated performance based on its exposure to MantaRisk's risk factors that are believed to drive investment returns. Provided either equally or exponentially weighted and over daily, weekly, monthly, quarterly, year-to-date and yearly timeframes. This endpoint can be used with any instruments including price curves you have entered through the PUT /history endpoint. This endpoint can be used to caculate analytics for a portfolio whose performance history has been entered through the PUT /history endpoint. A /portfolio/analytics endpoint is also offered to analyse a portfolio composition has opposed to the portfolio performance history. A time serie can be loaded in the platform using the PUT /history endpoint. Its instrument_code (provided by you in the previous endpoint) and your user apiid (see GET /api) can then be used here.
/history/analytics
Usage and SDK Samples
curl -X GET \
-H "token: [[apiKey]]" \
-H "Accept: application/json" \
"https://api.mantarisk.com/v1/history/analytics?instrument_code=AAPL_XNGS&apiid=8"
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.AnalyticsApi;
import java.io.File;
import java.util.*;
public class AnalyticsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: ApiKeyAuth
ApiKeyAuth ApiKeyAuth = (ApiKeyAuth) defaultClient.getAuthentication("ApiKeyAuth");
ApiKeyAuth.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.setApiKeyPrefix("Token");
// Create an instance of the API class
AnalyticsApi apiInstance = new AnalyticsApi();
String instrumentCode = AAPL_XNGS; // String | Can be found using the GET /history or GET/history/instrument endpoints
Integer apiid = 8; // Integer | Can be found using the GET /history or GET/history/instrument endpoints
try {
risk_exposure_report result = apiInstance.historyAnalyticsGet(instrumentCode, apiid);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AnalyticsApi#historyAnalyticsGet");
e.printStackTrace();
}
}
}
import 'package:openapi/api.dart';
final api_instance = DefaultApi();
final String instrumentCode = new String(); // String | Can be found using the GET /history or GET/history/instrument endpoints
final Integer apiid = new Integer(); // Integer | Can be found using the GET /history or GET/history/instrument endpoints
try {
final result = await api_instance.historyAnalyticsGet(instrumentCode, apiid);
print(result);
} catch (e) {
print('Exception when calling DefaultApi->historyAnalyticsGet: $e\n');
}
import org.openapitools.client.api.AnalyticsApi;
public class AnalyticsApiExample {
public static void main(String[] args) {
AnalyticsApi apiInstance = new AnalyticsApi();
String instrumentCode = AAPL_XNGS; // String | Can be found using the GET /history or GET/history/instrument endpoints
Integer apiid = 8; // Integer | Can be found using the GET /history or GET/history/instrument endpoints
try {
risk_exposure_report result = apiInstance.historyAnalyticsGet(instrumentCode, apiid);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AnalyticsApi#historyAnalyticsGet");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure API key authorization: (authentication scheme: ApiKeyAuth)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"token"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"token"];
// Create an instance of the API class
AnalyticsApi *apiInstance = [[AnalyticsApi alloc] init];
String *instrumentCode = AAPL_XNGS; // Can be found using the GET /history or GET/history/instrument endpoints (default to null)
Integer *apiid = 8; // Can be found using the GET /history or GET/history/instrument endpoints (default to null)
// Single instrument analytics
[apiInstance historyAnalyticsGetWith:instrumentCode
apiid:apiid
completionHandler: ^(risk_exposure_report output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var MantaRiskRestApi = require('manta_risk_rest_api');
var defaultClient = MantaRiskRestApi.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = "YOUR API KEY";
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix['token'] = "Token";
// Create an instance of the API class
var api = new MantaRiskRestApi.AnalyticsApi()
var instrumentCode = AAPL_XNGS; // {String} Can be found using the GET /history or GET/history/instrument endpoints
var apiid = 8; // {Integer} Can be found using the GET /history or GET/history/instrument endpoints
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.historyAnalyticsGet(instrumentCode, apiid, callback);
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Example
{
public class historyAnalyticsGetExample
{
public void main()
{
// Configure API key authorization: ApiKeyAuth
Configuration.Default.ApiKey.Add("token", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("token", "Bearer");
// Create an instance of the API class
var apiInstance = new AnalyticsApi();
var instrumentCode = AAPL_XNGS; // String | Can be found using the GET /history or GET/history/instrument endpoints (default to null)
var apiid = 8; // Integer | Can be found using the GET /history or GET/history/instrument endpoints (default to null)
try {
// Single instrument analytics
risk_exposure_report result = apiInstance.historyAnalyticsGet(instrumentCode, apiid);
Debug.WriteLine(result);
} catch (Exception e) {
Debug.Print("Exception when calling AnalyticsApi.historyAnalyticsGet: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: ApiKeyAuth
OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKey('token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// OpenAPITools\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer');
// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\AnalyticsApi();
$instrumentCode = AAPL_XNGS; // String | Can be found using the GET /history or GET/history/instrument endpoints
$apiid = 8; // Integer | Can be found using the GET /history or GET/history/instrument endpoints
try {
$result = $api_instance->historyAnalyticsGet($instrumentCode, $apiid);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnalyticsApi->historyAnalyticsGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::AnalyticsApi;
# Configure API key authorization: ApiKeyAuth
$WWW::OPenAPIClient::Configuration::api_key->{'token'} = 'YOUR_API_KEY';
# uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$WWW::OPenAPIClient::Configuration::api_key_prefix->{'token'} = "Bearer";
# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::AnalyticsApi->new();
my $instrumentCode = AAPL_XNGS; # String | Can be found using the GET /history or GET/history/instrument endpoints
my $apiid = 8; # Integer | Can be found using the GET /history or GET/history/instrument endpoints
eval {
my $result = $api_instance->historyAnalyticsGet(instrumentCode => $instrumentCode, apiid => $apiid);
print Dumper($result);
};
if ($@) {
warn "Exception when calling AnalyticsApi->historyAnalyticsGet: $@\n";
}
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: ApiKeyAuth
openapi_client.configuration.api_key['token'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# openapi_client.configuration.api_key_prefix['token'] = 'Bearer'
# Create an instance of the API class
api_instance = openapi_client.AnalyticsApi()
instrumentCode = AAPL_XNGS # String | Can be found using the GET /history or GET/history/instrument endpoints (default to null)
apiid = 8 # Integer | Can be found using the GET /history or GET/history/instrument endpoints (default to null)
try:
# Single instrument analytics
api_response = api_instance.history_analytics_get(instrumentCode, apiid)
pprint(api_response)
except ApiException as e:
print("Exception when calling AnalyticsApi->historyAnalyticsGet: %s\n" % e)
extern crate AnalyticsApi;
pub fn main() {
let instrumentCode = AAPL_XNGS; // String
let apiid = 8; // Integer
let mut context = AnalyticsApi::Context::default();
let result = client.historyAnalyticsGet(instrumentCode, apiid, &context).wait();
println!("{:?}", result);
}
Scopes
Parameters
| Name | Description |
|---|---|
| instrument_code* |
String
Can be found using the GET /history or GET/history/instrument endpoints
Required
|
| apiid* |
Integer
Can be found using the GET /history or GET/history/instrument endpoints
Required
|