curl --request POST \
--url https://api.example.com/api/liquidity/distribution \
--header 'Content-Type: application/json' \
--data '
{
"tokens": {
"opinion": {
"outcome": "yes",
"token_id": "987654"
},
"polymarket": {
"outcome": "yes",
"token_id": "123456"
},
"predictfun": {
"market_id": "991122",
"outcome": "yes",
"token_id": "555"
}
},
"direction": "buy",
"amount_usd": 100,
"amount_tokens": 250,
"include_fees": true,
"enforce_min_orders": true,
"optimize_gas": false,
"gas_cost_per_source": 5
}
'import requests
url = "https://api.example.com/api/liquidity/distribution"
payload = {
"tokens": {
"opinion": {
"outcome": "yes",
"token_id": "987654"
},
"polymarket": {
"outcome": "yes",
"token_id": "123456"
},
"predictfun": {
"market_id": "991122",
"outcome": "yes",
"token_id": "555"
}
},
"direction": "buy",
"amount_usd": 100,
"amount_tokens": 250,
"include_fees": True,
"enforce_min_orders": True,
"optimize_gas": False,
"gas_cost_per_source": 5
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
tokens: {
opinion: {outcome: 'yes', token_id: '987654'},
polymarket: {outcome: 'yes', token_id: '123456'},
predictfun: {market_id: '991122', outcome: 'yes', token_id: '555'}
},
direction: 'buy',
amount_usd: 100,
amount_tokens: 250,
include_fees: true,
enforce_min_orders: true,
optimize_gas: false,
gas_cost_per_source: 5
})
};
fetch('https://api.example.com/api/liquidity/distribution', 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.example.com/api/liquidity/distribution",
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([
'tokens' => [
'opinion' => [
'outcome' => 'yes',
'token_id' => '987654'
],
'polymarket' => [
'outcome' => 'yes',
'token_id' => '123456'
],
'predictfun' => [
'market_id' => '991122',
'outcome' => 'yes',
'token_id' => '555'
]
],
'direction' => 'buy',
'amount_usd' => 100,
'amount_tokens' => 250,
'include_fees' => true,
'enforce_min_orders' => true,
'optimize_gas' => false,
'gas_cost_per_source' => 5
]),
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://api.example.com/api/liquidity/distribution"
payload := strings.NewReader("{\n \"tokens\": {\n \"opinion\": {\n \"outcome\": \"yes\",\n \"token_id\": \"987654\"\n },\n \"polymarket\": {\n \"outcome\": \"yes\",\n \"token_id\": \"123456\"\n },\n \"predictfun\": {\n \"market_id\": \"991122\",\n \"outcome\": \"yes\",\n \"token_id\": \"555\"\n }\n },\n \"direction\": \"buy\",\n \"amount_usd\": 100,\n \"amount_tokens\": 250,\n \"include_fees\": true,\n \"enforce_min_orders\": true,\n \"optimize_gas\": false,\n \"gas_cost_per_source\": 5\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.example.com/api/liquidity/distribution")
.header("Content-Type", "application/json")
.body("{\n \"tokens\": {\n \"opinion\": {\n \"outcome\": \"yes\",\n \"token_id\": \"987654\"\n },\n \"polymarket\": {\n \"outcome\": \"yes\",\n \"token_id\": \"123456\"\n },\n \"predictfun\": {\n \"market_id\": \"991122\",\n \"outcome\": \"yes\",\n \"token_id\": \"555\"\n }\n },\n \"direction\": \"buy\",\n \"amount_usd\": 100,\n \"amount_tokens\": 250,\n \"include_fees\": true,\n \"enforce_min_orders\": true,\n \"optimize_gas\": false,\n \"gas_cost_per_source\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/liquidity/distribution")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"tokens\": {\n \"opinion\": {\n \"outcome\": \"yes\",\n \"token_id\": \"987654\"\n },\n \"polymarket\": {\n \"outcome\": \"yes\",\n \"token_id\": \"123456\"\n },\n \"predictfun\": {\n \"market_id\": \"991122\",\n \"outcome\": \"yes\",\n \"token_id\": \"555\"\n }\n },\n \"direction\": \"buy\",\n \"amount_usd\": 100,\n \"amount_tokens\": 250,\n \"include_fees\": true,\n \"enforce_min_orders\": true,\n \"optimize_gas\": false,\n \"gas_cost_per_source\": 5\n}"
response = http.request(request)
puts response.read_body{
"combined": {
"platform": "combined",
"amount": 100,
"price": 0.5271
},
"platforms": {
"opinion": {
"platform": "opinion",
"used": true,
"amount": 60,
"price": 0.52,
"best_price": 0.52,
"hypothetical_tokens": 115.38,
"hypothetical_price": 0.52,
"available_liquidity": 1900,
"liquidity_exhausted": false,
"message_price": "52.0",
"message_amount": "115.38"
},
"predictfun": {
"platform": "predictfun",
"used": true,
"amount": 40,
"price": 0.535,
"best_price": 0.531,
"hypothetical_tokens": 74.77,
"hypothetical_price": 0.535,
"available_liquidity": 1200,
"liquidity_exhausted": false,
"message_price": "53.5",
"message_amount": "74.77"
}
},
"distributions": [
{
"platform": "opinion",
"amount": 60,
"price": 0.52
},
{
"platform": "predictfun",
"amount": 40,
"price": 0.535
}
],
"avg_price": 0.5271
}Plan best order split
Calculates how to split one buy or sell order across platforms to get a better execution.
Send token ids for the same outcome across platforms and either amount_usd or amount_tokens.
The response shows recommended allocation per platform and expected average execution price.
curl --request POST \
--url https://api.example.com/api/liquidity/distribution \
--header 'Content-Type: application/json' \
--data '
{
"tokens": {
"opinion": {
"outcome": "yes",
"token_id": "987654"
},
"polymarket": {
"outcome": "yes",
"token_id": "123456"
},
"predictfun": {
"market_id": "991122",
"outcome": "yes",
"token_id": "555"
}
},
"direction": "buy",
"amount_usd": 100,
"amount_tokens": 250,
"include_fees": true,
"enforce_min_orders": true,
"optimize_gas": false,
"gas_cost_per_source": 5
}
'import requests
url = "https://api.example.com/api/liquidity/distribution"
payload = {
"tokens": {
"opinion": {
"outcome": "yes",
"token_id": "987654"
},
"polymarket": {
"outcome": "yes",
"token_id": "123456"
},
"predictfun": {
"market_id": "991122",
"outcome": "yes",
"token_id": "555"
}
},
"direction": "buy",
"amount_usd": 100,
"amount_tokens": 250,
"include_fees": True,
"enforce_min_orders": True,
"optimize_gas": False,
"gas_cost_per_source": 5
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
tokens: {
opinion: {outcome: 'yes', token_id: '987654'},
polymarket: {outcome: 'yes', token_id: '123456'},
predictfun: {market_id: '991122', outcome: 'yes', token_id: '555'}
},
direction: 'buy',
amount_usd: 100,
amount_tokens: 250,
include_fees: true,
enforce_min_orders: true,
optimize_gas: false,
gas_cost_per_source: 5
})
};
fetch('https://api.example.com/api/liquidity/distribution', 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.example.com/api/liquidity/distribution",
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([
'tokens' => [
'opinion' => [
'outcome' => 'yes',
'token_id' => '987654'
],
'polymarket' => [
'outcome' => 'yes',
'token_id' => '123456'
],
'predictfun' => [
'market_id' => '991122',
'outcome' => 'yes',
'token_id' => '555'
]
],
'direction' => 'buy',
'amount_usd' => 100,
'amount_tokens' => 250,
'include_fees' => true,
'enforce_min_orders' => true,
'optimize_gas' => false,
'gas_cost_per_source' => 5
]),
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://api.example.com/api/liquidity/distribution"
payload := strings.NewReader("{\n \"tokens\": {\n \"opinion\": {\n \"outcome\": \"yes\",\n \"token_id\": \"987654\"\n },\n \"polymarket\": {\n \"outcome\": \"yes\",\n \"token_id\": \"123456\"\n },\n \"predictfun\": {\n \"market_id\": \"991122\",\n \"outcome\": \"yes\",\n \"token_id\": \"555\"\n }\n },\n \"direction\": \"buy\",\n \"amount_usd\": 100,\n \"amount_tokens\": 250,\n \"include_fees\": true,\n \"enforce_min_orders\": true,\n \"optimize_gas\": false,\n \"gas_cost_per_source\": 5\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.example.com/api/liquidity/distribution")
.header("Content-Type", "application/json")
.body("{\n \"tokens\": {\n \"opinion\": {\n \"outcome\": \"yes\",\n \"token_id\": \"987654\"\n },\n \"polymarket\": {\n \"outcome\": \"yes\",\n \"token_id\": \"123456\"\n },\n \"predictfun\": {\n \"market_id\": \"991122\",\n \"outcome\": \"yes\",\n \"token_id\": \"555\"\n }\n },\n \"direction\": \"buy\",\n \"amount_usd\": 100,\n \"amount_tokens\": 250,\n \"include_fees\": true,\n \"enforce_min_orders\": true,\n \"optimize_gas\": false,\n \"gas_cost_per_source\": 5\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/liquidity/distribution")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"tokens\": {\n \"opinion\": {\n \"outcome\": \"yes\",\n \"token_id\": \"987654\"\n },\n \"polymarket\": {\n \"outcome\": \"yes\",\n \"token_id\": \"123456\"\n },\n \"predictfun\": {\n \"market_id\": \"991122\",\n \"outcome\": \"yes\",\n \"token_id\": \"555\"\n }\n },\n \"direction\": \"buy\",\n \"amount_usd\": 100,\n \"amount_tokens\": 250,\n \"include_fees\": true,\n \"enforce_min_orders\": true,\n \"optimize_gas\": false,\n \"gas_cost_per_source\": 5\n}"
response = http.request(request)
puts response.read_body{
"combined": {
"platform": "combined",
"amount": 100,
"price": 0.5271
},
"platforms": {
"opinion": {
"platform": "opinion",
"used": true,
"amount": 60,
"price": 0.52,
"best_price": 0.52,
"hypothetical_tokens": 115.38,
"hypothetical_price": 0.52,
"available_liquidity": 1900,
"liquidity_exhausted": false,
"message_price": "52.0",
"message_amount": "115.38"
},
"predictfun": {
"platform": "predictfun",
"used": true,
"amount": 40,
"price": 0.535,
"best_price": 0.531,
"hypothetical_tokens": 74.77,
"hypothetical_price": 0.535,
"available_liquidity": 1200,
"liquidity_exhausted": false,
"message_price": "53.5",
"message_amount": "74.77"
}
},
"distributions": [
{
"platform": "opinion",
"amount": 60,
"price": 0.52
},
{
"platform": "predictfun",
"amount": 40,
"price": 0.535
}
],
"avg_price": 0.5271
}Body
Request for liquidity distribution
Token identifiers for the same outcome across platforms.
Supported keys: polymarket, opinion, probable, predictfun, limitless.
Recommended format is object with token_id (and market_id where applicable).
Show child attributes
Show child attributes
{
"opinion": { "outcome": "yes", "token_id": "987654" },
"polymarket": { "outcome": "yes", "token_id": "123456" },
"predictfun": {
"market_id": "991122",
"outcome": "yes",
"token_id": "555"
}
}
Trade direction: buy or sell.
"buy"
Order size in USD. Provide either amount_usd or amount_tokens.
x > 0100
Order size in tokens. Provide either amount_usd or amount_tokens.
x > 0250
Include platform fees in price calculation.
Apply platform minimum order constraints.
Prefer fewer sources when estimating execution.
Estimated gas cost per additional source in USD.
Response
Optimal distribution calculated
Response with optimal liquidity distribution
Distribution for a single platform
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
