Estimate margin position
curl --request GET \
--url https://api.worm.wtf/margin/positions/estimate/import requests
url = "https://api.worm.wtf/margin/positions/estimate/"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.worm.wtf/margin/positions/estimate/', 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.worm.wtf/margin/positions/estimate/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.worm.wtf/margin/positions/estimate/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.worm.wtf/margin/positions/estimate/")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.worm.wtf/margin/positions/estimate/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"average_price": "0.660000",
"total_shares": "95.000000",
"total_cost": "62.700000",
"best_ask": "0.655000",
"worst_fill_price": "0.665000",
"is_fully_filled": true,
"fee_amount": "0.500000",
"user_funds_needed": "100.500000",
"liquidation_price": "0.512000"
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}
Margin
Estimate margin position
Preview leverage, entry price, and liquidation price for a potential margin position.
GET
/
margin
/
positions
/
estimate
/
Estimate margin position
curl --request GET \
--url https://api.worm.wtf/margin/positions/estimate/import requests
url = "https://api.worm.wtf/margin/positions/estimate/"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.worm.wtf/margin/positions/estimate/', 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.worm.wtf/margin/positions/estimate/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.worm.wtf/margin/positions/estimate/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.worm.wtf/margin/positions/estimate/")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.worm.wtf/margin/positions/estimate/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"data": {
"average_price": "0.660000",
"total_shares": "95.000000",
"total_cost": "62.700000",
"best_ask": "0.655000",
"worst_fill_price": "0.665000",
"is_fully_filled": true,
"fee_amount": "0.500000",
"user_funds_needed": "100.500000",
"liquidation_price": "0.512000"
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}
Query Parameters
Collateral amount for the estimate (decimal string). Minimum depends on the market backend: $1.00** for Hyperliquid-routed markets, **$5.00 for Polymarket-routed markets.
Response
Show Data fields
Show Data fields
Whether the synthetic market buy fully consumed the requested leveraged notional (
funds * leverage).{
"data": {
"average_price": "0.660000",
"total_shares": "95.000000",
"total_cost": "62.700000",
"best_ask": "0.655000",
"worst_fill_price": "0.665000",
"is_fully_filled": true,
"fee_amount": "0.500000",
"user_funds_needed": "100.500000",
"liquidation_price": "0.512000"
},
"meta": {},
"error": null
}
{
"data": null,
"meta": null,
"error": {
"code": -11,
"slug": "invalid_request_params",
"message": "Validation Error",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -17,
"slug": "throttled",
"message": "Request was throttled.",
"details": []
}
}
{
"data": null,
"meta": null,
"error": {
"code": -3,
"slug": "internal_error",
"message": "An internal error occurred.",
"details": []
}
}