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/uploadUploading 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.
| Plan | Maximum file size |
|---|---|
| Trial | 10 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.
ds_sample_001_970079System-provided sample dataset
252 historical price rows × 2 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.
Scratio validates the uploaded file structure and data values before accepting the dataset.
The accepted dataset is registered and assigned a unique dataset_id.
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.
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.csvRequirements
Your dataset must meet the following requirements before it can be accepted.
- The file must be provided and use the supported
.csvformat. - 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
| Code | Description |
|---|---|
| NO_FILE_PROVIDED | No dataset file was provided. |
| INVALID_FILE_TYPE | Only CSV files are supported. |
| DATASET_IS_EMPTY | The dataset is empty. |
| FILE_TOO_LARGE | The file exceeds the maximum size allowed for the plan. |
| INVALID_CSV_FORMAT | The uploaded file has an invalid CSV format. |
| INVALID_DATASET | The dataset does not contain valid data. |