SPMC API Documentation
Welcome to the SPMC API documentation. This API provides access to prediction market data from multiple platforms including Polymarket, Kalshi, and Limitless.
Quick Start
All API endpoints are available at https://api.spmc.dev.
No authentication is required for public endpoints.
curl https://api.spmc.dev/api/v1/markets?limit=10
Base URL
https://api.spmc.dev/api/v1
Response Format
All responses are returned in JSON format with the following structure:
{
"data": [...],
"meta": {
"total": 100,
"page": 1,
"limit": 10
}
}
Authentication
Most endpoints are publicly accessible and do not require authentication. For endpoints that require authentication, include your API key in the request header:
curl -H "Authorization: Bearer YOUR_API_KEY" https://api.spmc.dev/api/v1/endpoint
Builder-Orders
/api/v1/builder-orders/
List Builder Orders
Retrieve builder orders with optional filtering. **Query Parameters:** - `group_id`: UUID of the group to filter by - `writer_id`: UUID of the writer to filter by - `page`: Page number (1-based) - `page_size`: Number of orders per page (1-100) **Note:** Only one of `group_id` or `writer_id` can be specified at a time. If neither is provided, returns a 400 error as this would be too broad.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
query | Optional | Filter by group ID |
writer_id |
string |
query | Optional | Filter by writer ID |
page |
integer |
query | Optional |
Page number
Default: 1
|
page_size |
integer |
query | Optional |
Items per page
Default: 50
|
Responses
Code Examples
Example GET request to /api/v1/builder-orders/
curl -X GET \
"https://api.spmc.dev/api/v1/builder-orders/" \
-H "Content-Type: application/json"
Fetch list builder orders
async function apiV1Builder-orders(group_id, writer_id, page, page_size) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/builder-orders/', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/builder-orders/:', error);
throw error;
}
}
Call list builder orders
import requests
from typing import Dict, Any, Optional
def apiV1Builder-orders(group_id, writer_id, page, page_size) -> Dict[str, Any]:
"""
List Builder Orders
Args:
group_id: Filter by group ID
writer_id: Filter by writer ID
page: Page number
page_size: Items per page
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/builder-orders/'
headers = {
"Content-Type": "application/json"
}
params = {
'group_id': group_id,
'writer_id': writer_id,
'page': page,
'page_size': page_size,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/builder-orders/: {e}')
raise
/api/v1/builder-orders/
Create Builder Order
Create a new builder order record. This endpoint records order metadata from the builder signing server for tracking order volume attribution to writers and groups over time. **Request Body:** ```json { "token_id": "32338220190071351435772801779725302244575775216413325951443816017994629993401", "side": "BUY", "order_volume": 1.0, "price": 0.99, "group_id": "6a2e8d58-622c-4c44-bb15-ab1e176a9891", "writer_id": "09ca3de3-0c38-40bd-b168-923742fa1d62", "request_path": "/api/orders/metadata", "request_method": "POST" } ``` **Validation:** - `token_id`: Required, non-empty string (accepts both decimal and hex formats) - `side`: Required, must be "BUY" or "SELL" - `order_volume`: Required, positive number - `price`: Optional, if provided must be between 0.01 and 0.99 - `group_id`: Optional, must exist in `unified.market_groups` if provided - `writer_id`: Optional, must exist in `pmf.authors` if provided - `request_path`: Required, non-empty string - `request_method`: Required, non-empty string
Request Body
Reference: #/components/schemas/BuilderOrderCreate
Responses
Code Examples
Example POST request to /api/v1/builder-orders/
curl -X POST \
"https://api.spmc.dev/api/v1/builder-orders/" \
-H "Content-Type: application/json"
Fetch create builder order
async function postApiV1Builder-orders() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/builder-orders/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/builder-orders/:', error);
throw error;
}
}
Call create builder order
import requests
from typing import Dict, Any, Optional
def postApiV1Builder-orders() -> Dict[str, Any]:
"""
Create Builder Order
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/builder-orders/'
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/builder-orders/: {e}')
raise
/api/v1/builder-orders/{order_id}
Get Builder Order
Retrieve a specific builder order by ID. **Path Parameters:** - `order_id`: UUID of the builder order
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
order_id |
string |
path | Required |
Responses
Code Examples
Example GET request to /api/v1/builder-orders/{order_id}
curl -X GET \
"https://api.spmc.dev/api/v1/builder-orders/example" \
-H "Content-Type: application/json"
Fetch get builder order
async function apiV1Builder-orders(order_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/builder-orders/example', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/builder-orders/{order_id}:', error);
throw error;
}
}
Call get builder order
import requests
from typing import Dict, Any, Optional
def apiV1Builder-orders(order_id) -> Dict[str, Any]:
"""
Get Builder Order
Args:
order_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/builder-orders/example'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/builder-orders/{order_id}: {e}')
raise
Groups
/api/v1/groups/
List Groups
List groups with filtering and pagination
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_type |
string |
query | Optional | Filter by group type |
is_template |
string |
query | Optional | Filter by template status |
is_system_generated |
string |
query | Optional | Filter by system generation status |
search |
string |
query | Optional | Search in title and description |
page |
integer |
query | Optional |
Page number
Default: 1
|
page_size |
integer |
query | Optional |
Items per page
Default: 50
|
Responses
Code Examples
Example GET request to /api/v1/groups/
curl -X GET \
"https://api.spmc.dev/api/v1/groups/" \
-H "Content-Type: application/json"
Fetch list groups
async function apiV1Groups(group_type, is_template, is_system_generated, search, page, page_size) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/:', error);
throw error;
}
}
Call list groups
import requests
from typing import Dict, Any, Optional
def apiV1Groups(group_type, is_template, is_system_generated, search, page, page_size) -> Dict[str, Any]:
"""
List Groups
Args:
group_type: Filter by group type
is_template: Filter by template status
is_system_generated: Filter by system generation status
search: Search in title and description
page: Page number
page_size: Items per page
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/'
headers = {
"Content-Type": "application/json"
}
params = {
'group_type': group_type,
'is_template': is_template,
'is_system_generated': is_system_generated,
'search': search,
'page': page,
'page_size': page_size,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/: {e}')
raise
/api/v1/groups/
Create Group
Create a new market group
Request Body
Reference: #/components/schemas/GroupCreate
Responses
Code Examples
Example POST request to /api/v1/groups/
curl -X POST \
"https://api.spmc.dev/api/v1/groups/" \
-H "Content-Type: application/json"
Fetch create group
async function postApiV1Groups() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/:', error);
throw error;
}
}
Call create group
import requests
from typing import Dict, Any, Optional
def postApiV1Groups() -> Dict[str, Any]:
"""
Create Group
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/'
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/: {e}')
raise
/api/v1/groups/from-template
Create From Template
Create a new group from a template
Request Body
Reference: #/components/schemas/TemplateInstantiate
Responses
Code Examples
Example POST request to /api/v1/groups/from-template
curl -X POST \
"https://api.spmc.dev/api/v1/groups/from-template" \
-H "Content-Type: application/json"
Fetch create from template
async function postApiV1GroupsFrom-template() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/from-template', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/from-template:', error);
throw error;
}
}
Call create from template
import requests
from typing import Dict, Any, Optional
def postApiV1GroupsFrom-template() -> Dict[str, Any]:
"""
Create From Template
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/from-template'
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/from-template: {e}')
raise
/api/v1/groups/resolve-polymarket
Resolve Polymarket Url
Resolve a Polymarket URL to get market options. This endpoint takes a Polymarket URL or condition ID and returns: - For single markets: The market details - For events: A list of all markets in the event **Example Request:** ```json { "url": "https://polymarket.com/event/us-x-venezuela-military-engagement-by-october-31" } ``` **Example Response (Event with multiple markets):** ```json { "type": "event", "event_title": "US x Venezuela military engagement by...?", "markets": [ { "condition_id": "0x...", "question": "by September 30?", "group_item_title": "September 30", "yes_token_id": "...", "no_token_id": "...", "active": true, "closed": false } ] } ```
Request Body
Responses
Code Examples
Example POST request to /api/v1/groups/resolve-polymarket
curl -X POST \
"https://api.spmc.dev/api/v1/groups/resolve-polymarket" \
-H "Content-Type: application/json"
Fetch resolve polymarket url
async function postApiV1GroupsResolve-polymarket() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/resolve-polymarket', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/resolve-polymarket:', error);
throw error;
}
}
Call resolve polymarket url
import requests
from typing import Dict, Any, Optional
def postApiV1GroupsResolve-polymarket() -> Dict[str, Any]:
"""
Resolve Polymarket Url
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/resolve-polymarket'
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/resolve-polymarket: {e}')
raise
/api/v1/groups/templates
List Templates
List available group templates
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_type |
string |
query | Optional | Filter by group type |
is_active |
boolean |
query | Optional |
Filter by active status
Default: True
|
tags |
string |
query | Optional | Filter by tags |
search |
string |
query | Optional | Search in name and description |
limit |
integer |
query | Optional |
Maximum results
Default: 100
|
offset |
integer |
query | Optional |
Pagination offset
Default: 0
|
Responses
Code Examples
Example GET request to /api/v1/groups/templates
curl -X GET \
"https://api.spmc.dev/api/v1/groups/templates" \
-H "Content-Type: application/json"
Fetch list templates
async function apiV1GroupsTemplates(group_type, is_active, tags, search, limit, offset) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/templates', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/templates:', error);
throw error;
}
}
Call list templates
import requests
from typing import Dict, Any, Optional
def apiV1GroupsTemplates(group_type, is_active, tags, search, limit, offset) -> Dict[str, Any]:
"""
List Templates
Args:
group_type: Filter by group type
is_active: Filter by active status
tags: Filter by tags
search: Search in name and description
limit: Maximum results
offset: Pagination offset
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/templates'
headers = {
"Content-Type": "application/json"
}
params = {
'group_type': group_type,
'is_active': is_active,
'tags': tags,
'search': search,
'limit': limit,
'offset': offset,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/templates: {e}')
raise
/api/v1/groups/templates
Create Template
Create a new template (admin only)
Request Body
Reference: #/components/schemas/TemplateCreate
Responses
Code Examples
Example POST request to /api/v1/groups/templates
curl -X POST \
"https://api.spmc.dev/api/v1/groups/templates" \
-H "Content-Type: application/json"
Fetch create template
async function postApiV1GroupsTemplates() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/templates', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/templates:', error);
throw error;
}
}
Call create template
import requests
from typing import Dict, Any, Optional
def postApiV1GroupsTemplates() -> Dict[str, Any]:
"""
Create Template
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/templates'
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/templates: {e}')
raise
/api/v1/groups/templates/{template_id}
Delete Template
Soft delete a template (admin only)
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
template_id |
string |
path | Required |
Responses
Code Examples
Example DELETE request to /api/v1/groups/templates/{template_id}
curl -X DELETE \
"https://api.spmc.dev/api/v1/groups/templates/example" \
-H "Content-Type: application/json"
Fetch delete template
async function deleteApiV1GroupsTemplates(template_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/templates/example', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/templates/{template_id}:', error);
throw error;
}
}
Call delete template
import requests
from typing import Dict, Any, Optional
def deleteApiV1GroupsTemplates(template_id) -> Dict[str, Any]:
"""
Delete Template
Args:
template_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/templates/example'
headers = {
"Content-Type": "application/json"
}
response = requests.delete(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/templates/{template_id}: {e}')
raise
/api/v1/groups/templates/{template_id}
Get Template
Get a specific template by ID
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
template_id |
string |
path | Required |
Responses
Code Examples
Example GET request to /api/v1/groups/templates/{template_id}
curl -X GET \
"https://api.spmc.dev/api/v1/groups/templates/example" \
-H "Content-Type: application/json"
Fetch get template
async function apiV1GroupsTemplates(template_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/templates/example', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/templates/{template_id}:', error);
throw error;
}
}
Call get template
import requests
from typing import Dict, Any, Optional
def apiV1GroupsTemplates(template_id) -> Dict[str, Any]:
"""
Get Template
Args:
template_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/templates/example'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/templates/{template_id}: {e}')
raise
/api/v1/groups/templates/{template_id}
Update Template
Update an existing template (admin only)
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
template_id |
string |
path | Required |
Request Body
Reference: #/components/schemas/TemplateUpdate
Responses
Code Examples
Example PUT request to /api/v1/groups/templates/{template_id}
curl -X PUT \
"https://api.spmc.dev/api/v1/groups/templates/example" \
-H "Content-Type: application/json"
Fetch update template
async function putApiV1GroupsTemplates(template_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/templates/example', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/templates/{template_id}:', error);
throw error;
}
}
Call update template
import requests
from typing import Dict, Any, Optional
def putApiV1GroupsTemplates(template_id) -> Dict[str, Any]:
"""
Update Template
Args:
template_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/templates/example'
headers = {
"Content-Type": "application/json"
}
response = requests.put(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/templates/{template_id}: {e}')
raise
/api/v1/groups/templates/{template_id}/preview
Preview Template
Preview what markets would be selected by a template
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
template_id |
string |
path | Required | |
limit |
integer |
query | Optional |
Maximum markets to preview
Default: 20
|
Request Body
Responses
Code Examples
Example POST request to /api/v1/groups/templates/{template_id}/preview
curl -X POST \
"https://api.spmc.dev/api/v1/groups/templates/example/preview" \
-H "Content-Type: application/json"
Fetch preview template
async function postApiV1GroupsTemplatesPreview(template_id, limit) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/templates/example/preview', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/templates/{template_id}/preview:', error);
throw error;
}
}
Call preview template
import requests
from typing import Dict, Any, Optional
def postApiV1GroupsTemplatesPreview(template_id, limit) -> Dict[str, Any]:
"""
Preview Template
Args:
template_id:
limit: Maximum markets to preview
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/templates/example/preview'
headers = {
"Content-Type": "application/json"
}
params = {
'limit': limit,
}
response = requests.post(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/templates/{template_id}/preview: {e}')
raise
/api/v1/groups/{group_id}
Delete Group
Delete a group and all its market relationships
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Responses
Code Examples
Example DELETE request to /api/v1/groups/{group_id}
curl -X DELETE \
"https://api.spmc.dev/api/v1/groups/example" \
-H "Content-Type: application/json"
Fetch delete group
async function deleteApiV1Groups(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}:', error);
throw error;
}
}
Call delete group
import requests
from typing import Dict, Any, Optional
def deleteApiV1Groups(group_id) -> Dict[str, Any]:
"""
Delete Group
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example'
headers = {
"Content-Type": "application/json"
}
response = requests.delete(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}: {e}')
raise
/api/v1/groups/{group_id}
Get Group
Get a specific group by ID. By default, resolved markets are filtered out to show only active positions. Set include_resolved=true to see all markets including resolved ones.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required | |
include_resolved |
boolean |
query | Optional |
Include resolved markets in response. By default, resolved markets are filtered out to show only active positions.
Default: False
|
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example" \
-H "Content-Type: application/json"
Fetch get group
async function apiV1Groups(group_id, include_resolved) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}:', error);
throw error;
}
}
Call get group
import requests
from typing import Dict, Any, Optional
def apiV1Groups(group_id, include_resolved) -> Dict[str, Any]:
"""
Get Group
Args:
group_id:
include_resolved: Include resolved markets in response. By default, resolved markets are filtered out to show only active positions.
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example'
headers = {
"Content-Type": "application/json"
}
params = {
'include_resolved': include_resolved,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}: {e}')
raise
/api/v1/groups/{group_id}
Update Group
Update a group's metadata
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Request Body
Reference: #/components/schemas/GroupUpdate
Responses
Code Examples
Example PUT request to /api/v1/groups/{group_id}
curl -X PUT \
"https://api.spmc.dev/api/v1/groups/example" \
-H "Content-Type: application/json"
Fetch update group
async function putApiV1Groups(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}:', error);
throw error;
}
}
Call update group
import requests
from typing import Dict, Any, Optional
def putApiV1Groups(group_id) -> Dict[str, Any]:
"""
Update Group
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example'
headers = {
"Content-Type": "application/json"
}
response = requests.put(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}: {e}')
raise
/api/v1/groups/{group_id}/arbitrage-spread
Get Arbitrage Spread
Get current arbitrage spread and profit potential for an arbitrage group
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}/arbitrage-spread
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example/arbitrage-spread" \
-H "Content-Type: application/json"
Fetch get arbitrage spread
async function apiV1GroupsArbitrage-spread(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/arbitrage-spread', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/arbitrage-spread:', error);
throw error;
}
}
Call get arbitrage spread
import requests
from typing import Dict, Any, Optional
def apiV1GroupsArbitrage-spread(group_id) -> Dict[str, Any]:
"""
Get Arbitrage Spread
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/arbitrage-spread'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/arbitrage-spread: {e}')
raise
/api/v1/groups/{group_id}/correlation
Get Correlation Data
Get correlation analysis for a correlation group
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}/correlation
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example/correlation" \
-H "Content-Type: application/json"
Fetch get correlation data
async function apiV1GroupsCorrelation(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/correlation', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/correlation:', error);
throw error;
}
}
Call get correlation data
import requests
from typing import Dict, Any, Optional
def apiV1GroupsCorrelation(group_id) -> Dict[str, Any]:
"""
Get Correlation Data
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/correlation'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/correlation: {e}')
raise
/api/v1/groups/{group_id}/index-value
Get Index Value
Get index value for an index group. Without parameters, returns current index value and constituent contributions. With interval/fidelity or start_time/end_time parameters, returns historical weighted index data. The historical data aggregates price history from all constituent markets using their weights to produce a single weighted index time series.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required | |
interval |
string |
query | Optional | Time interval (1m, 1h, 6h, 1d, 1w, max). If provided, returns historical data. Mutually exclusive with start_time/end_time |
fidelity |
string |
query | Optional |
Resolution in minutes for historical data
Default: 60
|
start_time |
string |
query | Optional | Start timestamp (Unix UTC) for historical data. Mutually exclusive with interval |
end_time |
string |
query | Optional | End timestamp (Unix UTC) for historical data. Mutually exclusive with interval |
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}/index-value
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example/index-value" \
-H "Content-Type: application/json"
Fetch get index value
async function apiV1GroupsIndex-value(group_id, interval, fidelity, start_time, end_time) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/index-value', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/index-value:', error);
throw error;
}
}
Call get index value
import requests
from typing import Dict, Any, Optional
def apiV1GroupsIndex-value(group_id, interval, fidelity, start_time, end_time) -> Dict[str, Any]:
"""
Get Index Value
Args:
group_id:
interval: Time interval (1m, 1h, 6h, 1d, 1w, max). If provided, returns historical data. Mutually exclusive with start_time/end_time
fidelity: Resolution in minutes for historical data
start_time: Start timestamp (Unix UTC) for historical data. Mutually exclusive with interval
end_time: End timestamp (Unix UTC) for historical data. Mutually exclusive with interval
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/index-value'
headers = {
"Content-Type": "application/json"
}
params = {
'interval': interval,
'fidelity': fidelity,
'start_time': start_time,
'end_time': end_time,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/index-value: {e}')
raise
/api/v1/groups/{group_id}/markets
Add Markets To Group
Add markets to an existing group
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Request Body
Reference: #/components/schemas/MarketAdd
Responses
Code Examples
Example POST request to /api/v1/groups/{group_id}/markets
curl -X POST \
"https://api.spmc.dev/api/v1/groups/example/markets" \
-H "Content-Type: application/json"
Fetch add markets to group
async function postApiV1GroupsMarkets(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/markets', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/markets:', error);
throw error;
}
}
Call add markets to group
import requests
from typing import Dict, Any, Optional
def postApiV1GroupsMarkets(group_id) -> Dict[str, Any]:
"""
Add Markets To Group
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/markets'
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/markets: {e}')
raise
/api/v1/groups/{group_id}/markets/from-polymarket
Add Polymarket To Group
Add a Polymarket market to a group by condition ID. This endpoint allows adding markets directly from Polymarket using their condition ID (the hexadecimal string starting with 0x). The market will be fetched from Polymarket's API if it doesn't exist in our database. **Supported Input Formats:** - Condition ID: `0x0ed1d3981a2067c9a53364b00d4342e703026926615de49aec9bead2cb2f8393` - Polymarket URL: The condition ID will be extracted automatically **Process:** 1. Check if market exists in our database 2. If not, fetch from Polymarket API and insert 3. Add market to group with specified weight and position **Example:** ```json { "condition_id": "0x0ed1d3981a2067c9a53364b00d4342e703026926615de49aec9bead2cb2f8393", "weight": 2.5, "position_type": "long" } ```
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Request Body
Reference: #/components/schemas/PolymarketMarketAdd
Responses
Code Examples
Example POST request to /api/v1/groups/{group_id}/markets/from-polymarket
curl -X POST \
"https://api.spmc.dev/api/v1/groups/example/markets/from-polymarket" \
-H "Content-Type: application/json"
Fetch add polymarket to group
async function postApiV1GroupsMarketsFrom-polymarket(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/markets/from-polymarket', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/markets/from-polymarket:', error);
throw error;
}
}
Call add polymarket to group
import requests
from typing import Dict, Any, Optional
def postApiV1GroupsMarketsFrom-polymarket(group_id) -> Dict[str, Any]:
"""
Add Polymarket To Group
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/markets/from-polymarket'
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/markets/from-polymarket: {e}')
raise
/api/v1/groups/{group_id}/markets/{market_id}
Remove Market From Group
Remove a market from a group
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required | |
market_id |
string |
path | Required |
Responses
Code Examples
Example DELETE request to /api/v1/groups/{group_id}/markets/{market_id}
curl -X DELETE \
"https://api.spmc.dev/api/v1/groups/example/markets/example" \
-H "Content-Type: application/json"
Fetch remove market from group
async function deleteApiV1GroupsMarkets(group_id, market_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/markets/example', {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/markets/{market_id}:', error);
throw error;
}
}
Call remove market from group
import requests
from typing import Dict, Any, Optional
def deleteApiV1GroupsMarkets(group_id, market_id) -> Dict[str, Any]:
"""
Remove Market From Group
Args:
group_id:
market_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/markets/example'
headers = {
"Content-Type": "application/json"
}
response = requests.delete(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/markets/{market_id}: {e}')
raise
/api/v1/groups/{group_id}/markets/{market_id}
Update Market In Group
Update a market's properties within a group
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required | |
market_id |
string |
path | Required |
Request Body
Reference: #/components/schemas/MarketUpdate
Responses
Code Examples
Example PUT request to /api/v1/groups/{group_id}/markets/{market_id}
curl -X PUT \
"https://api.spmc.dev/api/v1/groups/example/markets/example" \
-H "Content-Type: application/json"
Fetch update market in group
async function putApiV1GroupsMarkets(group_id, market_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/markets/example', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/markets/{market_id}:', error);
throw error;
}
}
Call update market in group
import requests
from typing import Dict, Any, Optional
def putApiV1GroupsMarkets(group_id, market_id) -> Dict[str, Any]:
"""
Update Market In Group
Args:
group_id:
market_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/markets/example'
headers = {
"Content-Type": "application/json"
}
response = requests.put(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/markets/{market_id}: {e}')
raise
/api/v1/groups/{group_id}/membership-history
Get Membership History
Get history of market additions, removals, weight changes, and resolutions for a group. This endpoint returns a chronological log of all changes to the group's composition: - Markets added with their initial weights - Markets removed from the group - Weight changes for existing markets - Market resolutions (automatic settlements) Action type filtering: - 'manual': Only manual changes (added, removed, weight_changed) - 'automatic': Only automatic changes (resolved_win, resolved_loss, resolved_invalid) - 'all' or None: All changes (default) Resolution filtering: - include_resolutions=True: Include resolution events (default) - include_resolutions=False: Exclude resolution events (show only manual changes) Note: If action_type is specified, it takes precedence over include_resolutions. Useful for understanding how a group evolved over time and for simulating historical performance with accurate composition.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required | |
start_time |
string |
query | Optional | Unix timestamp (start filter) |
end_time |
string |
query | Optional | Unix timestamp (end filter) |
limit |
integer |
query | Optional |
Maximum number of changes
Default: 100
|
action_type |
string |
query | Optional | Filter by action type: 'manual' (added, removed, weight_changed), 'automatic' (resolved_win, resolved_loss, resolved_invalid), or 'all' for everything |
include_resolutions |
boolean |
query | Optional |
Include resolution events (resolved_win, resolved_loss, resolved_invalid) in response. Set to false to show only manual changes.
Default: True
|
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}/membership-history
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example/membership-history" \
-H "Content-Type: application/json"
Fetch get membership history
async function apiV1GroupsMembership-history(group_id, start_time, end_time, limit, action_type, include_resolutions) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/membership-history', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/membership-history:', error);
throw error;
}
}
Call get membership history
import requests
from typing import Dict, Any, Optional
def apiV1GroupsMembership-history(group_id, start_time, end_time, limit, action_type, include_resolutions) -> Dict[str, Any]:
"""
Get Membership History
Args:
group_id:
start_time: Unix timestamp (start filter)
end_time: Unix timestamp (end filter)
limit: Maximum number of changes
action_type: Filter by action type: 'manual' (added, removed, weight_changed), 'automatic' (resolved_win, resolved_loss, resolved_invalid), or 'all' for everything
include_resolutions: Include resolution events (resolved_win, resolved_loss, resolved_invalid) in response. Set to false to show only manual changes.
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/membership-history'
headers = {
"Content-Type": "application/json"
}
params = {
'start_time': start_time,
'end_time': end_time,
'limit': limit,
'action_type': action_type,
'include_resolutions': include_resolutions,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/membership-history: {e}')
raise
/api/v1/groups/{group_id}/metrics
Get Group Metrics
Calculate and return metrics for a group based on its type
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}/metrics
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example/metrics" \
-H "Content-Type: application/json"
Fetch get group metrics
async function apiV1GroupsMetrics(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/metrics', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/metrics:', error);
throw error;
}
}
Call get group metrics
import requests
from typing import Dict, Any, Optional
def apiV1GroupsMetrics(group_id) -> Dict[str, Any]:
"""
Get Group Metrics
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/metrics'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/metrics: {e}')
raise
/api/v1/groups/{group_id}/performance
Get Group Performance
Get price performance data optimized for frontend charts and monitoring. This endpoint returns aggregated price performance metrics for all markets in a group, using weighted averages based on each market's weight in the group. Returns: - Weighted average price for the group - Individual market prices and their contributions - Performance changes over the specified period - Volume and liquidity metrics
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required | |
period |
string |
query | Optional |
Time period: 1h, 24h, 7d, 30d, all
Default: 24h
|
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}/performance
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example/performance" \
-H "Content-Type: application/json"
Fetch get group performance
async function apiV1GroupsPerformance(group_id, period) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/performance', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/performance:', error);
throw error;
}
}
Call get group performance
import requests
from typing import Dict, Any, Optional
def apiV1GroupsPerformance(group_id, period) -> Dict[str, Any]:
"""
Get Group Performance
Args:
group_id:
period: Time period: 1h, 24h, 7d, 30d, all
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/performance'
headers = {
"Content-Type": "application/json"
}
params = {
'period': period,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/performance: {e}')
raise
/api/v1/groups/{group_id}/portfolio-value
Get Portfolio Value
Get portfolio value and P&L for a portfolio group
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}/portfolio-value
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example/portfolio-value" \
-H "Content-Type: application/json"
Fetch get portfolio value
async function apiV1GroupsPortfolio-value(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/portfolio-value', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/portfolio-value:', error);
throw error;
}
}
Call get portfolio value
import requests
from typing import Dict, Any, Optional
def apiV1GroupsPortfolio-value(group_id) -> Dict[str, Any]:
"""
Get Portfolio Value
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/portfolio-value'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/portfolio-value: {e}')
raise
/api/v1/groups/{group_id}/rebalance
Rebalance Portfolio
Rebalance a portfolio group with new allocations. This endpoint: 1. Validates the group is a portfolio type and is paper trading 2. Calculates current portfolio value using market prices 3. Applies the new percentage allocations 4. Calculates shares for each market based on current prices 5. Updates the group's market relationships 6. Records the rebalance event in the portfolio_rebalances table 7. Updates group membership history for audit trail **Request Body:** ```json { "allocations": [ {"market_id": "abc-123", "percentage": 30.0}, {"market_id": "def-456", "percentage": 25.0} ], "cash_percentage": 45.0, "notes": "Monthly rebalance" } ``` **Response:** ```json { "rebalance_id": "...", "group_id": "...", "timestamp": "2024-11-26T10:30:00Z", "portfolio_value_before": 105.23, "portfolio_value_after": 105.23, "allocations_applied": [ { "market_id": "abc-123", "market_title": "Will BTC hit $100k?", "percentage": 30.0, "dollar_amount": 31.57, "shares": 63.14, "price": 0.50 }, { "symbol": "CASH", "percentage": 45.0, "dollar_amount": 47.35 } ] } ```
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required |
Request Body
Reference: #/components/schemas/RebalanceRequest
Responses
Code Examples
Example POST request to /api/v1/groups/{group_id}/rebalance
curl -X POST \
"https://api.spmc.dev/api/v1/groups/example/rebalance" \
-H "Content-Type: application/json"
Fetch rebalance portfolio
async function postApiV1GroupsRebalance(group_id) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/rebalance', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/rebalance:', error);
throw error;
}
}
Call rebalance portfolio
import requests
from typing import Dict, Any, Optional
def postApiV1GroupsRebalance(group_id) -> Dict[str, Any]:
"""
Rebalance Portfolio
Args:
group_id:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/rebalance'
headers = {
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/rebalance: {e}')
raise
/api/v1/groups/{group_id}/rebalance-history
Get Rebalance History
Get history of portfolio rebalances for a group. This endpoint returns a chronological log of all rebalances for a portfolio group: - When rebalances occurred - Portfolio value before and after - Type of rebalance (manual, automatic, initial) - Optional notes Only available for groups with group_type='portfolio'.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
group_id |
string |
path | Required | |
start_time |
string |
query | Optional | Unix timestamp in seconds (start filter) |
end_time |
string |
query | Optional | Unix timestamp in seconds (end filter) |
limit |
integer |
query | Optional |
Maximum number of rebalances to return
Default: 50
|
Responses
Code Examples
Example GET request to /api/v1/groups/{group_id}/rebalance-history
curl -X GET \
"https://api.spmc.dev/api/v1/groups/example/rebalance-history" \
-H "Content-Type: application/json"
Fetch get rebalance history
async function apiV1GroupsRebalance-history(group_id, start_time, end_time, limit) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/groups/example/rebalance-history', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/groups/{group_id}/rebalance-history:', error);
throw error;
}
}
Call get rebalance history
import requests
from typing import Dict, Any, Optional
def apiV1GroupsRebalance-history(group_id, start_time, end_time, limit) -> Dict[str, Any]:
"""
Get Rebalance History
Args:
group_id:
start_time: Unix timestamp in seconds (start filter)
end_time: Unix timestamp in seconds (end filter)
limit: Maximum number of rebalances to return
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/groups/example/rebalance-history'
headers = {
"Content-Type": "application/json"
}
params = {
'start_time': start_time,
'end_time': end_time,
'limit': limit,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/groups/{group_id}/rebalance-history: {e}')
raise
Kalshi Monitoring
/api/v1/monitoring/kalshi/kalshi-status
Get Kalshi Status
Quick Kalshi WebSocket status check. Returns simplified status for monitoring/alerting. Usage: curl "https://api.spmc.dev/api/v1/monitoring/kalshi-status"
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/kalshi-status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/kalshi-status" \
-H "Content-Type: application/json"
Fetch get kalshi status
async function apiV1MonitoringKalshiKalshi-status() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/kalshi-status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/kalshi-status:', error);
throw error;
}
}
Call get kalshi status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiKalshi-status() -> Dict[str, Any]:
"""
Get Kalshi Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/kalshi-status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/kalshi-status: {e}')
raise
/api/v1/monitoring/kalshi/metrics
Get Kalshi Metrics
Comprehensive metrics for Kalshi WebSocket system. Monitors: 1. WebSocket connection status and channel subscriptions 2. Message processing rates (ticker, trade, orderbook, lifecycle) 3. Database update rates and latency 4. Data freshness per market 5. Error rates and connection health Usage: curl "https://api.spmc.dev/api/v1/monitoring/kalshi-metrics"
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/metrics
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/metrics" \
-H "Content-Type: application/json"
Fetch get kalshi metrics
async function apiV1MonitoringKalshiMetrics() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/metrics', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/metrics:', error);
throw error;
}
}
Call get kalshi metrics
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiMetrics() -> Dict[str, Any]:
"""
Get Kalshi Metrics
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/metrics'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/metrics: {e}')
raise
/api/v1/monitoring/kalshi/metrics/scaling-readiness
Check Scaling Readiness
Check if system is ready to scale to target number of markets. Args: target_markets: Number of markets to scale to (default 25000)
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
target_markets |
integer |
query | Optional |
Default: 25000
|
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/metrics/scaling-readiness
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/metrics/scaling-readiness" \
-H "Content-Type: application/json"
Fetch check scaling readiness
async function apiV1MonitoringKalshiMetricsScaling-readiness(target_markets) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/metrics/scaling-readiness', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/metrics/scaling-readiness:', error);
throw error;
}
}
Call check scaling readiness
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiMetricsScaling-readiness(target_markets) -> Dict[str, Any]:
"""
Check Scaling Readiness
Args:
target_markets:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/metrics/scaling-readiness'
headers = {
"Content-Type": "application/json"
}
params = {
'target_markets': target_markets,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/metrics/scaling-readiness: {e}')
raise
/api/v1/monitoring/kalshi/orderbook-status
Get Kalshi Orderbook Status
Get Kalshi orderbook subscription status from database.
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/orderbook-status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/orderbook-status" \
-H "Content-Type: application/json"
Fetch get kalshi orderbook status
async function apiV1MonitoringKalshiOrderbook-status() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/orderbook-status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/orderbook-status:', error);
throw error;
}
}
Call get kalshi orderbook status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiOrderbook-status() -> Dict[str, Any]:
"""
Get Kalshi Orderbook Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/orderbook-status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/orderbook-status: {e}')
raise
/api/v1/monitoring/kalshi/pipeline
Get Kalshi Pipeline Status
Get comprehensive status of the Kalshi websocket data pipeline. Checks: 1. WebSocket connection status 2. Message reception rate 3. Processing success/failure rates 4. Database write status 5. Data freshness in order_book_current
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/pipeline
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline" \
-H "Content-Type: application/json"
Fetch get kalshi pipeline status
async function apiV1MonitoringKalshiPipeline() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/pipeline:', error);
throw error;
}
}
Call get kalshi pipeline status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiPipeline() -> Dict[str, Any]:
"""
Get Kalshi Pipeline Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/pipeline: {e}')
raise
/api/v1/monitoring/kalshi/pipeline/logs
Get Kalshi Pipeline Logs
Get recent Kalshi pipeline activity from logs. This endpoint helps identify where data is getting stuck.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
minutes |
integer |
query | Optional |
Default: 5
|
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/pipeline/logs
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline/logs" \
-H "Content-Type: application/json"
Fetch get kalshi pipeline logs
async function apiV1MonitoringKalshiPipelineLogs(minutes) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline/logs', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/pipeline/logs:', error);
throw error;
}
}
Call get kalshi pipeline logs
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiPipelineLogs(minutes) -> Dict[str, Any]:
"""
Get Kalshi Pipeline Logs
Args:
minutes:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline/logs'
headers = {
"Content-Type": "application/json"
}
params = {
'minutes': minutes,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/pipeline/logs: {e}')
raise
/api/v1/monitoring/kalshi/status
Get Kalshi Status
Get basic Kalshi subscription and data status.
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/status" \
-H "Content-Type: application/json"
Fetch get kalshi status
async function apiV1MonitoringKalshiStatus() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/status:', error);
throw error;
}
}
Call get kalshi status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiStatus() -> Dict[str, Any]:
"""
Get Kalshi Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/status: {e}')
raise
/api/v1/monitoring/kalshi/status/can-scale
Check Can Scale
Simple check if we can scale to more markets.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
target_markets |
integer |
query | Optional |
Default: 1000
|
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/status/can-scale
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/status/can-scale" \
-H "Content-Type: application/json"
Fetch check can scale
async function apiV1MonitoringKalshiStatusCan-scale(target_markets) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/status/can-scale', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/status/can-scale:', error);
throw error;
}
}
Call check can scale
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiStatusCan-scale(target_markets) -> Dict[str, Any]:
"""
Check Can Scale
Args:
target_markets:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/status/can-scale'
headers = {
"Content-Type": "application/json"
}
params = {
'target_markets': target_markets,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/status/can-scale: {e}')
raise
Monitoring
/api/v1/monitoring/kalshi/kalshi-status
Get Kalshi Status
Quick Kalshi WebSocket status check. Returns simplified status for monitoring/alerting. Usage: curl "https://api.spmc.dev/api/v1/monitoring/kalshi-status"
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/kalshi-status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/kalshi-status" \
-H "Content-Type: application/json"
Fetch get kalshi status
async function apiV1MonitoringKalshiKalshi-status() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/kalshi-status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/kalshi-status:', error);
throw error;
}
}
Call get kalshi status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiKalshi-status() -> Dict[str, Any]:
"""
Get Kalshi Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/kalshi-status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/kalshi-status: {e}')
raise
/api/v1/monitoring/kalshi/metrics
Get Kalshi Metrics
Comprehensive metrics for Kalshi WebSocket system. Monitors: 1. WebSocket connection status and channel subscriptions 2. Message processing rates (ticker, trade, orderbook, lifecycle) 3. Database update rates and latency 4. Data freshness per market 5. Error rates and connection health Usage: curl "https://api.spmc.dev/api/v1/monitoring/kalshi-metrics"
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/metrics
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/metrics" \
-H "Content-Type: application/json"
Fetch get kalshi metrics
async function apiV1MonitoringKalshiMetrics() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/metrics', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/metrics:', error);
throw error;
}
}
Call get kalshi metrics
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiMetrics() -> Dict[str, Any]:
"""
Get Kalshi Metrics
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/metrics'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/metrics: {e}')
raise
/api/v1/monitoring/kalshi/metrics/scaling-readiness
Check Scaling Readiness
Check if system is ready to scale to target number of markets. Args: target_markets: Number of markets to scale to (default 25000)
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
target_markets |
integer |
query | Optional |
Default: 25000
|
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/metrics/scaling-readiness
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/metrics/scaling-readiness" \
-H "Content-Type: application/json"
Fetch check scaling readiness
async function apiV1MonitoringKalshiMetricsScaling-readiness(target_markets) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/metrics/scaling-readiness', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/metrics/scaling-readiness:', error);
throw error;
}
}
Call check scaling readiness
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiMetricsScaling-readiness(target_markets) -> Dict[str, Any]:
"""
Check Scaling Readiness
Args:
target_markets:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/metrics/scaling-readiness'
headers = {
"Content-Type": "application/json"
}
params = {
'target_markets': target_markets,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/metrics/scaling-readiness: {e}')
raise
/api/v1/monitoring/kalshi/orderbook-status
Get Kalshi Orderbook Status
Get Kalshi orderbook subscription status from database.
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/orderbook-status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/orderbook-status" \
-H "Content-Type: application/json"
Fetch get kalshi orderbook status
async function apiV1MonitoringKalshiOrderbook-status() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/orderbook-status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/orderbook-status:', error);
throw error;
}
}
Call get kalshi orderbook status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiOrderbook-status() -> Dict[str, Any]:
"""
Get Kalshi Orderbook Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/orderbook-status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/orderbook-status: {e}')
raise
/api/v1/monitoring/kalshi/pipeline
Get Kalshi Pipeline Status
Get comprehensive status of the Kalshi websocket data pipeline. Checks: 1. WebSocket connection status 2. Message reception rate 3. Processing success/failure rates 4. Database write status 5. Data freshness in order_book_current
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/pipeline
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline" \
-H "Content-Type: application/json"
Fetch get kalshi pipeline status
async function apiV1MonitoringKalshiPipeline() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/pipeline:', error);
throw error;
}
}
Call get kalshi pipeline status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiPipeline() -> Dict[str, Any]:
"""
Get Kalshi Pipeline Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/pipeline: {e}')
raise
/api/v1/monitoring/kalshi/pipeline/logs
Get Kalshi Pipeline Logs
Get recent Kalshi pipeline activity from logs. This endpoint helps identify where data is getting stuck.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
minutes |
integer |
query | Optional |
Default: 5
|
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/pipeline/logs
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline/logs" \
-H "Content-Type: application/json"
Fetch get kalshi pipeline logs
async function apiV1MonitoringKalshiPipelineLogs(minutes) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline/logs', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/pipeline/logs:', error);
throw error;
}
}
Call get kalshi pipeline logs
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiPipelineLogs(minutes) -> Dict[str, Any]:
"""
Get Kalshi Pipeline Logs
Args:
minutes:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/pipeline/logs'
headers = {
"Content-Type": "application/json"
}
params = {
'minutes': minutes,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/pipeline/logs: {e}')
raise
/api/v1/monitoring/kalshi/status
Get Kalshi Status
Get basic Kalshi subscription and data status.
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/status" \
-H "Content-Type: application/json"
Fetch get kalshi status
async function apiV1MonitoringKalshiStatus() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/status:', error);
throw error;
}
}
Call get kalshi status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiStatus() -> Dict[str, Any]:
"""
Get Kalshi Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/status: {e}')
raise
/api/v1/monitoring/kalshi/status/can-scale
Check Can Scale
Simple check if we can scale to more markets.
Parameters
| Name | Type | Location | Required | Description |
|---|---|---|---|---|
target_markets |
integer |
query | Optional |
Default: 1000
|
Responses
Code Examples
Example GET request to /api/v1/monitoring/kalshi/status/can-scale
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/kalshi/status/can-scale" \
-H "Content-Type: application/json"
Fetch check can scale
async function apiV1MonitoringKalshiStatusCan-scale(target_markets) {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/kalshi/status/can-scale', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/kalshi/status/can-scale:', error);
throw error;
}
}
Call check can scale
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringKalshiStatusCan-scale(target_markets) -> Dict[str, Any]:
"""
Check Can Scale
Args:
target_markets:
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/kalshi/status/can-scale'
headers = {
"Content-Type": "application/json"
}
params = {
'target_markets': target_markets,
}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/kalshi/status/can-scale: {e}')
raise
/api/v1/monitoring/polymarket/metrics
Get Polymarket Metrics
Comprehensive metrics for Polymarket WebSocket system. Monitors: 1. WebSocket connection status and channel subscriptions 2. Message processing rates (book, ticker, orderbook updates) 3. Database update rates and latency 4. Data freshness per market 5. Token-specific metrics (YES/NO) Usage: curl "https://api.spmc.dev/api/v1/monitoring/polymarket-metrics"
Responses
Code Examples
Example GET request to /api/v1/monitoring/polymarket/metrics
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/polymarket/metrics" \
-H "Content-Type: application/json"
Fetch get polymarket metrics
async function apiV1MonitoringPolymarketMetrics() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/polymarket/metrics', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/polymarket/metrics:', error);
throw error;
}
}
Call get polymarket metrics
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringPolymarketMetrics() -> Dict[str, Any]:
"""
Get Polymarket Metrics
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/polymarket/metrics'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/polymarket/metrics: {e}')
raise
/api/v1/monitoring/polymarket/orderbook-status
Get Polymarket Orderbook Status
Get detailed Polymarket orderbook subscription status.
Responses
Code Examples
Example GET request to /api/v1/monitoring/polymarket/orderbook-status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/polymarket/orderbook-status" \
-H "Content-Type: application/json"
Fetch get polymarket orderbook status
async function apiV1MonitoringPolymarketOrderbook-status() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/polymarket/orderbook-status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/polymarket/orderbook-status:', error);
throw error;
}
}
Call get polymarket orderbook status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringPolymarketOrderbook-status() -> Dict[str, Any]:
"""
Get Polymarket Orderbook Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/polymarket/orderbook-status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/polymarket/orderbook-status: {e}')
raise
/api/v1/monitoring/polymarket/status
Get Polymarket Status
Quick Polymarket WebSocket status check. Returns simplified status for monitoring/alerting. Usage: curl "https://api.spmc.dev/api/v1/monitoring/polymarket-status"
Responses
Code Examples
Example GET request to /api/v1/monitoring/polymarket/status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/polymarket/status" \
-H "Content-Type: application/json"
Fetch get polymarket status
async function apiV1MonitoringPolymarketStatus() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/polymarket/status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/polymarket/status:', error);
throw error;
}
}
Call get polymarket status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringPolymarketStatus() -> Dict[str, Any]:
"""
Get Polymarket Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/polymarket/status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/polymarket/status: {e}')
raise
/api/v1/monitoring/polymarket/subscription-analysis
Analyze Polymarket Subscriptions
Analyze Polymarket subscription patterns and identify issues. Returns detailed analysis of which markets are/aren't receiving updates.
Responses
Code Examples
Example GET request to /api/v1/monitoring/polymarket/subscription-analysis
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/polymarket/subscription-analysis" \
-H "Content-Type: application/json"
Fetch analyze polymarket subscriptions
async function apiV1MonitoringPolymarketSubscription-analysis() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/polymarket/subscription-analysis', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/polymarket/subscription-analysis:', error);
throw error;
}
}
Call analyze polymarket subscriptions
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringPolymarketSubscription-analysis() -> Dict[str, Any]:
"""
Analyze Polymarket Subscriptions
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/polymarket/subscription-analysis'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/polymarket/subscription-analysis: {e}')
raise
Polymarket Monitoring
/api/v1/monitoring/polymarket/metrics
Get Polymarket Metrics
Comprehensive metrics for Polymarket WebSocket system. Monitors: 1. WebSocket connection status and channel subscriptions 2. Message processing rates (book, ticker, orderbook updates) 3. Database update rates and latency 4. Data freshness per market 5. Token-specific metrics (YES/NO) Usage: curl "https://api.spmc.dev/api/v1/monitoring/polymarket-metrics"
Responses
Code Examples
Example GET request to /api/v1/monitoring/polymarket/metrics
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/polymarket/metrics" \
-H "Content-Type: application/json"
Fetch get polymarket metrics
async function apiV1MonitoringPolymarketMetrics() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/polymarket/metrics', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/polymarket/metrics:', error);
throw error;
}
}
Call get polymarket metrics
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringPolymarketMetrics() -> Dict[str, Any]:
"""
Get Polymarket Metrics
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/polymarket/metrics'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/polymarket/metrics: {e}')
raise
/api/v1/monitoring/polymarket/orderbook-status
Get Polymarket Orderbook Status
Get detailed Polymarket orderbook subscription status.
Responses
Code Examples
Example GET request to /api/v1/monitoring/polymarket/orderbook-status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/polymarket/orderbook-status" \
-H "Content-Type: application/json"
Fetch get polymarket orderbook status
async function apiV1MonitoringPolymarketOrderbook-status() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/polymarket/orderbook-status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/polymarket/orderbook-status:', error);
throw error;
}
}
Call get polymarket orderbook status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringPolymarketOrderbook-status() -> Dict[str, Any]:
"""
Get Polymarket Orderbook Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/polymarket/orderbook-status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/polymarket/orderbook-status: {e}')
raise
/api/v1/monitoring/polymarket/status
Get Polymarket Status
Quick Polymarket WebSocket status check. Returns simplified status for monitoring/alerting. Usage: curl "https://api.spmc.dev/api/v1/monitoring/polymarket-status"
Responses
Code Examples
Example GET request to /api/v1/monitoring/polymarket/status
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/polymarket/status" \
-H "Content-Type: application/json"
Fetch get polymarket status
async function apiV1MonitoringPolymarketStatus() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/polymarket/status', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/polymarket/status:', error);
throw error;
}
}
Call get polymarket status
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringPolymarketStatus() -> Dict[str, Any]:
"""
Get Polymarket Status
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/polymarket/status'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/polymarket/status: {e}')
raise
/api/v1/monitoring/polymarket/subscription-analysis
Analyze Polymarket Subscriptions
Analyze Polymarket subscription patterns and identify issues. Returns detailed analysis of which markets are/aren't receiving updates.
Responses
Code Examples
Example GET request to /api/v1/monitoring/polymarket/subscription-analysis
curl -X GET \
"https://api.spmc.dev/api/v1/monitoring/polymarket/subscription-analysis" \
-H "Content-Type: application/json"
Fetch analyze polymarket subscriptions
async function apiV1MonitoringPolymarketSubscription-analysis() {
try {
const response = await fetch('https://api.spmc.dev/api/v1/monitoring/polymarket/subscription-analysis', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Error calling /api/v1/monitoring/polymarket/subscription-analysis:', error);
throw error;
}
}
Call analyze polymarket subscriptions
import requests
from typing import Dict, Any, Optional
def apiV1MonitoringPolymarketSubscription-analysis() -> Dict[str, Any]:
"""
Analyze Polymarket Subscriptions
Returns:
API response as dictionary
Raises:
requests.exceptions.RequestException: If the request fails
"""
try:
url = 'https://api.spmc.dev/api/v1/monitoring/polymarket/subscription-analysis'
headers = {
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f'Error calling /api/v1/monitoring/polymarket/subscription-analysis: {e}')
raise