Prediction Markets API Reference
GraphQL endpoints and realtime channels that power the Shift prediction-markets trading UI and operator console. build e4c615f
Introduction
The Prediction Markets API is a GraphQL API exposed by the
prediction_market_gateway service. All requests are sent as
POST to /graphql with a JSON body containing query and
variables. Authenticated operations require an
Authorization: Bearer <token> header; the gateway resolves the user and their
permissions from the token (there is no separate user-id header).
Hosts
http://localhost:3000/graphql GraphQL (queries & mutations).
Subscriptions stream over graphql-ws at ws://localhost:3000/graphql. See the Real-Time transport guide.
Audiences
The Markets & Events, Market Prices, Order Book, Price History, Trading, Trades, Positions and Transactions groups power the consumer trading UI. The remaining groups power the operator / admin console and are gated by per-action permissions (most also require an admin role).
Authentication & permissions
Public read endpoints are unauthenticated and rate-limited per IP. Trader endpoints require a
bearer token whose role grants the listed permission (e.g. trade,
view_own_orders). Admin endpoints additionally require an admin role. Tokens are verified
by the gateway against the platform auth service on each call (results are briefly cached).
Request shape
POST /graphql HTTP/1.1\nHost: localhost:3000\nAuthorization: Bearer <token>\nContent-Type: application/json\n\n{\n "query": "query { markets(pager: { limit: 20 }) { market_id external_id is_active } }",\n "variables": {}\n}
Errors
GraphQL errors are returned in the errors array of the response body with HTTP
status 200. Auth, throttle and network errors may return non-200 statuses or surface as
GraphQL errors with codes such as THROTTLE.SOFT_LOCK or
AUTH_GUARD_TOKEN_EXPIRED.
Markets & Events
Public, filterable, searchable read endpoints that populate the markets dashboard, the event grid, the category navigation and the expanded market/event detail views. The events queries personalize when a bearer token is supplied.
query markets Paginated, filterable list of prediction markets.
120 req / 60 s).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset (default 30 / 0) |
date_range |
DateRangeInput |
optional | created_at window |
opened_at_range |
DateRangeInput |
optional | opened_at window |
expires_at_range |
DateRangeInput |
optional | expires_at window |
market_id |
String |
optional | Exact market id |
event_id |
String |
optional | Filter by parent event |
market_venue_id |
String |
optional | Filter by venue |
external_id |
String |
optional | Filter by venue-native id |
is_active |
ToggleSwitch |
optional | on / off |
is_closed |
ToggleSwitch |
optional | on / off |
result |
MarketResult |
optional | yes / no / void |
search |
String |
optional | Case-insensitive text match |
Response
| Field | Type | Description |
|---|---|---|
market_id |
String! |
Stable market identifier |
event_id |
String |
Parent event id (nullable) |
market_venue_id |
String! |
Owning venue id |
external_id |
String! |
Venue-native id (e.g. Kalshi ticker) |
is_active |
ToggleSwitch! |
on / off |
is_closed |
ToggleSwitch! |
on / off |
result |
MarketResult |
yes / no / void once resolved (nullable) |
opened_at |
String |
Open time (nullable) |
expires_at |
String |
Scheduled expiry (nullable) |
closed_at |
String |
Close time (nullable) |
resolved_at |
String |
Resolution time (nullable) |
created_at |
String! |
Row create time |
updated_at |
String! |
Row update time |
image |
String |
Image URL — lazy @ResolveField (nullable) |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query markets($pager: PagerInput, $date_range: DateRangeInput, $opened_at_range: DateRangeInput, $expires_at_range: DateRangeInput, $market_id: String, $event_id: String, $market_venue_id: String, $external_id: String, $is_active: ToggleSwitch, $is_closed: ToggleSwitch, $result: MarketResult, $search: String) {
markets(pager: $pager, date_range: $date_range, opened_at_range: $opened_at_range, expires_at_range: $expires_at_range, market_id: $market_id, event_id: $event_id, market_venue_id: $market_venue_id, external_id: $external_id, is_active: $is_active, is_closed: $is_closed, result: $result, search: $search) {
market_id event_id market_venue_id external_id is_active is_closed result opened_at expires_at closed_at resolved_at created_at updated_at image
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query markets($pager: PagerInput, $date_range: DateRangeInput, $opened_at_range: DateRangeInput, $expires_at_range: DateRangeInput, $market_id: String, $event_id: String, $market_venue_id: String, $external_id: String, $is_active: ToggleSwitch, $is_closed: ToggleSwitch, $result: MarketResult, $search: String) { markets(pager: $pager, date_range: $date_range, opened_at_range: $opened_at_range, expires_at_range: $expires_at_range, market_id: $market_id, event_id: $event_id, market_venue_id: $market_venue_id, external_id: $external_id, is_active: $is_active, is_closed: $is_closed, result: $result, search: $search) { market_id event_id market_venue_id external_id is_active is_closed result opened_at expires_at closed_at resolved_at created_at updated_at image } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query markets($pager: PagerInput, $date_range: DateRangeInput, $opened_at_range: DateRangeInput, $expires_at_range: DateRangeInput, $market_id: String, $event_id: String, $market_venue_id: String, $external_id: String, $is_active: ToggleSwitch, $is_closed: ToggleSwitch, $result: MarketResult, $search: String) { markets(pager: $pager, date_range: $date_range, opened_at_range: $opened_at_range, expires_at_range: $expires_at_range, market_id: $market_id, event_id: $event_id, market_venue_id: $market_venue_id, external_id: $external_id, is_active: $is_active, is_closed: $is_closed, result: $result, search: $search) { market_id event_id market_venue_id external_id is_active is_closed result opened_at expires_at closed_at resolved_at created_at updated_at image } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query markets($pager: PagerInput, $date_range: DateRangeInput, $opened_at_range: DateRangeInput, $expires_at_range: DateRangeInput, $market_id: String, $event_id: String, $market_venue_id: String, $external_id: String, $is_active: ToggleSwitch, $is_closed: ToggleSwitch, $result: MarketResult, $search: String) { markets(pager: $pager, date_range: $date_range, opened_at_range: $opened_at_range, expires_at_range: $expires_at_range, market_id: $market_id, event_id: $event_id, market_venue_id: $market_venue_id, external_id: $external_id, is_active: $is_active, is_closed: $is_closed, result: $result, search: $search) { market_id event_id market_venue_id external_id is_active is_closed result opened_at expires_at closed_at resolved_at created_at updated_at image } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query market A single market by id.
120 req / 60 s).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_id |
String! |
required | Market id |
Response
| Field | Type | Description |
|---|---|---|
market_id |
String! |
Stable market identifier |
event_id |
String |
Parent event id (nullable) |
market_venue_id |
String! |
Owning venue id |
external_id |
String! |
Venue-native id (e.g. Kalshi ticker) |
is_active |
ToggleSwitch! |
on / off |
is_closed |
ToggleSwitch! |
on / off |
result |
MarketResult |
yes / no / void once resolved (nullable) |
opened_at |
String |
Open time (nullable) |
expires_at |
String |
Scheduled expiry (nullable) |
closed_at |
String |
Close time (nullable) |
resolved_at |
String |
Resolution time (nullable) |
created_at |
String! |
Row create time |
updated_at |
String! |
Row update time |
image |
String |
Image URL — lazy @ResolveField (nullable) |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query market($market_id: String!) {
market(market_id: $market_id) {
market_id event_id market_venue_id external_id is_active is_closed result opened_at expires_at closed_at resolved_at created_at updated_at image
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query market($market_id: String!) { market(market_id: $market_id) { market_id event_id market_venue_id external_id is_active is_closed result opened_at expires_at closed_at resolved_at created_at updated_at image } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query market($market_id: String!) { market(market_id: $market_id) { market_id event_id market_venue_id external_id is_active is_closed result opened_at expires_at closed_at resolved_at created_at updated_at image } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query market($market_id: String!) { market(market_id: $market_id) { market_id event_id market_venue_id external_id is_active is_closed result opened_at expires_at closed_at resolved_at created_at updated_at image } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query events Paginated, filterable list of events (tradeable groups of markets).
is_favourite filter & field). Rate-limited per IP (120 req / 60 s).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset (default 30 / 0) |
date_range |
DateRangeInput |
optional | created_at window |
opened_at_range |
DateRangeInput |
optional | opened_at window |
expires_at_range |
DateRangeInput |
optional | expires_at window |
event_id |
String |
optional | Exact event id |
market_venue_id |
String |
optional | Filter by venue |
external_id |
String |
optional | Filter by venue-native id |
primary_category |
PrimaryCategory |
optional | Filter by primary category |
sub_category |
SubCategory |
optional | Filter by sub-category |
tags |
[String!] |
optional | Raw-tag filter (combined per tag_match) |
tag_match |
TagMatch |
optional | any (default) / all |
is_active |
ToggleSwitch |
optional | on / off |
is_closed |
ToggleSwitch |
optional | on / off |
is_favourite |
ToggleSwitch |
optional | Per-user favourites (requires a token) |
Response
| Field | Type | Description |
|---|---|---|
event_id |
String! |
Stable event identifier |
market_venue_id |
String! |
Owning venue id |
external_id |
String |
Venue-native id (nullable) |
title |
String! |
Event question / title |
primary_category |
PrimaryCategory! |
Derived primary category |
sub_category |
SubCategory! |
Derived sub-category |
is_active |
ToggleSwitch! |
on / off |
is_closed |
ToggleSwitch! |
on / off |
opened_at |
String |
Open time (nullable) |
expires_at |
String |
Scheduled expiry (nullable) |
closed_at |
String |
Close time (nullable) |
resolved_at |
String |
Resolution time (nullable) |
created_at |
String! |
Row create time |
updated_at |
String! |
Row update time |
tags |
[String!]! |
Raw venue tags — lazy @ResolveField |
image |
String |
Image URL — lazy @ResolveField (nullable) |
is_favourite |
ToggleSwitch! |
Per-caller favourite flag — lazy @ResolveField |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query events($pager: PagerInput, $date_range: DateRangeInput, $opened_at_range: DateRangeInput, $expires_at_range: DateRangeInput, $event_id: String, $market_venue_id: String, $external_id: String, $primary_category: PrimaryCategory, $sub_category: SubCategory, $tags: [String!], $tag_match: TagMatch, $is_active: ToggleSwitch, $is_closed: ToggleSwitch, $is_favourite: ToggleSwitch) {
events(pager: $pager, date_range: $date_range, opened_at_range: $opened_at_range, expires_at_range: $expires_at_range, event_id: $event_id, market_venue_id: $market_venue_id, external_id: $external_id, primary_category: $primary_category, sub_category: $sub_category, tags: $tags, tag_match: $tag_match, is_active: $is_active, is_closed: $is_closed, is_favourite: $is_favourite) {
event_id market_venue_id external_id title primary_category sub_category is_active is_closed opened_at expires_at created_at updated_at tags image is_favourite
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query events($pager: PagerInput, $date_range: DateRangeInput, $opened_at_range: DateRangeInput, $expires_at_range: DateRangeInput, $event_id: String, $market_venue_id: String, $external_id: String, $primary_category: PrimaryCategory, $sub_category: SubCategory, $tags: [String!], $tag_match: TagMatch, $is_active: ToggleSwitch, $is_closed: ToggleSwitch, $is_favourite: ToggleSwitch) { events(pager: $pager, date_range: $date_range, opened_at_range: $opened_at_range, expires_at_range: $expires_at_range, event_id: $event_id, market_venue_id: $market_venue_id, external_id: $external_id, primary_category: $primary_category, sub_category: $sub_category, tags: $tags, tag_match: $tag_match, is_active: $is_active, is_closed: $is_closed, is_favourite: $is_favourite) { event_id market_venue_id external_id title primary_category sub_category is_active is_closed opened_at expires_at created_at updated_at tags image is_favourite } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query events($pager: PagerInput, $date_range: DateRangeInput, $opened_at_range: DateRangeInput, $expires_at_range: DateRangeInput, $event_id: String, $market_venue_id: String, $external_id: String, $primary_category: PrimaryCategory, $sub_category: SubCategory, $tags: [String!], $tag_match: TagMatch, $is_active: ToggleSwitch, $is_closed: ToggleSwitch, $is_favourite: ToggleSwitch) { events(pager: $pager, date_range: $date_range, opened_at_range: $opened_at_range, expires_at_range: $expires_at_range, event_id: $event_id, market_venue_id: $market_venue_id, external_id: $external_id, primary_category: $primary_category, sub_category: $sub_category, tags: $tags, tag_match: $tag_match, is_active: $is_active, is_closed: $is_closed, is_favourite: $is_favourite) { event_id market_venue_id external_id title primary_category sub_category is_active is_closed opened_at expires_at created_at updated_at tags image is_favourite } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query events($pager: PagerInput, $date_range: DateRangeInput, $opened_at_range: DateRangeInput, $expires_at_range: DateRangeInput, $event_id: String, $market_venue_id: String, $external_id: String, $primary_category: PrimaryCategory, $sub_category: SubCategory, $tags: [String!], $tag_match: TagMatch, $is_active: ToggleSwitch, $is_closed: ToggleSwitch, $is_favourite: ToggleSwitch) { events(pager: $pager, date_range: $date_range, opened_at_range: $opened_at_range, expires_at_range: $expires_at_range, event_id: $event_id, market_venue_id: $market_venue_id, external_id: $external_id, primary_category: $primary_category, sub_category: $sub_category, tags: $tags, tag_match: $tag_match, is_active: $is_active, is_closed: $is_closed, is_favourite: $is_favourite) { event_id market_venue_id external_id title primary_category sub_category is_active is_closed opened_at expires_at created_at updated_at tags image is_favourite } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query event A single event by id.
is_favourite filter & field). Rate-limited per IP (120 req / 60 s).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
event_id |
String! |
required | Event id |
Response
| Field | Type | Description |
|---|---|---|
event_id |
String! |
Stable event identifier |
market_venue_id |
String! |
Owning venue id |
external_id |
String |
Venue-native id (nullable) |
title |
String! |
Event question / title |
primary_category |
PrimaryCategory! |
Derived primary category |
sub_category |
SubCategory! |
Derived sub-category |
is_active |
ToggleSwitch! |
on / off |
is_closed |
ToggleSwitch! |
on / off |
opened_at |
String |
Open time (nullable) |
expires_at |
String |
Scheduled expiry (nullable) |
closed_at |
String |
Close time (nullable) |
resolved_at |
String |
Resolution time (nullable) |
created_at |
String! |
Row create time |
updated_at |
String! |
Row update time |
tags |
[String!]! |
Raw venue tags — lazy @ResolveField |
image |
String |
Image URL — lazy @ResolveField (nullable) |
is_favourite |
ToggleSwitch! |
Per-caller favourite flag — lazy @ResolveField |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query event($event_id: String!) {
event(event_id: $event_id) {
event_id market_venue_id external_id title primary_category sub_category is_active is_closed opened_at expires_at created_at updated_at tags image is_favourite
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query event($event_id: String!) { event(event_id: $event_id) { event_id market_venue_id external_id title primary_category sub_category is_active is_closed opened_at expires_at created_at updated_at tags image is_favourite } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query event($event_id: String!) { event(event_id: $event_id) { event_id market_venue_id external_id title primary_category sub_category is_active is_closed opened_at expires_at created_at updated_at tags image is_favourite } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query event($event_id: String!) { event(event_id: $event_id) { event_id market_venue_id external_id title primary_category sub_category is_active is_closed opened_at expires_at created_at updated_at tags image is_favourite } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query category_facets Category / sub-category navigation with active-event counts.
120 req / 60 s).Inputs
This operation takes no arguments.
Response
| Field | Type | Description |
|---|---|---|
primary_category |
PrimaryCategory! |
Category key |
active_count |
Int! |
Rollup of active events in the category |
sub_categories |
[SubCategoryFacet!]! |
Per-sub-category active counts |
GraphQL Operation
query category_facets {
category_facets {
primary_category active_count sub_categories { sub_category active_count }
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query category_facets { category_facets { primary_category active_count sub_categories { sub_category active_count } } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query category_facets { category_facets { primary_category active_count sub_categories { sub_category active_count } } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query category_facets { category_facets { primary_category active_count sub_categories { sub_category active_count } } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation set_event_favourite Add or remove an event from the caller's favourites.
set_event_favourite. Rate-limited (60 req / 60 s).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
event_id |
String! |
required | Event id |
is_favourite |
ToggleSwitch! |
required | on = favourite, off = un-favourite |
Response
Returns Boolean! — true on success; failures surface in the GraphQL errors array.
GraphQL Operation
mutation set_event_favourite($event_id: String!, $is_favourite: ToggleSwitch!) {
set_event_favourite(event_id: $event_id, is_favourite: $is_favourite)
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation set_event_favourite($event_id: String!, $is_favourite: ToggleSwitch!) { set_event_favourite(event_id: $event_id, is_favourite: $is_favourite) }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation set_event_favourite($event_id: String!, $is_favourite: ToggleSwitch!) { set_event_favourite(event_id: $event_id, is_favourite: $is_favourite) }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation set_event_favourite($event_id: String!, $is_favourite: ToggleSwitch!) { set_event_favourite(event_id: $event_id, is_favourite: $is_favourite) }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Market Prices
Latest best bid/ask per market, available as a one-shot query and as a live stream. Registering a market here also keeps its price warm server-side.
query markets_prices Register the given markets for pricing and return their latest value.
120 req / 60 s).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_ids |
[String]! |
required | 1–50 market ids |
Response
| Field | Type | Description |
|---|---|---|
market_id |
String! |
Market id |
yes |
OutcomePrice! |
Best bid/ask for the YES outcome |
no |
OutcomePrice! |
Best bid/ask for the NO outcome |
ts |
String! |
ISO timestamp the price was fetched |
GraphQL Operation
query markets_prices($market_ids: [String]!) {
markets_prices(market_ids: $market_ids) {
market_id yes { bid ask } no { bid ask } ts
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query markets_prices($market_ids: [String]!) { markets_prices(market_ids: $market_ids) { market_id yes { bid ask } no { bid ask } ts } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query markets_prices($market_ids: [String]!) { markets_prices(market_ids: $market_ids) { market_id yes { bid ask } no { bid ask } ts } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query markets_prices($market_ids: [String]!) { markets_prices(market_ids: $market_ids) { market_id yes { bid ask } no { bid ask } ts } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);subscription markets_prices Stream price updates for the given markets.
30 ops / 60 s, 500 ms min gap).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_ids |
[String]! |
required | 1–50 market ids |
Response
| Field | Type | Description |
|---|---|---|
market_id |
String! |
Market id |
yes |
OutcomePrice! |
Best bid/ask for the YES outcome |
no |
OutcomePrice! |
Best bid/ask for the NO outcome |
ts |
String! |
ISO timestamp the price was fetched |
GraphQL Operation
subscription markets_prices($market_ids: [String]!) {
markets_prices(market_ids: $market_ids) {
market_id yes { bid ask } no { bid ask } ts
}
}
Subscribe (graphql-ws)
import { createClient } from "graphql-ws";
const client = createClient({
url: "ws://localhost:3000/graphql",
// Authorization is optional for these public realtime channels:
connectionParams: { Authorization: "Bearer YOUR_TOKEN" },
});
const unsubscribe = client.subscribe(
{ query: `subscription markets_prices($market_ids: [String]!) { markets_prices(market_ids: $market_ids) { market_id yes { bid ask } no { bid ask } ts } }` },
{
next: (msg) => console.log(msg.data),
error: (err) => console.error(err),
complete: () => console.log("complete"),
},
);
Order Book
Live order-book depth for a single market outcome, streamed over graphql-ws.
subscription orderbook Stream order-book snapshots for a market outcome on every change.
30 ops / 60 s, 500 ms min gap).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_external_id |
String! |
required | Venue-native market id |
outcome_side |
OutcomeSide! |
required | yes / no |
Response
| Field | Type | Description |
|---|---|---|
market_external_id |
String! |
Venue-native market id |
outcome_side |
OutcomeSide! |
yes / no |
buy |
[OrderbookLevel!]! |
Bid levels (price, quantity) |
sell |
[OrderbookLevel!]! |
Ask levels (price, quantity) |
ts |
String! |
Epoch-ms timestamp |
ts_iso |
String! |
ISO timestamp |
best_bid |
Float |
Best bid (nullable) |
best_ask |
Float |
Best ask (nullable) |
total_volume |
Float |
Aggregate book volume (nullable) |
GraphQL Operation
subscription orderbook($market_external_id: String!, $outcome_side: OutcomeSide!) {
orderbook(market_external_id: $market_external_id, outcome_side: $outcome_side) {
market_external_id outcome_side buy { price quantity } sell { price quantity } ts ts_iso best_bid best_ask total_volume
}
}
Subscribe (graphql-ws)
import { createClient } from "graphql-ws";
const client = createClient({
url: "ws://localhost:3000/graphql",
// Authorization is optional for these public realtime channels:
connectionParams: { Authorization: "Bearer YOUR_TOKEN" },
});
const unsubscribe = client.subscribe(
{ query: `subscription orderbook($market_external_id: String!, $outcome_side: OutcomeSide!) { orderbook(market_external_id: $market_external_id, outcome_side: $outcome_side) { market_external_id outcome_side buy { price quantity } sell { price quantity } ts ts_iso best_bid best_ask total_volume } }` },
{
next: (msg) => console.log(msg.data),
error: (err) => console.error(err),
complete: () => console.log("complete"),
},
);
Price History
Historical price series for charts — per market or rolled up across an event — plus a live delta stream.
query market_price_history Price points for one market/side over a range.
120 req / 60 s).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_id |
String! |
required | Market id |
side |
OutcomeSide |
optional | yes (default) / no |
range |
PriceHistoryRange! |
required | hour / hour6 / day / week / month / all |
Response
| Field | Type | Description |
|---|---|---|
ts |
Int! |
Epoch-seconds bucket timestamp |
price |
Float! |
Price at the bucket |
GraphQL Operation
query market_price_history($market_id: String!, $side: OutcomeSide, $range: PriceHistoryRange!) {
market_price_history(market_id: $market_id, side: $side, range: $range) {
ts price
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query market_price_history($market_id: String!, $side: OutcomeSide, $range: PriceHistoryRange!) { market_price_history(market_id: $market_id, side: $side, range: $range) { ts price } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query market_price_history($market_id: String!, $side: OutcomeSide, $range: PriceHistoryRange!) { market_price_history(market_id: $market_id, side: $side, range: $range) { ts price } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query market_price_history($market_id: String!, $side: OutcomeSide, $range: PriceHistoryRange!) { market_price_history(market_id: $market_id, side: $side, range: $range) { ts price } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query event_price_history Per-market price history for every market in an event.
120 req / 60 s).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
event_id |
String! |
required | Event id |
side |
OutcomeSide |
optional | yes (default) / no |
range |
PriceHistoryRange! |
required | hour / hour6 / day / week / month / all |
Response
| Field | Type | Description |
|---|---|---|
market_id |
String! |
Market id |
points |
[PricePoint!]! |
Price points (ts, price) |
GraphQL Operation
query event_price_history($event_id: String!, $side: OutcomeSide, $range: PriceHistoryRange!) {
event_price_history(event_id: $event_id, side: $side, range: $range) {
market_id points { ts price }
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query event_price_history($event_id: String!, $side: OutcomeSide, $range: PriceHistoryRange!) { event_price_history(event_id: $event_id, side: $side, range: $range) { market_id points { ts price } } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query event_price_history($event_id: String!, $side: OutcomeSide, $range: PriceHistoryRange!) { event_price_history(event_id: $event_id, side: $side, range: $range) { market_id points { ts price } } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query event_price_history($event_id: String!, $side: OutcomeSide, $range: PriceHistoryRange!) { event_price_history(event_id: $event_id, side: $side, range: $range) { market_id points { ts price } } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);subscription market_price_history_updates Stream per-market price-history deltas (new or revised points).
30 ops / 60 s, 500 ms min gap).Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_ids |
[String]! |
required | 1–50 market ids |
side |
OutcomeSide |
optional | yes (default) / no |
range |
PriceHistoryRange! |
required | hour / hour6 / day / week / month / all |
Response
| Field | Type | Description |
|---|---|---|
market_id |
String! |
Market id |
side |
OutcomeSide! |
yes / no |
range |
PriceHistoryRange! |
Requested range |
points |
[PricePoint!]! |
New / revised points (ts, price) |
GraphQL Operation
subscription market_price_history_updates($market_ids: [String]!, $side: OutcomeSide, $range: PriceHistoryRange!) {
market_price_history_updates(market_ids: $market_ids, side: $side, range: $range) {
market_id side range points { ts price }
}
}
Subscribe (graphql-ws)
import { createClient } from "graphql-ws";
const client = createClient({
url: "ws://localhost:3000/graphql",
// Authorization is optional for these public realtime channels:
connectionParams: { Authorization: "Bearer YOUR_TOKEN" },
});
const unsubscribe = client.subscribe(
{ query: `subscription market_price_history_updates($market_ids: [String]!, $side: OutcomeSide, $range: PriceHistoryRange!) { market_price_history_updates(market_ids: $market_ids, side: $side, range: $range) { market_id side range points { ts price } } }` },
{
next: (msg) => console.log(msg.data),
error: (err) => console.error(err),
complete: () => console.log("complete"),
},
);
Trading
Order estimation and placement, plus the caller's own orders. For traders the user_id is taken from the token; admins may read across users.
query estimate_order Quote price, fee and total for a hypothetical order before placing it.
estimate_order.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_id |
String! |
required | Market id |
outcome_side |
OutcomeSide! |
required | yes / no |
side |
Side! |
required | buy / sell |
shares |
Float! |
required | Share quantity |
Response
| Field | Type | Description |
|---|---|---|
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
side |
Side! |
buy / sell |
shares |
Float! |
Share quantity |
price |
Float! |
Resolved price (ask for buy, bid for sell) |
notional |
Float! |
shares × price |
fee |
Float! |
Estimated taker fee |
fee_currency_id |
String! |
Fee currency |
total |
Float! |
buy: notional + fee; sell: notional − fee |
GraphQL Operation
query estimate_order($market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!) {
estimate_order(market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares) {
market_id outcome_side side shares price notional fee fee_currency_id total
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query estimate_order($market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!) { estimate_order(market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares) { market_id outcome_side side shares price notional fee fee_currency_id total } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query estimate_order($market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!) { estimate_order(market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares) { market_id outcome_side side shares price notional fee fee_currency_id total } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query estimate_order($market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!) { estimate_order(market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares) { market_id outcome_side side shares price notional fee fee_currency_id total } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation create_order Place a buy/sell order against a market outcome.
trade.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_id |
String! |
required | Market id |
outcome_side |
OutcomeSide! |
required | yes / no |
side |
Side! |
required | buy / sell |
shares |
Float! |
required | Share quantity |
wallet_id |
String |
optional | Settlement wallet (default main) |
Response
| Field | Type | Description |
|---|---|---|
order_id |
String! |
Stable order id |
user_id |
String! |
Owning user id |
side |
Side! |
buy / sell |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
status |
OrderStatus! |
new / pending / completed / cancelled / rejected / expired |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
price |
Float |
Order price (nullable) |
shares |
Float! |
Requested shares |
version |
Int! |
Optimistic-lock version |
wallet_id |
String! |
Settlement wallet — lazy @ResolveField |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation create_order($market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!, $wallet_id: String) {
create_order(market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares, wallet_id: $wallet_id) {
order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation create_order($market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!, $wallet_id: String) { create_order(market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares, wallet_id: $wallet_id) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation create_order($market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!, $wallet_id: String) { create_order(market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares, wallet_id: $wallet_id) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation create_order($market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!, $wallet_id: String) { create_order(market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares, wallet_id: $wallet_id) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query open_orders The caller's currently open orders.
view_own_orders.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset |
date_range |
DateRangeInput |
optional | created_at window |
user_id |
String |
optional | Admin-only cross-user filter |
market_id |
String |
optional | Filter by market |
side |
Side |
optional | buy / sell |
status |
OrderStatus |
optional | Filter by status |
Response
| Field | Type | Description |
|---|---|---|
order_id |
String! |
Stable order id |
user_id |
String! |
Owning user id |
side |
Side! |
buy / sell |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
status |
OrderStatus! |
new / pending / completed / cancelled / rejected / expired |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
price |
Float |
Order price (nullable) |
shares |
Float! |
Requested shares |
version |
Int! |
Optimistic-lock version |
wallet_id |
String! |
Settlement wallet — lazy @ResolveField |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query open_orders($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $side: Side, $status: OrderStatus) {
open_orders(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, side: $side, status: $status) {
order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query open_orders($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $side: Side, $status: OrderStatus) { open_orders(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, side: $side, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query open_orders($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $side: Side, $status: OrderStatus) { open_orders(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, side: $side, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query open_orders($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $side: Side, $status: OrderStatus) { open_orders(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, side: $side, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query closed_orders The caller's completed / cancelled / rejected orders.
view_own_orders.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset |
date_range |
DateRangeInput |
optional | created_at window |
user_id |
String |
optional | Admin-only cross-user filter |
market_id |
String |
optional | Filter by market |
side |
Side |
optional | buy / sell |
status |
OrderStatus |
optional | Filter by status |
Response
| Field | Type | Description |
|---|---|---|
order_id |
String! |
Stable order id |
user_id |
String! |
Owning user id |
side |
Side! |
buy / sell |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
status |
OrderStatus! |
new / pending / completed / cancelled / rejected / expired |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
price |
Float |
Order price (nullable) |
shares |
Float! |
Requested shares |
version |
Int! |
Optimistic-lock version |
wallet_id |
String! |
Settlement wallet — lazy @ResolveField |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query closed_orders($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $side: Side, $status: OrderStatus) {
closed_orders(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, side: $side, status: $status) {
order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query closed_orders($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $side: Side, $status: OrderStatus) { closed_orders(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, side: $side, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query closed_orders($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $side: Side, $status: OrderStatus) { closed_orders(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, side: $side, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query closed_orders($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $side: Side, $status: OrderStatus) { closed_orders(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, side: $side, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query order A single order by id (traders may only read their own).
view_own_orders.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
order_id |
String! |
required | Order id |
Response
| Field | Type | Description |
|---|---|---|
order_id |
String! |
Stable order id |
user_id |
String! |
Owning user id |
side |
Side! |
buy / sell |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
status |
OrderStatus! |
new / pending / completed / cancelled / rejected / expired |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
price |
Float |
Order price (nullable) |
shares |
Float! |
Requested shares |
version |
Int! |
Optimistic-lock version |
wallet_id |
String! |
Settlement wallet — lazy @ResolveField |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query order($order_id: String!) {
order(order_id: $order_id) {
order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query order($order_id: String!) { order(order_id: $order_id) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query order($order_id: String!) { order(order_id: $order_id) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query order($order_id: String!) { order(order_id: $order_id) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Trades
The caller's executed fills.
query trades Paginated list of the caller's trades (fills).
view_own_trades.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset |
date_range |
DateRangeInput |
optional | created_at window |
user_id |
String |
optional | Admin-only cross-user filter |
market_id |
String |
optional | Filter by market |
order_id |
String |
optional | Filter by order |
Response
| Field | Type | Description |
|---|---|---|
trade_id |
String! |
Stable trade (fill) id |
user_id |
String! |
Owning user id |
currency_id |
String! |
Settlement currency |
shares |
Float! |
Shares filled |
price |
Float! |
Fill price |
order_id |
String! |
Parent order id |
market_id |
String! |
Market id |
side |
Side! |
buy / sell |
outcome_side |
OutcomeSide! |
yes / no |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query trades($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $order_id: String) {
trades(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, order_id: $order_id) {
trade_id user_id currency_id shares price order_id market_id side outcome_side created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query trades($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $order_id: String) { trades(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, order_id: $order_id) { trade_id user_id currency_id shares price order_id market_id side outcome_side created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query trades($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $order_id: String) { trades(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, order_id: $order_id) { trade_id user_id currency_id shares price order_id market_id side outcome_side created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query trades($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $order_id: String) { trades(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, order_id: $order_id) { trade_id user_id currency_id shares price order_id market_id side outcome_side created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query trade A single trade by id.
view_own_trades.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
trade_id |
String! |
required | Trade id |
Response
| Field | Type | Description |
|---|---|---|
trade_id |
String! |
Stable trade (fill) id |
user_id |
String! |
Owning user id |
currency_id |
String! |
Settlement currency |
shares |
Float! |
Shares filled |
price |
Float! |
Fill price |
order_id |
String! |
Parent order id |
market_id |
String! |
Market id |
side |
Side! |
buy / sell |
outcome_side |
OutcomeSide! |
yes / no |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query trade($trade_id: String!) {
trade(trade_id: $trade_id) {
trade_id user_id currency_id shares price order_id market_id side outcome_side created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query trade($trade_id: String!) { trade(trade_id: $trade_id) { trade_id user_id currency_id shares price order_id market_id side outcome_side created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query trade($trade_id: String!) { trade(trade_id: $trade_id) { trade_id user_id currency_id shares price order_id market_id side outcome_side created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query trade($trade_id: String!) { trade(trade_id: $trade_id) { trade_id user_id currency_id shares price order_id market_id side outcome_side created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Positions
The caller's holdings per market outcome, plus aggregate stats.
query user_positions Paginated list of the caller's positions.
view_own_positions.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset |
date_range |
DateRangeInput |
optional | created_at window |
user_id |
String |
optional | Admin-only cross-user filter |
market_id |
String |
optional | Filter by market |
currency_id |
String |
optional | Filter by currency |
outcome_side |
OutcomeSide |
optional | yes / no |
wallet_id |
String |
optional | Filter by wallet |
status |
PositionStatus |
optional | Filter by status |
Response
| Field | Type | Description |
|---|---|---|
position_id |
String! |
Stable position id |
user_id |
String! |
Owning user id |
currency_id |
String! |
Settlement currency |
shares |
Float! |
Net shares held |
avg_price |
Float! |
Average entry price |
realized_pnl |
Float! |
Realized profit / loss |
status |
PositionStatus! |
pending / active / pending_payout / completed / rejected |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
wallet_id |
String! |
Settlement wallet |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query user_positions($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $currency_id: String, $outcome_side: OutcomeSide, $wallet_id: String, $status: PositionStatus) {
user_positions(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, currency_id: $currency_id, outcome_side: $outcome_side, wallet_id: $wallet_id, status: $status) {
position_id user_id currency_id shares avg_price realized_pnl status market_id outcome_side wallet_id created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query user_positions($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $currency_id: String, $outcome_side: OutcomeSide, $wallet_id: String, $status: PositionStatus) { user_positions(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, currency_id: $currency_id, outcome_side: $outcome_side, wallet_id: $wallet_id, status: $status) { position_id user_id currency_id shares avg_price realized_pnl status market_id outcome_side wallet_id created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query user_positions($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $currency_id: String, $outcome_side: OutcomeSide, $wallet_id: String, $status: PositionStatus) { user_positions(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, currency_id: $currency_id, outcome_side: $outcome_side, wallet_id: $wallet_id, status: $status) { position_id user_id currency_id shares avg_price realized_pnl status market_id outcome_side wallet_id created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query user_positions($pager: PagerInput, $date_range: DateRangeInput, $user_id: String, $market_id: String, $currency_id: String, $outcome_side: OutcomeSide, $wallet_id: String, $status: PositionStatus) { user_positions(pager: $pager, date_range: $date_range, user_id: $user_id, market_id: $market_id, currency_id: $currency_id, outcome_side: $outcome_side, wallet_id: $wallet_id, status: $status) { position_id user_id currency_id shares avg_price realized_pnl status market_id outcome_side wallet_id created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query user_position A single position by id.
view_own_positions.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
position_id |
String! |
required | Position id |
Response
| Field | Type | Description |
|---|---|---|
position_id |
String! |
Stable position id |
user_id |
String! |
Owning user id |
currency_id |
String! |
Settlement currency |
shares |
Float! |
Net shares held |
avg_price |
Float! |
Average entry price |
realized_pnl |
Float! |
Realized profit / loss |
status |
PositionStatus! |
pending / active / pending_payout / completed / rejected |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
wallet_id |
String! |
Settlement wallet |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query user_position($position_id: String!) {
user_position(position_id: $position_id) {
position_id user_id currency_id shares avg_price realized_pnl status market_id outcome_side wallet_id created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query user_position($position_id: String!) { user_position(position_id: $position_id) { position_id user_id currency_id shares avg_price realized_pnl status market_id outcome_side wallet_id created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query user_position($position_id: String!) { user_position(position_id: $position_id) { position_id user_id currency_id shares avg_price realized_pnl status market_id outcome_side wallet_id created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query user_position($position_id: String!) { user_position(position_id: $position_id) { position_id user_id currency_id shares avg_price realized_pnl status market_id outcome_side wallet_id created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query user_positions_stats Aggregate stats across the caller's positions.
view_own_positions.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
user_id |
String |
optional | Admin-only cross-user filter |
market_id |
String |
optional | Filter by market |
currency_id |
String |
optional | Filter by currency |
outcome_side |
OutcomeSide |
optional | yes / no |
wallet_id |
String |
optional | Filter by wallet |
status |
PositionStatus |
optional | Filter by status |
Response
| Field | Type | Description |
|---|---|---|
total_positions |
Int! |
Count of positions |
total_shares |
Float! |
Sum of shares held |
total_invested |
Float! |
Total cost basis |
total_realized_pnl |
Float! |
Total realized P&L |
GraphQL Operation
query user_positions_stats($user_id: String, $market_id: String, $currency_id: String, $outcome_side: OutcomeSide, $wallet_id: String, $status: PositionStatus) {
user_positions_stats(user_id: $user_id, market_id: $market_id, currency_id: $currency_id, outcome_side: $outcome_side, wallet_id: $wallet_id, status: $status) {
total_positions total_shares total_invested total_realized_pnl
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query user_positions_stats($user_id: String, $market_id: String, $currency_id: String, $outcome_side: OutcomeSide, $wallet_id: String, $status: PositionStatus) { user_positions_stats(user_id: $user_id, market_id: $market_id, currency_id: $currency_id, outcome_side: $outcome_side, wallet_id: $wallet_id, status: $status) { total_positions total_shares total_invested total_realized_pnl } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query user_positions_stats($user_id: String, $market_id: String, $currency_id: String, $outcome_side: OutcomeSide, $wallet_id: String, $status: PositionStatus) { user_positions_stats(user_id: $user_id, market_id: $market_id, currency_id: $currency_id, outcome_side: $outcome_side, wallet_id: $wallet_id, status: $status) { total_positions total_shares total_invested total_realized_pnl } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query user_positions_stats($user_id: String, $market_id: String, $currency_id: String, $outcome_side: OutcomeSide, $wallet_id: String, $status: PositionStatus) { user_positions_stats(user_id: $user_id, market_id: $market_id, currency_id: $currency_id, outcome_side: $outcome_side, wallet_id: $wallet_id, status: $status) { total_positions total_shares total_invested total_realized_pnl } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Transactions
The caller's prediction-market ledger entries (trades, fees, rewards).
query vako_transactions Paginated list of the caller's account transactions.
view_own_transactions.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
transaction_id |
String |
optional | Exact transaction id |
user_id |
String |
optional | Admin-only cross-user filter |
currency_id |
String |
optional | Filter by currency |
wallet_id |
String |
optional | Filter by wallet |
type |
AccountTransactionType |
optional | debit / credit |
order_id |
String |
optional | Filter by order |
position_id |
String |
optional | Filter by position |
transaction_class |
AccountTransactionClass |
optional | trade / reward / fee |
approval_status |
ApprovalStatus |
optional | pending / approved / rejected |
approved_by |
String |
optional | Filter by approver |
version |
Int |
optional | Filter by version |
pager |
PagerInput |
optional | Limit / offset |
date_range |
DateRangeInput |
optional | created_at window |
sort |
SortInput |
optional | Sort property / direction |
Response
| Field | Type | Description |
|---|---|---|
transaction_id |
String! |
Stable transaction id |
user_id |
String! |
Owning user id |
currency_id |
String! |
Settlement currency |
wallet_id |
String! |
Wallet id |
type |
AccountTransactionType! |
debit / credit |
order_id |
String |
Related order (nullable) |
position_id |
String |
Related position (nullable) |
transaction_class |
AccountTransactionClass! |
trade / reward / fee |
amount |
Float! |
Signed amount |
status |
VakoTransactionStatus! |
pending / completed / failed |
approval_status |
ApprovalStatus |
pending / approved / rejected (nullable) |
approved_by |
String |
Approver id (nullable) |
error_message |
String |
Failure reason (nullable) |
version |
Int! |
Optimistic-lock version |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query vako_transactions($transaction_id: String, $user_id: String, $currency_id: String, $wallet_id: String, $type: AccountTransactionType, $order_id: String, $position_id: String, $transaction_class: AccountTransactionClass, $approval_status: ApprovalStatus, $approved_by: String, $version: Int, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput) {
vako_transactions(transaction_id: $transaction_id, user_id: $user_id, currency_id: $currency_id, wallet_id: $wallet_id, type: $type, order_id: $order_id, position_id: $position_id, transaction_class: $transaction_class, approval_status: $approval_status, approved_by: $approved_by, version: $version, pager: $pager, date_range: $date_range, sort: $sort) {
transaction_id user_id currency_id wallet_id type order_id position_id transaction_class amount status approval_status approved_by error_message version created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query vako_transactions($transaction_id: String, $user_id: String, $currency_id: String, $wallet_id: String, $type: AccountTransactionType, $order_id: String, $position_id: String, $transaction_class: AccountTransactionClass, $approval_status: ApprovalStatus, $approved_by: String, $version: Int, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput) { vako_transactions(transaction_id: $transaction_id, user_id: $user_id, currency_id: $currency_id, wallet_id: $wallet_id, type: $type, order_id: $order_id, position_id: $position_id, transaction_class: $transaction_class, approval_status: $approval_status, approved_by: $approved_by, version: $version, pager: $pager, date_range: $date_range, sort: $sort) { transaction_id user_id currency_id wallet_id type order_id position_id transaction_class amount status approval_status approved_by error_message version created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query vako_transactions($transaction_id: String, $user_id: String, $currency_id: String, $wallet_id: String, $type: AccountTransactionType, $order_id: String, $position_id: String, $transaction_class: AccountTransactionClass, $approval_status: ApprovalStatus, $approved_by: String, $version: Int, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput) { vako_transactions(transaction_id: $transaction_id, user_id: $user_id, currency_id: $currency_id, wallet_id: $wallet_id, type: $type, order_id: $order_id, position_id: $position_id, transaction_class: $transaction_class, approval_status: $approval_status, approved_by: $approved_by, version: $version, pager: $pager, date_range: $date_range, sort: $sort) { transaction_id user_id currency_id wallet_id type order_id position_id transaction_class amount status approval_status approved_by error_message version created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query vako_transactions($transaction_id: String, $user_id: String, $currency_id: String, $wallet_id: String, $type: AccountTransactionType, $order_id: String, $position_id: String, $transaction_class: AccountTransactionClass, $approval_status: ApprovalStatus, $approved_by: String, $version: Int, $pager: PagerInput, $date_range: DateRangeInput, $sort: SortInput) { vako_transactions(transaction_id: $transaction_id, user_id: $user_id, currency_id: $currency_id, wallet_id: $wallet_id, type: $type, order_id: $order_id, position_id: $position_id, transaction_class: $transaction_class, approval_status: $approval_status, approved_by: $approved_by, version: $version, pager: $pager, date_range: $date_range, sort: $sort) { transaction_id user_id currency_id wallet_id type order_id position_id transaction_class amount status approval_status approved_by error_message version created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Markets & Events Admin
Admin maintenance for the market/event category taxonomy.
mutation recompute_categories Re-derive every event's categories from its stored tags and rebuild counts.
recompute_categories.Inputs
This operation takes no arguments.
Response
| Field | Type | Description |
|---|---|---|
total |
Int! |
Events examined |
updated |
Int! |
Events whose category changed |
uncategorized_active |
Int! |
Active events left as other |
GraphQL Operation
mutation recompute_categories {
recompute_categories {
total updated uncategorized_active
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation recompute_categories { recompute_categories { total updated uncategorized_active } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation recompute_categories { recompute_categories { total updated uncategorized_active } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation recompute_categories { recompute_categories { total updated uncategorized_active } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Order Management
Admin-only order overrides.
mutation update_order Update an order's fields (admin override).
update_order.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
order_id |
String! |
required | Order id |
price |
Float |
optional | New price |
shares |
Float |
optional | New share quantity |
executed_quantity |
Float |
optional | Executed quantity |
remaining_quantity |
Float |
optional | Remaining quantity |
status |
OrderStatus |
optional | New status |
Response
| Field | Type | Description |
|---|---|---|
order_id |
String! |
Stable order id |
user_id |
String! |
Owning user id |
side |
Side! |
buy / sell |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
status |
OrderStatus! |
new / pending / completed / cancelled / rejected / expired |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
price |
Float |
Order price (nullable) |
shares |
Float! |
Requested shares |
version |
Int! |
Optimistic-lock version |
wallet_id |
String! |
Settlement wallet — lazy @ResolveField |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation update_order($order_id: String!, $price: Float, $shares: Float, $executed_quantity: Float, $remaining_quantity: Float, $status: OrderStatus) {
update_order(order_id: $order_id, price: $price, shares: $shares, executed_quantity: $executed_quantity, remaining_quantity: $remaining_quantity, status: $status) {
order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation update_order($order_id: String!, $price: Float, $shares: Float, $executed_quantity: Float, $remaining_quantity: Float, $status: OrderStatus) { update_order(order_id: $order_id, price: $price, shares: $shares, executed_quantity: $executed_quantity, remaining_quantity: $remaining_quantity, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation update_order($order_id: String!, $price: Float, $shares: Float, $executed_quantity: Float, $remaining_quantity: Float, $status: OrderStatus) { update_order(order_id: $order_id, price: $price, shares: $shares, executed_quantity: $executed_quantity, remaining_quantity: $remaining_quantity, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation update_order($order_id: String!, $price: Float, $shares: Float, $executed_quantity: Float, $remaining_quantity: Float, $status: OrderStatus) { update_order(order_id: $order_id, price: $price, shares: $shares, executed_quantity: $executed_quantity, remaining_quantity: $remaining_quantity, status: $status) { order_id user_id side market_id outcome_side status executed_quantity remaining_quantity price shares version wallet_id created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation cancel_order Cancel an order with a reason (admin override).
cancel_order.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
order_id |
String! |
required | Order id |
reason |
String! |
required | Cancellation reason |
Response
Returns Boolean! — true on success; failures surface in the GraphQL errors array.
GraphQL Operation
mutation cancel_order($order_id: String!, $reason: String!) {
cancel_order(order_id: $order_id, reason: $reason)
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation cancel_order($order_id: String!, $reason: String!) { cancel_order(order_id: $order_id, reason: $reason) }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation cancel_order($order_id: String!, $reason: String!) { cancel_order(order_id: $order_id, reason: $reason) }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation cancel_order($order_id: String!, $reason: String!) { cancel_order(order_id: $order_id, reason: $reason) }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Market Venues
CRUD over the venues/adapters (Kalshi, Polymarket, local, v4) the gateway trades against.
query market_venues Paginated, filterable list of market venues.
market_venues.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset |
date_range |
DateRangeInput |
optional | created_at window |
market_venue_id |
String |
optional | Exact venue id |
search |
String |
optional | Text match on name |
venue_kind |
VenueKind |
optional | kalshi / polymarket / local / v4 |
mode |
MarketVenueMode |
optional | stp / bbook |
is_active |
ToggleSwitch |
optional | on / off |
hedging_enabled |
ToggleSwitch |
optional | on / off |
Response
| Field | Type | Description |
|---|---|---|
market_venue_id |
String! |
Stable venue id |
venue_name |
String! |
Display name |
venue_kind |
VenueKind! |
kalshi / polymarket / local / v4 |
service_url |
String |
Adapter base URL (nullable) |
service_api_key |
String |
Adapter API key (nullable, sensitive) |
broker_user_id |
String |
Linked broker user (nullable) |
mode |
MarketVenueMode! |
stp / bbook |
is_active |
ToggleSwitch! |
on / off |
hedging_enabled |
ToggleSwitch! |
on / off |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query market_venues($pager: PagerInput, $date_range: DateRangeInput, $market_venue_id: String, $search: String, $venue_kind: VenueKind, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch) {
market_venues(pager: $pager, date_range: $date_range, market_venue_id: $market_venue_id, search: $search, venue_kind: $venue_kind, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled) {
market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query market_venues($pager: PagerInput, $date_range: DateRangeInput, $market_venue_id: String, $search: String, $venue_kind: VenueKind, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch) { market_venues(pager: $pager, date_range: $date_range, market_venue_id: $market_venue_id, search: $search, venue_kind: $venue_kind, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query market_venues($pager: PagerInput, $date_range: DateRangeInput, $market_venue_id: String, $search: String, $venue_kind: VenueKind, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch) { market_venues(pager: $pager, date_range: $date_range, market_venue_id: $market_venue_id, search: $search, venue_kind: $venue_kind, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query market_venues($pager: PagerInput, $date_range: DateRangeInput, $market_venue_id: String, $search: String, $venue_kind: VenueKind, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch) { market_venues(pager: $pager, date_range: $date_range, market_venue_id: $market_venue_id, search: $search, venue_kind: $venue_kind, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query market_venue A single venue by id.
market_venues.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_venue_id |
String! |
required | Venue id |
Response
| Field | Type | Description |
|---|---|---|
market_venue_id |
String! |
Stable venue id |
venue_name |
String! |
Display name |
venue_kind |
VenueKind! |
kalshi / polymarket / local / v4 |
service_url |
String |
Adapter base URL (nullable) |
service_api_key |
String |
Adapter API key (nullable, sensitive) |
broker_user_id |
String |
Linked broker user (nullable) |
mode |
MarketVenueMode! |
stp / bbook |
is_active |
ToggleSwitch! |
on / off |
hedging_enabled |
ToggleSwitch! |
on / off |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query market_venue($market_venue_id: String!) {
market_venue(market_venue_id: $market_venue_id) {
market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query market_venue($market_venue_id: String!) { market_venue(market_venue_id: $market_venue_id) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query market_venue($market_venue_id: String!) { market_venue(market_venue_id: $market_venue_id) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query market_venue($market_venue_id: String!) { market_venue(market_venue_id: $market_venue_id) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation create_market_venue Create a market venue.
create_market_venue.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
venue_name |
String! |
required | Display name (1–100) |
venue_kind |
VenueKind! |
required | kalshi / polymarket / local / v4 |
service_url |
String |
optional | Adapter base URL |
service_api_key |
String |
optional | Adapter API key |
broker_user_id |
String |
optional | Linked broker user |
mode |
MarketVenueMode |
optional | stp / bbook |
is_active |
ToggleSwitch |
optional | on / off |
hedging_enabled |
ToggleSwitch |
optional | on / off |
meta |
String |
optional | JSON metadata |
Response
| Field | Type | Description |
|---|---|---|
market_venue_id |
String! |
Stable venue id |
venue_name |
String! |
Display name |
venue_kind |
VenueKind! |
kalshi / polymarket / local / v4 |
service_url |
String |
Adapter base URL (nullable) |
service_api_key |
String |
Adapter API key (nullable, sensitive) |
broker_user_id |
String |
Linked broker user (nullable) |
mode |
MarketVenueMode! |
stp / bbook |
is_active |
ToggleSwitch! |
on / off |
hedging_enabled |
ToggleSwitch! |
on / off |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation create_market_venue($venue_name: String!, $venue_kind: VenueKind!, $service_url: String, $service_api_key: String, $broker_user_id: String, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch, $meta: String) {
create_market_venue(venue_name: $venue_name, venue_kind: $venue_kind, service_url: $service_url, service_api_key: $service_api_key, broker_user_id: $broker_user_id, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled, meta: $meta) {
market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation create_market_venue($venue_name: String!, $venue_kind: VenueKind!, $service_url: String, $service_api_key: String, $broker_user_id: String, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch, $meta: String) { create_market_venue(venue_name: $venue_name, venue_kind: $venue_kind, service_url: $service_url, service_api_key: $service_api_key, broker_user_id: $broker_user_id, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled, meta: $meta) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation create_market_venue($venue_name: String!, $venue_kind: VenueKind!, $service_url: String, $service_api_key: String, $broker_user_id: String, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch, $meta: String) { create_market_venue(venue_name: $venue_name, venue_kind: $venue_kind, service_url: $service_url, service_api_key: $service_api_key, broker_user_id: $broker_user_id, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled, meta: $meta) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation create_market_venue($venue_name: String!, $venue_kind: VenueKind!, $service_url: String, $service_api_key: String, $broker_user_id: String, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch, $meta: String) { create_market_venue(venue_name: $venue_name, venue_kind: $venue_kind, service_url: $service_url, service_api_key: $service_api_key, broker_user_id: $broker_user_id, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled, meta: $meta) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation update_market_venue Update a market venue.
update_market_venue.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_venue_id |
String! |
required | Venue id |
venue_name |
String |
optional | Display name (1–100) |
service_url |
String |
optional | Adapter base URL |
service_api_key |
String |
optional | Adapter API key |
broker_user_id |
String |
optional | Linked broker user |
mode |
MarketVenueMode |
optional | stp / bbook |
is_active |
ToggleSwitch |
optional | on / off |
hedging_enabled |
ToggleSwitch |
optional | on / off |
meta |
String |
optional | JSON metadata |
Response
| Field | Type | Description |
|---|---|---|
market_venue_id |
String! |
Stable venue id |
venue_name |
String! |
Display name |
venue_kind |
VenueKind! |
kalshi / polymarket / local / v4 |
service_url |
String |
Adapter base URL (nullable) |
service_api_key |
String |
Adapter API key (nullable, sensitive) |
broker_user_id |
String |
Linked broker user (nullable) |
mode |
MarketVenueMode! |
stp / bbook |
is_active |
ToggleSwitch! |
on / off |
hedging_enabled |
ToggleSwitch! |
on / off |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation update_market_venue($market_venue_id: String!, $venue_name: String, $service_url: String, $service_api_key: String, $broker_user_id: String, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch, $meta: String) {
update_market_venue(market_venue_id: $market_venue_id, venue_name: $venue_name, service_url: $service_url, service_api_key: $service_api_key, broker_user_id: $broker_user_id, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled, meta: $meta) {
market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation update_market_venue($market_venue_id: String!, $venue_name: String, $service_url: String, $service_api_key: String, $broker_user_id: String, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch, $meta: String) { update_market_venue(market_venue_id: $market_venue_id, venue_name: $venue_name, service_url: $service_url, service_api_key: $service_api_key, broker_user_id: $broker_user_id, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled, meta: $meta) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation update_market_venue($market_venue_id: String!, $venue_name: String, $service_url: String, $service_api_key: String, $broker_user_id: String, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch, $meta: String) { update_market_venue(market_venue_id: $market_venue_id, venue_name: $venue_name, service_url: $service_url, service_api_key: $service_api_key, broker_user_id: $broker_user_id, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled, meta: $meta) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation update_market_venue($market_venue_id: String!, $venue_name: String, $service_url: String, $service_api_key: String, $broker_user_id: String, $mode: MarketVenueMode, $is_active: ToggleSwitch, $hedging_enabled: ToggleSwitch, $meta: String) { update_market_venue(market_venue_id: $market_venue_id, venue_name: $venue_name, service_url: $service_url, service_api_key: $service_api_key, broker_user_id: $broker_user_id, mode: $mode, is_active: $is_active, hedging_enabled: $hedging_enabled, meta: $meta) { market_venue_id venue_name venue_kind service_url broker_user_id mode is_active hedging_enabled meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation delete_market_venue Delete a market venue.
delete_market_venue.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
market_venue_id |
String! |
required | Venue id |
Response
Returns Boolean! — true on success; failures surface in the GraphQL errors array.
GraphQL Operation
mutation delete_market_venue($market_venue_id: String!) {
delete_market_venue(market_venue_id: $market_venue_id)
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation delete_market_venue($market_venue_id: String!) { delete_market_venue(market_venue_id: $market_venue_id) }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation delete_market_venue($market_venue_id: String!) { delete_market_venue(market_venue_id: $market_venue_id) }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation delete_market_venue($market_venue_id: String!) { delete_market_venue(market_venue_id: $market_venue_id) }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Limit Groups
Prediction limit groups gate trading by KYC status, and are assigned to users.
query prediction_limit_groups Paginated, filterable list of limit groups (with total).
prediction_limit_groups.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset |
prediction_limit_group_id |
String |
optional | Exact group id |
search |
String |
optional | Text match on name |
kyc_status |
KycStatus |
optional | Required KYC status |
trading_enabled |
ToggleSwitch |
optional | on / off |
Response
| Field | Type | Description |
|---|---|---|
rows |
[PredictionLimitGroup!]! |
The page of groups |
total |
Int! |
Total groups matching the filter |
GraphQL Operation
query prediction_limit_groups($pager: PagerInput, $prediction_limit_group_id: String, $search: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch) {
prediction_limit_groups(pager: $pager, prediction_limit_group_id: $prediction_limit_group_id, search: $search, kyc_status: $kyc_status, trading_enabled: $trading_enabled) {
rows { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } total
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query prediction_limit_groups($pager: PagerInput, $prediction_limit_group_id: String, $search: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch) { prediction_limit_groups(pager: $pager, prediction_limit_group_id: $prediction_limit_group_id, search: $search, kyc_status: $kyc_status, trading_enabled: $trading_enabled) { rows { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } total } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query prediction_limit_groups($pager: PagerInput, $prediction_limit_group_id: String, $search: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch) { prediction_limit_groups(pager: $pager, prediction_limit_group_id: $prediction_limit_group_id, search: $search, kyc_status: $kyc_status, trading_enabled: $trading_enabled) { rows { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } total } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query prediction_limit_groups($pager: PagerInput, $prediction_limit_group_id: String, $search: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch) { prediction_limit_groups(pager: $pager, prediction_limit_group_id: $prediction_limit_group_id, search: $search, kyc_status: $kyc_status, trading_enabled: $trading_enabled) { rows { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } total } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query prediction_limit_group A single limit group by id.
prediction_limit_groups.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
prediction_limit_group_id |
String! |
required | Group id |
Response
| Field | Type | Description |
|---|---|---|
prediction_limit_group_id |
String! |
Stable group id |
name |
String! |
Group name |
description |
String |
Description (nullable) |
kyc_status |
KycStatus |
Required KYC status (nullable) |
trading_enabled |
ToggleSwitch! |
on / off |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query prediction_limit_group($prediction_limit_group_id: String!) {
prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id) {
prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query prediction_limit_group($prediction_limit_group_id: String!) { prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query prediction_limit_group($prediction_limit_group_id: String!) { prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query prediction_limit_group($prediction_limit_group_id: String!) { prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation create_prediction_limit_group Create a limit group.
create_prediction_limit_group.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
name |
String! |
required | Group name (1–100) |
description |
String |
optional | Description |
kyc_status |
KycStatus |
optional | Required KYC status |
trading_enabled |
ToggleSwitch |
optional | on / off |
meta |
String |
optional | JSON metadata |
Response
| Field | Type | Description |
|---|---|---|
prediction_limit_group_id |
String! |
Stable group id |
name |
String! |
Group name |
description |
String |
Description (nullable) |
kyc_status |
KycStatus |
Required KYC status (nullable) |
trading_enabled |
ToggleSwitch! |
on / off |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation create_prediction_limit_group($name: String!, $description: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch, $meta: String) {
create_prediction_limit_group(name: $name, description: $description, kyc_status: $kyc_status, trading_enabled: $trading_enabled, meta: $meta) {
prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation create_prediction_limit_group($name: String!, $description: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch, $meta: String) { create_prediction_limit_group(name: $name, description: $description, kyc_status: $kyc_status, trading_enabled: $trading_enabled, meta: $meta) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation create_prediction_limit_group($name: String!, $description: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch, $meta: String) { create_prediction_limit_group(name: $name, description: $description, kyc_status: $kyc_status, trading_enabled: $trading_enabled, meta: $meta) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation create_prediction_limit_group($name: String!, $description: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch, $meta: String) { create_prediction_limit_group(name: $name, description: $description, kyc_status: $kyc_status, trading_enabled: $trading_enabled, meta: $meta) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation update_prediction_limit_group Update a limit group.
update_prediction_limit_group.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
prediction_limit_group_id |
String! |
required | Group id |
name |
String |
optional | Group name (1–100) |
description |
String |
optional | Description |
kyc_status |
KycStatus |
optional | Required KYC status |
trading_enabled |
ToggleSwitch |
optional | on / off |
meta |
String |
optional | JSON metadata |
Response
| Field | Type | Description |
|---|---|---|
prediction_limit_group_id |
String! |
Stable group id |
name |
String! |
Group name |
description |
String |
Description (nullable) |
kyc_status |
KycStatus |
Required KYC status (nullable) |
trading_enabled |
ToggleSwitch! |
on / off |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation update_prediction_limit_group($prediction_limit_group_id: String!, $name: String, $description: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch, $meta: String) {
update_prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id, name: $name, description: $description, kyc_status: $kyc_status, trading_enabled: $trading_enabled, meta: $meta) {
prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation update_prediction_limit_group($prediction_limit_group_id: String!, $name: String, $description: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch, $meta: String) { update_prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id, name: $name, description: $description, kyc_status: $kyc_status, trading_enabled: $trading_enabled, meta: $meta) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation update_prediction_limit_group($prediction_limit_group_id: String!, $name: String, $description: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch, $meta: String) { update_prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id, name: $name, description: $description, kyc_status: $kyc_status, trading_enabled: $trading_enabled, meta: $meta) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation update_prediction_limit_group($prediction_limit_group_id: String!, $name: String, $description: String, $kyc_status: KycStatus, $trading_enabled: ToggleSwitch, $meta: String) { update_prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id, name: $name, description: $description, kyc_status: $kyc_status, trading_enabled: $trading_enabled, meta: $meta) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation delete_prediction_limit_group Delete a limit group.
delete_prediction_limit_group.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
prediction_limit_group_id |
String! |
required | Group id |
Response
Returns Boolean! — true on success; failures surface in the GraphQL errors array.
GraphQL Operation
mutation delete_prediction_limit_group($prediction_limit_group_id: String!) {
delete_prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id)
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation delete_prediction_limit_group($prediction_limit_group_id: String!) { delete_prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id) }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation delete_prediction_limit_group($prediction_limit_group_id: String!) { delete_prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id) }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation delete_prediction_limit_group($prediction_limit_group_id: String!) { delete_prediction_limit_group(prediction_limit_group_id: $prediction_limit_group_id) }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query user_prediction_limit_group The limit group assigned to a user.
prediction_limit_groups.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
user_id |
String! |
required | User id |
Response
| Field | Type | Description |
|---|---|---|
prediction_limit_group_id |
String! |
Stable group id |
name |
String! |
Group name |
description |
String |
Description (nullable) |
kyc_status |
KycStatus |
Required KYC status (nullable) |
trading_enabled |
ToggleSwitch! |
on / off |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query user_prediction_limit_group($user_id: String!) {
user_prediction_limit_group(user_id: $user_id) {
prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query user_prediction_limit_group($user_id: String!) { user_prediction_limit_group(user_id: $user_id) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query user_prediction_limit_group($user_id: String!) { user_prediction_limit_group(user_id: $user_id) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query user_prediction_limit_group($user_id: String!) { user_prediction_limit_group(user_id: $user_id) { prediction_limit_group_id name description kyc_status trading_enabled meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation assign_user_prediction_limit_group Assign a limit group to a user.
update_prediction_limit_group.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
user_id |
String! |
required | User id |
prediction_limit_group_id |
String! |
required | Group id |
Response
Returns Boolean! — true on success; failures surface in the GraphQL errors array.
GraphQL Operation
mutation assign_user_prediction_limit_group($user_id: String!, $prediction_limit_group_id: String!) {
assign_user_prediction_limit_group(user_id: $user_id, prediction_limit_group_id: $prediction_limit_group_id)
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation assign_user_prediction_limit_group($user_id: String!, $prediction_limit_group_id: String!) { assign_user_prediction_limit_group(user_id: $user_id, prediction_limit_group_id: $prediction_limit_group_id) }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation assign_user_prediction_limit_group($user_id: String!, $prediction_limit_group_id: String!) { assign_user_prediction_limit_group(user_id: $user_id, prediction_limit_group_id: $prediction_limit_group_id) }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation assign_user_prediction_limit_group($user_id: String!, $prediction_limit_group_id: String!) { assign_user_prediction_limit_group(user_id: $user_id, prediction_limit_group_id: $prediction_limit_group_id) }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Fee Groups
Prediction fee groups set taker fees (progressive + flat) and are assigned to users.
query prediction_fee_groups Paginated, filterable list of fee groups (with total).
prediction_fee_groups.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset |
prediction_fee_group_id |
String |
optional | Exact group id |
search |
String |
optional | Text match on name |
kyc_status |
KycStatus |
optional | Required KYC status |
Response
| Field | Type | Description |
|---|---|---|
rows |
[PredictionFeeGroup!]! |
The page of groups |
total |
Int! |
Total groups matching the filter |
GraphQL Operation
query prediction_fee_groups($pager: PagerInput, $prediction_fee_group_id: String, $search: String, $kyc_status: KycStatus) {
prediction_fee_groups(pager: $pager, prediction_fee_group_id: $prediction_fee_group_id, search: $search, kyc_status: $kyc_status) {
rows { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } total
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query prediction_fee_groups($pager: PagerInput, $prediction_fee_group_id: String, $search: String, $kyc_status: KycStatus) { prediction_fee_groups(pager: $pager, prediction_fee_group_id: $prediction_fee_group_id, search: $search, kyc_status: $kyc_status) { rows { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } total } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query prediction_fee_groups($pager: PagerInput, $prediction_fee_group_id: String, $search: String, $kyc_status: KycStatus) { prediction_fee_groups(pager: $pager, prediction_fee_group_id: $prediction_fee_group_id, search: $search, kyc_status: $kyc_status) { rows { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } total } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query prediction_fee_groups($pager: PagerInput, $prediction_fee_group_id: String, $search: String, $kyc_status: KycStatus) { prediction_fee_groups(pager: $pager, prediction_fee_group_id: $prediction_fee_group_id, search: $search, kyc_status: $kyc_status) { rows { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } total } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query prediction_fee_group A single fee group by id.
prediction_fee_groups.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
prediction_fee_group_id |
String! |
required | Group id |
Response
| Field | Type | Description |
|---|---|---|
prediction_fee_group_id |
String! |
Stable group id |
name |
String! |
Group name |
description |
String |
Description (nullable) |
beneficiary_user_id |
String |
Fee beneficiary user (nullable) |
kyc_status |
KycStatus |
Required KYC status (nullable) |
taker_progressive |
Float! |
Fraction of notional (0.01 = 1%) |
taker_flat |
Float! |
Flat fee per fill |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query prediction_fee_group($prediction_fee_group_id: String!) {
prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id) {
prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query prediction_fee_group($prediction_fee_group_id: String!) { prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query prediction_fee_group($prediction_fee_group_id: String!) { prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query prediction_fee_group($prediction_fee_group_id: String!) { prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation create_prediction_fee_group Create a fee group.
create_prediction_fee_group.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
name |
String! |
required | Group name (1–100) |
description |
String |
optional | Description |
beneficiary_user_id |
String |
optional | Fee beneficiary user |
kyc_status |
KycStatus |
optional | Required KYC status |
taker_progressive |
Float |
optional | Fraction of notional (0–1) |
taker_flat |
Float |
optional | Flat fee per fill (≥ 0) |
meta |
String |
optional | JSON metadata |
Response
| Field | Type | Description |
|---|---|---|
prediction_fee_group_id |
String! |
Stable group id |
name |
String! |
Group name |
description |
String |
Description (nullable) |
beneficiary_user_id |
String |
Fee beneficiary user (nullable) |
kyc_status |
KycStatus |
Required KYC status (nullable) |
taker_progressive |
Float! |
Fraction of notional (0.01 = 1%) |
taker_flat |
Float! |
Flat fee per fill |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation create_prediction_fee_group($name: String!, $description: String, $beneficiary_user_id: String, $kyc_status: KycStatus, $taker_progressive: Float, $taker_flat: Float, $meta: String) {
create_prediction_fee_group(name: $name, description: $description, beneficiary_user_id: $beneficiary_user_id, kyc_status: $kyc_status, taker_progressive: $taker_progressive, taker_flat: $taker_flat, meta: $meta) {
prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation create_prediction_fee_group($name: String!, $description: String, $beneficiary_user_id: String, $kyc_status: KycStatus, $taker_progressive: Float, $taker_flat: Float, $meta: String) { create_prediction_fee_group(name: $name, description: $description, beneficiary_user_id: $beneficiary_user_id, kyc_status: $kyc_status, taker_progressive: $taker_progressive, taker_flat: $taker_flat, meta: $meta) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation create_prediction_fee_group($name: String!, $description: String, $beneficiary_user_id: String, $kyc_status: KycStatus, $taker_progressive: Float, $taker_flat: Float, $meta: String) { create_prediction_fee_group(name: $name, description: $description, beneficiary_user_id: $beneficiary_user_id, kyc_status: $kyc_status, taker_progressive: $taker_progressive, taker_flat: $taker_flat, meta: $meta) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation create_prediction_fee_group($name: String!, $description: String, $beneficiary_user_id: String, $kyc_status: KycStatus, $taker_progressive: Float, $taker_flat: Float, $meta: String) { create_prediction_fee_group(name: $name, description: $description, beneficiary_user_id: $beneficiary_user_id, kyc_status: $kyc_status, taker_progressive: $taker_progressive, taker_flat: $taker_flat, meta: $meta) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation update_prediction_fee_group Update a fee group.
update_prediction_fee_group.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
prediction_fee_group_id |
String! |
required | Group id |
name |
String |
optional | Group name (1–100) |
description |
String |
optional | Description |
beneficiary_user_id |
String |
optional | Fee beneficiary user |
kyc_status |
KycStatus |
optional | Required KYC status |
taker_progressive |
Float |
optional | Fraction of notional (0–1) |
taker_flat |
Float |
optional | Flat fee per fill (≥ 0) |
meta |
String |
optional | JSON metadata |
Response
| Field | Type | Description |
|---|---|---|
prediction_fee_group_id |
String! |
Stable group id |
name |
String! |
Group name |
description |
String |
Description (nullable) |
beneficiary_user_id |
String |
Fee beneficiary user (nullable) |
kyc_status |
KycStatus |
Required KYC status (nullable) |
taker_progressive |
Float! |
Fraction of notional (0.01 = 1%) |
taker_flat |
Float! |
Flat fee per fill |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation update_prediction_fee_group($prediction_fee_group_id: String!, $name: String, $description: String, $beneficiary_user_id: String, $kyc_status: KycStatus, $taker_progressive: Float, $taker_flat: Float, $meta: String) {
update_prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id, name: $name, description: $description, beneficiary_user_id: $beneficiary_user_id, kyc_status: $kyc_status, taker_progressive: $taker_progressive, taker_flat: $taker_flat, meta: $meta) {
prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation update_prediction_fee_group($prediction_fee_group_id: String!, $name: String, $description: String, $beneficiary_user_id: String, $kyc_status: KycStatus, $taker_progressive: Float, $taker_flat: Float, $meta: String) { update_prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id, name: $name, description: $description, beneficiary_user_id: $beneficiary_user_id, kyc_status: $kyc_status, taker_progressive: $taker_progressive, taker_flat: $taker_flat, meta: $meta) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation update_prediction_fee_group($prediction_fee_group_id: String!, $name: String, $description: String, $beneficiary_user_id: String, $kyc_status: KycStatus, $taker_progressive: Float, $taker_flat: Float, $meta: String) { update_prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id, name: $name, description: $description, beneficiary_user_id: $beneficiary_user_id, kyc_status: $kyc_status, taker_progressive: $taker_progressive, taker_flat: $taker_flat, meta: $meta) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation update_prediction_fee_group($prediction_fee_group_id: String!, $name: String, $description: String, $beneficiary_user_id: String, $kyc_status: KycStatus, $taker_progressive: Float, $taker_flat: Float, $meta: String) { update_prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id, name: $name, description: $description, beneficiary_user_id: $beneficiary_user_id, kyc_status: $kyc_status, taker_progressive: $taker_progressive, taker_flat: $taker_flat, meta: $meta) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation delete_prediction_fee_group Delete a fee group.
delete_prediction_fee_group.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
prediction_fee_group_id |
String! |
required | Group id |
Response
Returns Boolean! — true on success; failures surface in the GraphQL errors array.
GraphQL Operation
mutation delete_prediction_fee_group($prediction_fee_group_id: String!) {
delete_prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id)
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation delete_prediction_fee_group($prediction_fee_group_id: String!) { delete_prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id) }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation delete_prediction_fee_group($prediction_fee_group_id: String!) { delete_prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id) }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation delete_prediction_fee_group($prediction_fee_group_id: String!) { delete_prediction_fee_group(prediction_fee_group_id: $prediction_fee_group_id) }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query user_prediction_fee_group The fee group assigned to a user.
prediction_fee_groups.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
user_id |
String! |
required | User id |
Response
| Field | Type | Description |
|---|---|---|
prediction_fee_group_id |
String! |
Stable group id |
name |
String! |
Group name |
description |
String |
Description (nullable) |
beneficiary_user_id |
String |
Fee beneficiary user (nullable) |
kyc_status |
KycStatus |
Required KYC status (nullable) |
taker_progressive |
Float! |
Fraction of notional (0.01 = 1%) |
taker_flat |
Float! |
Flat fee per fill |
meta |
String |
JSON metadata (nullable) |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query user_prediction_fee_group($user_id: String!) {
user_prediction_fee_group(user_id: $user_id) {
prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query user_prediction_fee_group($user_id: String!) { user_prediction_fee_group(user_id: $user_id) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query user_prediction_fee_group($user_id: String!) { user_prediction_fee_group(user_id: $user_id) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query user_prediction_fee_group($user_id: String!) { user_prediction_fee_group(user_id: $user_id) { prediction_fee_group_id name description beneficiary_user_id kyc_status taker_progressive taker_flat meta created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation assign_user_prediction_fee_group Assign a fee group to a user.
update_prediction_fee_group.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
user_id |
String! |
required | User id |
prediction_fee_group_id |
String! |
required | Group id |
Response
Returns Boolean! — true on success; failures surface in the GraphQL errors array.
GraphQL Operation
mutation assign_user_prediction_fee_group($user_id: String!, $prediction_fee_group_id: String!) {
assign_user_prediction_fee_group(user_id: $user_id, prediction_fee_group_id: $prediction_fee_group_id)
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation assign_user_prediction_fee_group($user_id: String!, $prediction_fee_group_id: String!) { assign_user_prediction_fee_group(user_id: $user_id, prediction_fee_group_id: $prediction_fee_group_id) }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation assign_user_prediction_fee_group($user_id: String!, $prediction_fee_group_id: String!) { assign_user_prediction_fee_group(user_id: $user_id, prediction_fee_group_id: $prediction_fee_group_id) }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation assign_user_prediction_fee_group($user_id: String!, $prediction_fee_group_id: String!) { assign_user_prediction_fee_group(user_id: $user_id, prediction_fee_group_id: $prediction_fee_group_id) }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Hedging
Hedging orders mirror client orders out to an external venue for risk offset.
query hedging_orders Paginated, filterable list of hedging orders.
hedging_orders.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
pager |
PagerInput |
optional | Limit / offset |
date_range |
DateRangeInput |
optional | created_at window |
order_id |
String |
optional | Filter by source order |
market_id |
String |
optional | Filter by market |
external_order_id |
String |
optional | Filter by venue order id |
side |
Side |
optional | buy / sell |
status |
HedgingOrderStatus |
optional | Filter by status |
Response
| Field | Type | Description |
|---|---|---|
hedging_order_id |
String! |
Stable hedging order id |
order_id |
String! |
Source (client) order id |
external_order_id |
String |
Venue order id (nullable) |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
side |
Side! |
buy / sell |
shares |
Float! |
Requested shares |
price |
Float |
Price (nullable) |
status |
HedgingOrderStatus! |
new / pending / completed / cancelled / rejected |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
error_message |
String |
Failure reason (nullable) |
meta |
String |
JSON metadata (nullable) |
version |
Int! |
Optimistic-lock version |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query hedging_orders($pager: PagerInput, $date_range: DateRangeInput, $order_id: String, $market_id: String, $external_order_id: String, $side: Side, $status: HedgingOrderStatus) {
hedging_orders(pager: $pager, date_range: $date_range, order_id: $order_id, market_id: $market_id, external_order_id: $external_order_id, side: $side, status: $status) {
hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query hedging_orders($pager: PagerInput, $date_range: DateRangeInput, $order_id: String, $market_id: String, $external_order_id: String, $side: Side, $status: HedgingOrderStatus) { hedging_orders(pager: $pager, date_range: $date_range, order_id: $order_id, market_id: $market_id, external_order_id: $external_order_id, side: $side, status: $status) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query hedging_orders($pager: PagerInput, $date_range: DateRangeInput, $order_id: String, $market_id: String, $external_order_id: String, $side: Side, $status: HedgingOrderStatus) { hedging_orders(pager: $pager, date_range: $date_range, order_id: $order_id, market_id: $market_id, external_order_id: $external_order_id, side: $side, status: $status) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query hedging_orders($pager: PagerInput, $date_range: DateRangeInput, $order_id: String, $market_id: String, $external_order_id: String, $side: Side, $status: HedgingOrderStatus) { hedging_orders(pager: $pager, date_range: $date_range, order_id: $order_id, market_id: $market_id, external_order_id: $external_order_id, side: $side, status: $status) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);query hedging_order A single hedging order by id.
hedging_orders.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
hedging_order_id |
String! |
required | Hedging order id |
Response
| Field | Type | Description |
|---|---|---|
hedging_order_id |
String! |
Stable hedging order id |
order_id |
String! |
Source (client) order id |
external_order_id |
String |
Venue order id (nullable) |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
side |
Side! |
buy / sell |
shares |
Float! |
Requested shares |
price |
Float |
Price (nullable) |
status |
HedgingOrderStatus! |
new / pending / completed / cancelled / rejected |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
error_message |
String |
Failure reason (nullable) |
meta |
String |
JSON metadata (nullable) |
version |
Int! |
Optimistic-lock version |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
query hedging_order($hedging_order_id: String!) {
hedging_order(hedging_order_id: $hedging_order_id) {
hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"query hedging_order($hedging_order_id: String!) { hedging_order(hedging_order_id: $hedging_order_id) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """query hedging_order($hedging_order_id: String!) { hedging_order(hedging_order_id: $hedging_order_id) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `query hedging_order($hedging_order_id: String!) { hedging_order(hedging_order_id: $hedging_order_id) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation create_hedging_order Create a hedging order.
create_hedging_order.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
order_id |
String! |
required | Source order id |
market_id |
String! |
required | Market id |
outcome_side |
OutcomeSide! |
required | yes / no |
side |
Side! |
required | buy / sell |
shares |
Float! |
required | Shares (≥ 0) |
price |
Float |
optional | Price (≥ 0) |
external_order_id |
String |
optional | Venue order id |
meta |
String |
optional | JSON metadata |
Response
| Field | Type | Description |
|---|---|---|
hedging_order_id |
String! |
Stable hedging order id |
order_id |
String! |
Source (client) order id |
external_order_id |
String |
Venue order id (nullable) |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
side |
Side! |
buy / sell |
shares |
Float! |
Requested shares |
price |
Float |
Price (nullable) |
status |
HedgingOrderStatus! |
new / pending / completed / cancelled / rejected |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
error_message |
String |
Failure reason (nullable) |
meta |
String |
JSON metadata (nullable) |
version |
Int! |
Optimistic-lock version |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation create_hedging_order($order_id: String!, $market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!, $price: Float, $external_order_id: String, $meta: String) {
create_hedging_order(order_id: $order_id, market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares, price: $price, external_order_id: $external_order_id, meta: $meta) {
hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation create_hedging_order($order_id: String!, $market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!, $price: Float, $external_order_id: String, $meta: String) { create_hedging_order(order_id: $order_id, market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares, price: $price, external_order_id: $external_order_id, meta: $meta) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation create_hedging_order($order_id: String!, $market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!, $price: Float, $external_order_id: String, $meta: String) { create_hedging_order(order_id: $order_id, market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares, price: $price, external_order_id: $external_order_id, meta: $meta) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation create_hedging_order($order_id: String!, $market_id: String!, $outcome_side: OutcomeSide!, $side: Side!, $shares: Float!, $price: Float, $external_order_id: String, $meta: String) { create_hedging_order(order_id: $order_id, market_id: $market_id, outcome_side: $outcome_side, side: $side, shares: $shares, price: $price, external_order_id: $external_order_id, meta: $meta) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);mutation update_hedging_order Update a hedging order (status / fills / error).
update_hedging_order.Inputs
| Name | Type | Required | Description |
|---|---|---|---|
hedging_order_id |
String! |
required | Hedging order id |
external_order_id |
String |
optional | Venue order id |
status |
HedgingOrderStatus |
optional | New status |
executed_quantity |
Float |
optional | Executed quantity (≥ 0) |
remaining_quantity |
Float |
optional | Remaining quantity (≥ 0) |
error_message |
String |
optional | Failure reason |
meta |
String |
optional | JSON metadata |
Response
| Field | Type | Description |
|---|---|---|
hedging_order_id |
String! |
Stable hedging order id |
order_id |
String! |
Source (client) order id |
external_order_id |
String |
Venue order id (nullable) |
market_id |
String! |
Market id |
outcome_side |
OutcomeSide! |
yes / no |
side |
Side! |
buy / sell |
shares |
Float! |
Requested shares |
price |
Float |
Price (nullable) |
status |
HedgingOrderStatus! |
new / pending / completed / cancelled / rejected |
executed_quantity |
Float! |
Shares filled |
remaining_quantity |
Float! |
Shares still open |
error_message |
String |
Failure reason (nullable) |
meta |
String |
JSON metadata (nullable) |
version |
Int! |
Optimistic-lock version |
created_at |
String! |
Create time |
updated_at |
String! |
Update time |
serial_id |
Int |
Internal row id (nullable) |
GraphQL Operation
mutation update_hedging_order($hedging_order_id: String!, $external_order_id: String, $status: HedgingOrderStatus, $executed_quantity: Float, $remaining_quantity: Float, $error_message: String, $meta: String) {
update_hedging_order(hedging_order_id: $hedging_order_id, external_order_id: $external_order_id, status: $status, executed_quantity: $executed_quantity, remaining_quantity: $remaining_quantity, error_message: $error_message, meta: $meta) {
hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at
}
}
Code Examples
curl -X POST 'http://localhost:3000/graphql' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"query":"mutation update_hedging_order($hedging_order_id: String!, $external_order_id: String, $status: HedgingOrderStatus, $executed_quantity: Float, $remaining_quantity: Float, $error_message: String, $meta: String) { update_hedging_order(hedging_order_id: $hedging_order_id, external_order_id: $external_order_id, status: $status, executed_quantity: $executed_quantity, remaining_quantity: $remaining_quantity, error_message: $error_message, meta: $meta) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }","variables":{}}'
import requests
url = "http://localhost:3000/graphql"
headers = {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json",
}
payload = {
"query": """mutation update_hedging_order($hedging_order_id: String!, $external_order_id: String, $status: HedgingOrderStatus, $executed_quantity: Float, $remaining_quantity: Float, $error_message: String, $meta: String) { update_hedging_order(hedging_order_id: $hedging_order_id, external_order_id: $external_order_id, status: $status, executed_quantity: $executed_quantity, remaining_quantity: $remaining_quantity, error_message: $error_message, meta: $meta) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }""",
"variables": {},
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const response = await fetch("http://localhost:3000/graphql", {
method: "POST",
headers: {
"Authorization": `Bearer ${YOUR_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: `mutation update_hedging_order($hedging_order_id: String!, $external_order_id: String, $status: HedgingOrderStatus, $executed_quantity: Float, $remaining_quantity: Float, $error_message: String, $meta: String) { update_hedging_order(hedging_order_id: $hedging_order_id, external_order_id: $external_order_id, status: $status, executed_quantity: $executed_quantity, remaining_quantity: $remaining_quantity, error_message: $error_message, meta: $meta) { hedging_order_id order_id external_order_id market_id outcome_side side shares price status executed_quantity remaining_quantity error_message meta version created_at updated_at } }`,
variables: {},
}),
});
const data = await response.json();
console.log(data);Real-Time (GraphQL Subscriptions)
Live order books and prices stream via GraphQL subscriptions
over the graphql-ws protocol on the same /graphql endpoint (WebSocket
upgrade). The individual subscription operations — orderbook,
markets_prices and market_price_history_updates — are documented in the
Order Book, Market Prices and
Price History groups above.
graphql-ws transport
Connect to ws://localhost:3000/graphql (use wss:// in production) with the
graphql-ws sub-protocol. These channels are public and rate-limited per IP
(30 ops / 60 s, with a 500 ms minimum gap between operations).
A bearer token may optionally be passed in connectionParams.Authorization; the gateway
forwards connectionParams as the connection's request headers.
Connect & subscribe (browser)
import { createClient } from "graphql-ws";\n\nconst client = createClient({\n url: "ws://localhost:3000/graphql",\n connectionParams: { Authorization: "Bearer YOUR_TOKEN" }, // optional\n});\n\nclient.subscribe(\n { query: `subscription { orderbook(market_external_id: "MKT-123", outcome_side: yes) { best_bid best_ask buy { price quantity } sell { price quantity } ts_iso } }` },\n { next: (m) => console.log(m.data), error: console.error, complete: () => {} },\n);
Raw protocol
The client sends a connection_init frame, then a subscribe frame
carrying the GraphQL document; the server streams next frames and a final
complete.
{ "id": "1", "type": "subscribe", "payload": { "query": "subscription { markets_prices(market_ids: [\\"MKT-123\\"]) { market_id yes { bid ask } no { bid ask } ts } }" } }