Calculate portfolio margin, pnl and greeks
curl --request POST \
--url https://demo-futures.kraken.com/derivatives/api/v3/portfolio-margining/simulate \
--header 'APIKey: <api-key>' \
--header 'Authent: <api-key>'import requests
url = "https://demo-futures.kraken.com/derivatives/api/v3/portfolio-margining/simulate"
headers = {
"APIKey": "<api-key>",
"Authent": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {APIKey: '<api-key>', Authent: '<api-key>'}};
fetch('https://demo-futures.kraken.com/derivatives/api/v3/portfolio-margining/simulate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://demo-futures.kraken.com/derivatives/api/v3/portfolio-margining/simulate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("APIKey", "<api-key>")
req.Header.Add("Authent", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"maintenanceMargin": 123,
"initialMargin": 123,
"pnl": 123,
"portfolioMarginBreakdown": {
"totalCrossAssetNettedMarketRisk": 123,
"totalMarketRisk": 123,
"totalScenarioPnls": [
123
],
"totalAbsoluteOptionPositionDeltaNotional": 123,
"netPortfolioDelta": 123,
"totalPremium": 123,
"isBuyOnly": true,
"futuresMaintenanceMargin": 123
},
"greeks": {},
"result": "success",
"serverTime": "2020-08-27T17:03:33.196Z"
}Account
Calculate portfolio margin, pnl and greeks
For a given portfolio of balances and positions (futures and options), calculate the margin requirements, pnl and option greeks.
Note: This is currently available exclusively in the Kraken pre-prod environments.
POST
/
portfolio-margining
/
simulate
Calculate portfolio margin, pnl and greeks
curl --request POST \
--url https://demo-futures.kraken.com/derivatives/api/v3/portfolio-margining/simulate \
--header 'APIKey: <api-key>' \
--header 'Authent: <api-key>'import requests
url = "https://demo-futures.kraken.com/derivatives/api/v3/portfolio-margining/simulate"
headers = {
"APIKey": "<api-key>",
"Authent": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {APIKey: '<api-key>', Authent: '<api-key>'}};
fetch('https://demo-futures.kraken.com/derivatives/api/v3/portfolio-margining/simulate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://demo-futures.kraken.com/derivatives/api/v3/portfolio-margining/simulate"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("APIKey", "<api-key>")
req.Header.Add("Authent", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"maintenanceMargin": 123,
"initialMargin": 123,
"pnl": 123,
"portfolioMarginBreakdown": {
"totalCrossAssetNettedMarketRisk": 123,
"totalMarketRisk": 123,
"totalScenarioPnls": [
123
],
"totalAbsoluteOptionPositionDeltaNotional": 123,
"netPortfolioDelta": 123,
"totalPremium": 123,
"isBuyOnly": true,
"futuresMaintenanceMargin": 123
},
"greeks": {},
"result": "success",
"serverTime": "2020-08-27T17:03:33.196Z"
}Authorizations
General API key with at least read-only access
Authentication string
Query Parameters
Response
200 - application/json
Simulated portfolio calculations
- Success Response
- Errors
Breakdown of components that make up the portfolio margin calculation.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Available options:
success Example:
"success"
Server time in Coordinated Universal Time (UTC)
Example:
"2020-08-27T17:03:33.196Z"
Was this page helpful?