curl --request POST \
--url https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_class": "Crypto",
"positions": [
{
"market_ticker": "<string>",
"quantity": 123,
"price": "<string>"
}
],
"date": "2023-12-25"
}
'import requests
url = "https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin"
payload = {
"asset_class": "Crypto",
"positions": [
{
"market_ticker": "<string>",
"quantity": 123,
"price": "<string>"
}
],
"date": "2023-12-25"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
asset_class: 'Crypto',
positions: [{market_ticker: '<string>', quantity: 123, price: '<string>'}],
date: '2023-12-25'
})
};
fetch('https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'asset_class' => 'Crypto',
'positions' => [
[
'market_ticker' => '<string>',
'quantity' => 123,
'price' => '<string>'
]
],
'date' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin"
payload := strings.NewReader("{\n \"asset_class\": \"Crypto\",\n \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\"\n }\n ],\n \"date\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"asset_class\": \"Crypto\",\n \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\"\n }\n ],\n \"date\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"asset_class\": \"Crypto\",\n \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\"\n }\n ],\n \"date\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"maintenance_margin_fp": "<string>",
"base_margin_fp": "<string>",
"hvar_fp": "<string>",
"apc_fp": "<string>",
"funding_addon_fp": "<string>",
"liquidation_addon_fp": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}Estimate Portfolio Maintenance Margin
Maintenance margin requirement in dollars for a hypothetical portfolio, margined under the rules that apply to the authenticated clearing member. Positions and prices are supplied by the caller and need not reflect positions held. Every market in positions must belong to asset_class. The response includes the component breakdown of the estimate; see the response schema for the semantics of each component.
curl --request POST \
--url https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_class": "Crypto",
"positions": [
{
"market_ticker": "<string>",
"quantity": 123,
"price": "<string>"
}
],
"date": "2023-12-25"
}
'import requests
url = "https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin"
payload = {
"asset_class": "Crypto",
"positions": [
{
"market_ticker": "<string>",
"quantity": 123,
"price": "<string>"
}
],
"date": "2023-12-25"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
asset_class: 'Crypto',
positions: [{market_ticker: '<string>', quantity: 123, price: '<string>'}],
date: '2023-12-25'
})
};
fetch('https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'asset_class' => 'Crypto',
'positions' => [
[
'market_ticker' => '<string>',
'quantity' => 123,
'price' => '<string>'
]
],
'date' => '2023-12-25'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin"
payload := strings.NewReader("{\n \"asset_class\": \"Crypto\",\n \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\"\n }\n ],\n \"date\": \"2023-12-25\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"asset_class\": \"Crypto\",\n \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\"\n }\n ],\n \"date\": \"2023-12-25\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"asset_class\": \"Crypto\",\n \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"price\": \"<string>\"\n }\n ],\n \"date\": \"2023-12-25\"\n}"
response = http.request(request)
puts response.read_body{
"maintenance_margin_fp": "<string>",
"base_margin_fp": "<string>",
"hvar_fp": "<string>",
"apc_fp": "<string>",
"funding_addon_fp": "<string>",
"liquidation_addon_fp": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}{
"code": "<string>",
"message": "<string>",
"details": "<string>",
"service": "<string>"
}Authorizations
Pass Authorization: Bearer <admin_user_id>:<access_token> on each request.
Body
Asset class of the margin markets covered by this entry.
Crypto Hypothetical portfolio to margin. Market tickers must be unique and must name markets that exist in the requested asset class.
1 - 500 elementsShow child attributes
Show child attributes
Margin the portfolio against the matrices calibrated on this Eastern-time day (YYYY-MM-DD). Omit to use the current matrices. Returns 404 if no matrices were calibrated that day, or 400 if a requested market is absent from them.
Clearing arrangement whose margin rules to apply. Omit to use the arrangement on record for the authenticated clearing member.
FCM, SelfClearing Response
Successful response
Maintenance margin requirement for the submitted portfolio, in USD (e.g. "1234.5600"). Equals base_margin_fp + funding_addon_fp + liquidation_addon_fp, subject to per-market minimums on gross-margined markets and to each component being rounded individually, so the components need not sum exactly to this total.
Base scenario margin charged, in USD: the larger of the historical-VaR and APC candidates, taken per market for gross-margined markets and across the whole portfolio for portfolio-margined ones, then summed. Equals max(hvar_fp, apc_fp) only when the entire portfolio is portfolio-margined; with gross-margined markets it can exceed both.
Portfolio total of the historical-VaR candidate for the base scenario margin, in USD.
Portfolio total of the APC candidate for the base scenario margin, in USD, computed over the pooled APC and augmented stress scenario set.
Funding margin add-on, in USD.
Liquidation margin add-on, in USD.