Simulation
Create Backtest
POST
/
v1
/
simulation
/
backtests
Create Backtest
curl --request POST \
--url https://api.polysimulator.com/v1/simulation/backtests \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"condition_ids": [
"0xabc123"
],
"end": "2026-08-04T19:00:00Z",
"initial_bankroll": "1000",
"start": "2026-08-04T18:00:00Z",
"strategy": {
"entry": [
{
"field": "price",
"op": "lte",
"value": "0.40"
}
],
"exit": [
{
"field": "price",
"op": "gte",
"value": "0.60"
}
],
"fill_model": "depth_walk",
"outcome": "Yes",
"side": "BUY",
"size": "10",
"spec_version": "1"
},
"token_ids": {
"0xabc123": "tok_yes"
}
}
'import requests
url = "https://api.polysimulator.com/v1/simulation/backtests"
payload = {
"condition_ids": ["0xabc123"],
"end": "2026-08-04T19:00:00Z",
"initial_bankroll": "1000",
"start": "2026-08-04T18:00:00Z",
"strategy": {
"entry": [
{
"field": "price",
"op": "lte",
"value": "0.40"
}
],
"exit": [
{
"field": "price",
"op": "gte",
"value": "0.60"
}
],
"fill_model": "depth_walk",
"outcome": "Yes",
"side": "BUY",
"size": "10",
"spec_version": "1"
},
"token_ids": { "0xabc123": "tok_yes" }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
condition_ids: ['0xabc123'],
end: '2026-08-04T19:00:00Z',
initial_bankroll: '1000',
start: '2026-08-04T18:00:00Z',
strategy: {
entry: [{field: 'price', op: 'lte', value: '0.40'}],
exit: [{field: 'price', op: 'gte', value: '0.60'}],
fill_model: 'depth_walk',
outcome: 'Yes',
side: 'BUY',
size: '10',
spec_version: '1'
},
token_ids: {'0xabc123': 'tok_yes'}
})
};
fetch('https://api.polysimulator.com/v1/simulation/backtests', 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.polysimulator.com/v1/simulation/backtests",
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([
'condition_ids' => [
'0xabc123'
],
'end' => '2026-08-04T19:00:00Z',
'initial_bankroll' => '1000',
'start' => '2026-08-04T18:00:00Z',
'strategy' => [
'entry' => [
[
'field' => 'price',
'op' => 'lte',
'value' => '0.40'
]
],
'exit' => [
[
'field' => 'price',
'op' => 'gte',
'value' => '0.60'
]
],
'fill_model' => 'depth_walk',
'outcome' => 'Yes',
'side' => 'BUY',
'size' => '10',
'spec_version' => '1'
],
'token_ids' => [
'0xabc123' => 'tok_yes'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.polysimulator.com/v1/simulation/backtests"
payload := strings.NewReader("{\n \"condition_ids\": [\n \"0xabc123\"\n ],\n \"end\": \"2026-08-04T19:00:00Z\",\n \"initial_bankroll\": \"1000\",\n \"start\": \"2026-08-04T18:00:00Z\",\n \"strategy\": {\n \"entry\": [\n {\n \"field\": \"price\",\n \"op\": \"lte\",\n \"value\": \"0.40\"\n }\n ],\n \"exit\": [\n {\n \"field\": \"price\",\n \"op\": \"gte\",\n \"value\": \"0.60\"\n }\n ],\n \"fill_model\": \"depth_walk\",\n \"outcome\": \"Yes\",\n \"side\": \"BUY\",\n \"size\": \"10\",\n \"spec_version\": \"1\"\n },\n \"token_ids\": {\n \"0xabc123\": \"tok_yes\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.polysimulator.com/v1/simulation/backtests")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"condition_ids\": [\n \"0xabc123\"\n ],\n \"end\": \"2026-08-04T19:00:00Z\",\n \"initial_bankroll\": \"1000\",\n \"start\": \"2026-08-04T18:00:00Z\",\n \"strategy\": {\n \"entry\": [\n {\n \"field\": \"price\",\n \"op\": \"lte\",\n \"value\": \"0.40\"\n }\n ],\n \"exit\": [\n {\n \"field\": \"price\",\n \"op\": \"gte\",\n \"value\": \"0.60\"\n }\n ],\n \"fill_model\": \"depth_walk\",\n \"outcome\": \"Yes\",\n \"side\": \"BUY\",\n \"size\": \"10\",\n \"spec_version\": \"1\"\n },\n \"token_ids\": {\n \"0xabc123\": \"tok_yes\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polysimulator.com/v1/simulation/backtests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"condition_ids\": [\n \"0xabc123\"\n ],\n \"end\": \"2026-08-04T19:00:00Z\",\n \"initial_bankroll\": \"1000\",\n \"start\": \"2026-08-04T18:00:00Z\",\n \"strategy\": {\n \"entry\": [\n {\n \"field\": \"price\",\n \"op\": \"lte\",\n \"value\": \"0.40\"\n }\n ],\n \"exit\": [\n {\n \"field\": \"price\",\n \"op\": \"gte\",\n \"value\": \"0.60\"\n }\n ],\n \"fill_model\": \"depth_walk\",\n \"outcome\": \"Yes\",\n \"side\": \"BUY\",\n \"size\": \"10\",\n \"spec_version\": \"1\"\n },\n \"token_ids\": {\n \"0xabc123\": \"tok_yes\"\n }\n}"
response = http.request(request)
puts response.read_body{
"condition_ids": [
"0xabc123"
],
"created_at": "2026-08-04T18:00:00Z",
"end": "2026-08-04T19:00:00Z",
"fill_model": "depth_walk",
"is_replay": false,
"job_id": "11111111-1111-1111-1111-111111111111",
"start": "2026-08-04T18:00:00Z",
"status": "completed",
"token_ids": {
"0xabc123": "tok_yes"
},
"universe_eligible": true
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>",
"feature_key": "<string>",
"upgrade_url": "<string>",
"limit": 123
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}Authorizations
Issue from /v1/keys (or admin-issued for enterprise tier).
Headers
Body
application/json
Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Optional explicit condition_id → token_id map. When omitted, the job resolves tokens from strategy.outcome and archive metadata.
Show child attributes
Show child attributes
Response
Successful Response
Available options:
pending, running, completed, failed, cancelled Available options:
midpoint, top_of_book, depth_walk, depth_walk_depletion Available options:
grid, event Show child attributes
Show child attributes
Was this page helpful?
⌘I
Create Backtest
curl --request POST \
--url https://api.polysimulator.com/v1/simulation/backtests \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"condition_ids": [
"0xabc123"
],
"end": "2026-08-04T19:00:00Z",
"initial_bankroll": "1000",
"start": "2026-08-04T18:00:00Z",
"strategy": {
"entry": [
{
"field": "price",
"op": "lte",
"value": "0.40"
}
],
"exit": [
{
"field": "price",
"op": "gte",
"value": "0.60"
}
],
"fill_model": "depth_walk",
"outcome": "Yes",
"side": "BUY",
"size": "10",
"spec_version": "1"
},
"token_ids": {
"0xabc123": "tok_yes"
}
}
'import requests
url = "https://api.polysimulator.com/v1/simulation/backtests"
payload = {
"condition_ids": ["0xabc123"],
"end": "2026-08-04T19:00:00Z",
"initial_bankroll": "1000",
"start": "2026-08-04T18:00:00Z",
"strategy": {
"entry": [
{
"field": "price",
"op": "lte",
"value": "0.40"
}
],
"exit": [
{
"field": "price",
"op": "gte",
"value": "0.60"
}
],
"fill_model": "depth_walk",
"outcome": "Yes",
"side": "BUY",
"size": "10",
"spec_version": "1"
},
"token_ids": { "0xabc123": "tok_yes" }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
condition_ids: ['0xabc123'],
end: '2026-08-04T19:00:00Z',
initial_bankroll: '1000',
start: '2026-08-04T18:00:00Z',
strategy: {
entry: [{field: 'price', op: 'lte', value: '0.40'}],
exit: [{field: 'price', op: 'gte', value: '0.60'}],
fill_model: 'depth_walk',
outcome: 'Yes',
side: 'BUY',
size: '10',
spec_version: '1'
},
token_ids: {'0xabc123': 'tok_yes'}
})
};
fetch('https://api.polysimulator.com/v1/simulation/backtests', 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.polysimulator.com/v1/simulation/backtests",
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([
'condition_ids' => [
'0xabc123'
],
'end' => '2026-08-04T19:00:00Z',
'initial_bankroll' => '1000',
'start' => '2026-08-04T18:00:00Z',
'strategy' => [
'entry' => [
[
'field' => 'price',
'op' => 'lte',
'value' => '0.40'
]
],
'exit' => [
[
'field' => 'price',
'op' => 'gte',
'value' => '0.60'
]
],
'fill_model' => 'depth_walk',
'outcome' => 'Yes',
'side' => 'BUY',
'size' => '10',
'spec_version' => '1'
],
'token_ids' => [
'0xabc123' => 'tok_yes'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.polysimulator.com/v1/simulation/backtests"
payload := strings.NewReader("{\n \"condition_ids\": [\n \"0xabc123\"\n ],\n \"end\": \"2026-08-04T19:00:00Z\",\n \"initial_bankroll\": \"1000\",\n \"start\": \"2026-08-04T18:00:00Z\",\n \"strategy\": {\n \"entry\": [\n {\n \"field\": \"price\",\n \"op\": \"lte\",\n \"value\": \"0.40\"\n }\n ],\n \"exit\": [\n {\n \"field\": \"price\",\n \"op\": \"gte\",\n \"value\": \"0.60\"\n }\n ],\n \"fill_model\": \"depth_walk\",\n \"outcome\": \"Yes\",\n \"side\": \"BUY\",\n \"size\": \"10\",\n \"spec_version\": \"1\"\n },\n \"token_ids\": {\n \"0xabc123\": \"tok_yes\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.polysimulator.com/v1/simulation/backtests")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"condition_ids\": [\n \"0xabc123\"\n ],\n \"end\": \"2026-08-04T19:00:00Z\",\n \"initial_bankroll\": \"1000\",\n \"start\": \"2026-08-04T18:00:00Z\",\n \"strategy\": {\n \"entry\": [\n {\n \"field\": \"price\",\n \"op\": \"lte\",\n \"value\": \"0.40\"\n }\n ],\n \"exit\": [\n {\n \"field\": \"price\",\n \"op\": \"gte\",\n \"value\": \"0.60\"\n }\n ],\n \"fill_model\": \"depth_walk\",\n \"outcome\": \"Yes\",\n \"side\": \"BUY\",\n \"size\": \"10\",\n \"spec_version\": \"1\"\n },\n \"token_ids\": {\n \"0xabc123\": \"tok_yes\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polysimulator.com/v1/simulation/backtests")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"condition_ids\": [\n \"0xabc123\"\n ],\n \"end\": \"2026-08-04T19:00:00Z\",\n \"initial_bankroll\": \"1000\",\n \"start\": \"2026-08-04T18:00:00Z\",\n \"strategy\": {\n \"entry\": [\n {\n \"field\": \"price\",\n \"op\": \"lte\",\n \"value\": \"0.40\"\n }\n ],\n \"exit\": [\n {\n \"field\": \"price\",\n \"op\": \"gte\",\n \"value\": \"0.60\"\n }\n ],\n \"fill_model\": \"depth_walk\",\n \"outcome\": \"Yes\",\n \"side\": \"BUY\",\n \"size\": \"10\",\n \"spec_version\": \"1\"\n },\n \"token_ids\": {\n \"0xabc123\": \"tok_yes\"\n }\n}"
response = http.request(request)
puts response.read_body{
"condition_ids": [
"0xabc123"
],
"created_at": "2026-08-04T18:00:00Z",
"end": "2026-08-04T19:00:00Z",
"fill_model": "depth_walk",
"is_replay": false,
"job_id": "11111111-1111-1111-1111-111111111111",
"start": "2026-08-04T18:00:00Z",
"status": "completed",
"token_ids": {
"0xabc123": "tok_yes"
},
"universe_eligible": true
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>",
"feature_key": "<string>",
"upgrade_url": "<string>",
"limit": 123
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}{
"error": "<string>",
"message": "<string>",
"details": {},
"request_id": "<string>"
}