Datasets & Portfolios

Dataset Upload

Upload historical market price data and use it as the data source for your risk calculations.

Upload a Dataset

Use the Dataset Upload API to register historical market data with Scratio. A successful upload returns a unique dataset_id that can be referenced in subsequent risk calculation requests.

POST /api/v1/risk/datasets/upload

Uploading a dataset does not calculate risk by itself. The dataset becomes the historical data source that you reference later through the Calculate Risk API.

File Type

Scratio currently supports .csv files for dataset uploads.

Other file formats are not currently supported for dataset uploads.

Maximum File Size

Each plan has a maximum file size for dataset uploads.

PlanMaximum file size
Trial10 MB

Files that exceed the maximum size available for your plan are rejected. See the Pricing page for the latest plan limits.

System Dataset

Scratio provides a built-in sample dataset so you can test the API without preparing or uploading your own market data first.

DATASET ID
ds_sample_001_970079
TYPE

System-provided sample dataset

SIZE

252 historical price rows × 2 assets

ASSETS

AAPL and BTC-USD

The system dataset contains simulated historical prices and is intended for testing, development, examples, and API exploration. It does not represent live market data.

For example, the Quick Start flow uses AAPL and BTC-USD in a sample portfolio. The resulting calculation uses 251 historical observations after converting the 252 price rows into one-period returns.

Purpose

Use this dataset to verify your API integration, test request construction, understand response fields, and experiment with the risk calculation workflow before uploading your own data.

How Your Dataset Is Used

Your uploaded dataset is used as the historical market-data input for the Scratio API functionality you request.

1. Validation

Scratio validates the uploaded file structure and data values before accepting the dataset.

2. Dataset registration

The accepted dataset is registered and assigned a unique dataset_id.

3. Risk calculation

When you reference the dataset_id, Scratio uses the corresponding historical prices to calculate the requested portfolio risk metrics, such as VaR, CVaR, and the supported simulation methods.

4. No unrelated use

Your uploaded market data is not required for unrelated analytics or product features. It is used to provide the API functionality associated with your dataset and requests.

Data-use principle

Your dataset is provided by you for the purpose of running your requested risk calculations. Scratio should not use customer datasets for model training, unrelated customer requests, or disclosure to other customers.

Request

Send the file as multipart/form-data.

file: prices.csv

Requirements

Your dataset must meet the following requirements before it can be accepted.

  • The file must be provided and use the supported .csv format.
  • The file must contain data and must not be empty.
  • The dataset must contain a date column.
  • Date values must be valid and consistently represented.
  • Asset price values must be numeric and greater than zero.
  • Missing price values are not accepted.

See CSV Format for the required dataset structure and examples.

Response

A successful upload returns a unique dataset ID.

{
  "status": "success",
  "dataset_id": "ds_xxxxxx"
}

Save the dataset_id. You will need it when calling the Calculate API. If you upload the same dataset again, the API may return "status": "unchanged" to indicate that the dataset has not changed.

Common Errors

CodeDescription
NO_FILE_PROVIDEDNo dataset file was provided.
INVALID_FILE_TYPEOnly CSV files are supported.
DATASET_IS_EMPTYThe dataset is empty.
FILE_TOO_LARGEThe file exceeds the maximum size allowed for the plan.
INVALID_CSV_FORMATThe uploaded file has an invalid CSV format.
INVALID_DATASETThe dataset does not contain valid data.