Endpoints
Available endpoints for uploading datasets and calculating portfolio risk with the Scratio API.
Overview
The Scratio API provides endpoints for dataset upload and portfolio risk calculation.
API requests require a valid API key sent through the X-API-Key header.
X-API-Key: qr_live_xxxxxxxxxxUpload Dataset
POST /api/v1/risk/datasets/uploadUpload historical market price data and receive a unique dataset_id that can be used in subsequent risk calculation requests.
Request
Send the dataset as multipart/form-data.
X-API-Key: qr_live_xxxxxxxxxx
Content-Type: multipart/form-datafile: prices.csvSee Dataset Upload for supported file types, size limits, formatting requirements, and validation behavior.
Response
{
"status": "success",
"dataset_id": "ds_xxxxxx"
}Calculate Risk
POST /api/v1/risk/calculateCalculate portfolio risk metrics using the selected risk calculation method.
Request
Send a JSON request containing the dataset, portfolio, and calculation parameters.
X-API-Key: qr_live_xxxxxxxxxx
Content-Type: application/json{
"dataset_id": "ds_xxxxxx",
"portfolio_value": 100000,
"currency": "USD",
"portfolio": [
{
"symbol": "AAPL",
"weight": 0.6
},
{
"symbol": "MSFT",
"weight": 0.4
}
],
"degrees_of_freedom": 5,
"portfolio_mode": "buy_and_hold",
"confidence_level": 0.95,
"time_horizon": 1,
"simulations": 1000,
"method": "monte_carlo_normal",
"method_options": {}
}Portfolio weights must sum to 1. See the risk calculation reference for parameter definitions, supported methods, and validation rules.
Response
{
"status": "success",
"meta": {...}
}The response contains the calculated risk metrics and associated calculation data for the selected method.