VAR Estimator

What is this endpoint for?

The Daily Value at Risk (VaR) estimator endpoints helps you calculate values for single and multi-asset portfolios. Computed by a proprietary and thoroughly backtested methodology that accounts for the idiosyncrasies of crypto market structure.

Endpoint

https://us.market-api.kaiko.io/v2/data/analytics.v2/value_at_risk

Parameters

ParameterRequiredDescription

bases

Yes

Total must match quantities below. The order of bases and their respective quantities must match in the request.

quote

Yes

The fiat currency.

quantities

Yes

Quantities list of base asset in the portfolio. Must match the number of bases. The order of quantities and their respective bases must match in the request.

risk_level

Yes

The Value at Risk confidence level. Min: 0.90 (included) Max: 1 (excluded)

start_time

Yes

First fixing of the calculation in ISO 8601 (inclusive).

end_time

Yes

Last fixing of the calculation in ISO 8601 (inclusive).

exchanges

Yes

sources

No

boolean. If true, returns all pair prices which were used to compute the Value at Risk. Default: false

data_version

Yes

The data version. (v1, v2 ... or latest)

Fields

ParameterDescription

var_time

The time at which the VaR is computed.

value_at_risk

Composed of two fields: value and risk_level (the Value at Risk estimator at the specified risk_level.)

additional_vars

List of additional VaRs for standard risk levels.

pair

The constituent pair. (showing only when sources is set to be true)

ref_price

The reference price per asset. (showing only when sources is set to be true)

date

The date of the reference price. (showing only when sources is set to be true)

Request example

curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
'https://us.market-api.kaiko.io/v2/data/analytics.v2/value_at_risk?bases=eth,btc,ltc&exchanges=krkn,bfnx,cbse&quantities=3,2,5&quote=usd&risk_level=0.95&start_time=2021-12-01T00:00:00.000Z&end_time=2022-01-31T00:00:00.000Z&sources=true'

Response example

{"query": {
        "bases": "eth,btc,ltc",
        "quote": "usd",
        "quantities": "3,2,5",
        "exchanges": "krkn,bfnx,cbse",
        "risk_level": "0.95",
        "sources": true,
        "data_version": "v2",
        "commodity": "analytics",
        "request_time": "2023-12-04T14:14:34.900Z"
    },
    "time": "2023-12-04T14:15:04.006Z",
    "timestamp": 1701699304006,
    "data": [
        {
            "var_time": 1638316800000,
            "value_at_risk": {
                "value": 7648.7047074783195,
                "risk_level": 0.95
            },
            "additional_vars": [
                {
                    "value": 5216.766810005925,
                    "risk_level": 0.9
                },
                {
                    "value": 7648.7047074783195,
                    "risk_level": 0.95
                },
                {
                    "value": 10695.15881312369,
                    "risk_level": 0.975
                },
                {
                    "value": 11521.662805074642,
                    "risk_level": 0.99
                }
            ]
        },
        {
            "var_time": 1638403200000,
            "value_at_risk": {
                "value": 7608.531141127444,
                "risk_level": 0.95
            },
            "additional_vars": [
                {
                    "value": 5172.594890449372,
                    "risk_level": 0.9
                },
                /*...*/ 
            ]
        },,
    /*...*/ 
    ]
 "sources": {
        "prices": [
            {
                "pair": "btc-usd",
                "prices": [
                    {
                        "ref_price": 19654.5436737572,
                        "date": {
                            "seconds": 1606780800
                        }
                    },
                    /*...*/ 
                ]
            },
            {
                "pair": "eth-usd",
                "prices": [
                    {
                        "ref_price": 614.7309583666058,
                        "date": {
                            "seconds": 1606780800
                        }
                    },
                    /*...*/ 
                ]
            },
            /*...*/ 
        ]
    }
  "quantities": [3, 2, 5],
  "start_date": {"seconds": 1638316800},
  "end_date": {"seconds": 1643587200},
  "risk_level": 0.95,
  "additional_risk_levels": [0.9, 0.95, 0.975, 0.99],
  "decay": 30,
  "bases": ["eth", "btc", "ltc"]}   

Last updated