Skip to main content
cURL
curl --request GET \
  --url https://test.deribit.com/api/v2/private/simulate_portfolio \
  --header 'Content-Type: application/json' \
  --data '
{
  "jsonrpc": "2.0",
  "id": 22222,
  "method": "private/simulate_portfolio",
  "params": {
    "currency": "BTC",
    "add_positions": true,
    "simulated_positions": {
      "BTC-PERPETUAL": 1
    }
  }
}
'
import requests

url = "https://test.deribit.com/api/v2/private/simulate_portfolio"

payload = {
"jsonrpc": "2.0",
"id": 22222,
"method": "private/simulate_portfolio",
"params": {
"currency": "BTC",
"add_positions": True,
"simulated_positions": { "BTC-PERPETUAL": 1 }
}
}
headers = {"Content-Type": "application/json"}

response = requests.get(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'GET',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 22222,
method: 'private/simulate_portfolio',
params: {
currency: 'BTC',
add_positions: true,
simulated_positions: {'BTC-PERPETUAL': 1}
}
})
};

fetch('https://test.deribit.com/api/v2/private/simulate_portfolio', 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://test.deribit.com/api/v2/private/simulate_portfolio",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 22222,
'method' => 'private/simulate_portfolio',
'params' => [
'currency' => 'BTC',
'add_positions' => true,
'simulated_positions' => [
'BTC-PERPETUAL' => 1
]
]
]),
CURLOPT_HTTPHEADER => [
"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://test.deribit.com/api/v2/private/simulate_portfolio"

payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 22222,\n \"method\": \"private/simulate_portfolio\",\n \"params\": {\n \"currency\": \"BTC\",\n \"add_positions\": true,\n \"simulated_positions\": {\n \"BTC-PERPETUAL\": 1\n }\n }\n}")

req, _ := http.NewRequest("GET", url, payload)

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.get("https://test.deribit.com/api/v2/private/simulate_portfolio")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 22222,\n \"method\": \"private/simulate_portfolio\",\n \"params\": {\n \"currency\": \"BTC\",\n \"add_positions\": true,\n \"simulated_positions\": {\n \"BTC-PERPETUAL\": 1\n }\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://test.deribit.com/api/v2/private/simulate_portfolio")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 22222,\n \"method\": \"private/simulate_portfolio\",\n \"params\": {\n \"currency\": \"BTC\",\n \"add_positions\": true,\n \"simulated_positions\": {\n \"BTC-PERPETUAL\": 1\n }\n }\n}"

response = http.request(request)
puts response.read_body
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "projected_initial_margin": 37662472.03416069,
    "initial_margin": 37662472.03416069,
    "total_pl": 40419.10179263,
    "additional_reserve": 0,
    "available_withdrawal_funds": 115871741.76065847,
    "options_pl": 921.55562578,
    "delta_total_map": {
      "btc_usd": 68024.519462366
    },
    "available_subaccount_transfer_funds": 0,
    "projected_delta_total": 69080.932029,
    "projected_maintenance_margin": 30129215.84817124,
    "total_equity_usd": 13075634611389.318,
    "options_gamma": -0.03907,
    "currency": "BTC",
    "options_theta": 142583.29246,
    "spot_reserve": 0,
    "total_initial_margin_usd": 3139528603778.822,
    "options_vega": -39322.23046,
    "margin_balance": 153534213.79481918,
    "futures_session_rpl": 1.309136,
    "options_gamma_map": {
      "btc_usd": -0.03907
    },
    "available_funds": 115871741.76065847,
    "futures_pl": 39497.54616685,
    "cross_collateral_enabled": true,
    "delta_total": 69080.932029,
    "options_session_rpl": 0,
    "total_margin_balance_usd": 12798550648250.61,
    "options_value": -1056.41256672,
    "options_session_upl": -174.67960675,
    "maintenance_margin": 30129215.84817124,
    "total_maintenance_margin_usd": 2511559381417.215,
    "options_vega_map": {
      "btc_usd": -39322.23046
    },
    "session_rpl": 1.309136,
    "locked_balance": 0,
    "session_upl": -339.16214185,
    "margin_model": "cross_pm",
    "portfolio_margining_enabled": true,
    "equity": 150075253.91354558,
    "balance": 150076473.4995114,
    "total_delta_total_usd": 6157454218.3753195,
    "fee_balance": 0,
    "options_delta": 2883.38481,
    "options_theta_map": {
      "btc_usd": 142583.29246
    },
    "futures_session_upl": -164.48253509
  },
  "usIn": 1742210019774525,
  "usOut": 1742210019788175,
  "usDiff": 13650,
  "testnet": true
}

Query Parameters

currency
enum<string>
required

The currency symbol Currency, i.e "BTC", "ETH", "USDC"

Available options:
BTC,
ETH,
USDC,
USDT,
EURR
Example:

"BTC"

add_positions
boolean

If true, adds simulated positions to current positions, otherwise uses only simulated positions. By default true

simulated_positions
string

Object with positions in following form: {InstrumentName1: Position1, InstrumentName2: Position2...}, for example {"BTC-PERPETUAL": -1000.0} (or corresponding URI-encoding for GET). For futures in USD, for options in base currency. JSON string containing: object data

Response

200 - application/json

Success response

jsonrpc
enum<string>
required

The JSON-RPC version (2.0)

Available options:
2.0
result
object
required

Portfolio margin simulation result

id
integer

The id that was sent in the request