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 '
{
"positions": [
{
"market_ticker": "<string>",
"quantity": 123,
"quantity_fp": "<string>",
"price": "<string>"
}
],
"date": "2023-12-25"
}
'import requests
url = "https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin"
payload = {
"positions": [
{
"market_ticker": "<string>",
"quantity": 123,
"quantity_fp": "<string>",
"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({
positions: [
{
market_ticker: '<string>',
quantity: 123,
quantity_fp: '<string>',
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([
'positions' => [
[
'market_ticker' => '<string>',
'quantity' => 123,
'quantity_fp' => '<string>',
'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 \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"quantity_fp\": \"<string>\",\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 \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"quantity_fp\": \"<string>\",\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 \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"quantity_fp\": \"<string>\",\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 '
{
"positions": [
{
"market_ticker": "<string>",
"quantity": 123,
"quantity_fp": "<string>",
"price": "<string>"
}
],
"date": "2023-12-25"
}
'import requests
url = "https://api.klear.kalshi.com/klear-api/v1/margin/estimate_maintenance_margin"
payload = {
"positions": [
{
"market_ticker": "<string>",
"quantity": 123,
"quantity_fp": "<string>",
"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({
positions: [
{
market_ticker: '<string>',
quantity: 123,
quantity_fp: '<string>',
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([
'positions' => [
[
'market_ticker' => '<string>',
'quantity' => 123,
'quantity_fp' => '<string>',
'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 \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"quantity_fp\": \"<string>\",\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 \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"quantity_fp\": \"<string>\",\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 \"positions\": [\n {\n \"market_ticker\": \"<string>\",\n \"quantity\": 123,\n \"quantity_fp\": \"<string>\",\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
Body
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.