SettleRisk Python SDK
Python client for the SettleRisk API — resolution risk scoring, dispute pricing, and settlement delay modeling for prediction markets.
Install
pip install settlerisk
Quick Start
from settlerisk import SettleRiskClient
client = SettleRiskClient(
key_id="vx_yourkey_123",
secret="your-base64-secret",
)
# Get risk score for a market
score = client.get_risk_score("polymarket", "0xabc123")
print(f"Risk: {score['aggregate_risk_score']} ({score['risk_tier']})")
print(f"P(dispute): {score['p_dispute']:.1%}")
# Get settlement delay estimate
delay = client.get_expected_delay("polymarket", "0xabc123")
print(f"Median delay: {delay['delay_distribution']['p50_hours']}h")
# Evaluate custom rules (no market required)
result = client.evaluate_rules({
"platform": "polymarket",
"rules_text": "This market resolves YES if BTC reaches $100,000 by Dec 31.",
"resolution_sources": ["https://coingecko.com"],
})
print(f"Score: {result['aggregate_risk_score']}")
# Get dispute-adjusted pricing
pricing = client.price({
"platform": "polymarket",
"platform_market_id": "0xabc123",
"mid_price": 0.65,
"position_side": "YES",
"position_notional_usd": 10000,
"annual_capital_cost_apr": 0.12,
})
print(f"Fair price: {pricing['adjusted_fair_price']:.4f}")
print(f"Risk premium: {pricing['risk_premium']:.4f}")
print(f"Fair spread: {pricing['fair_spread_bps']} bps")
Authentication
All requests are signed with HMAC-SHA256. The SDK handles signing automatically — just provide your key_id and secret from the SettleRisk dashboard.
Context Manager
with SettleRiskClient(key_id="...", secret="...") as client:
score = client.get_risk_score("polymarket", "0xabc")
Retry Behavior
The client automatically retries on 429 (rate limit) and 5xx errors with exponential backoff. Each retry uses a fresh timestamp and nonce. Idempotency keys are preserved across retries.
API Reference
| Method | Endpoint |
|---|---|
get_risk_score(platform, market_id) |
GET /v1/markets/{platform}/{market_id}/risk-score |
get_expected_delay(platform, market_id) |
GET /v1/markets/{platform}/{market_id}/expected-delay |
evaluate_rules(request) |
POST /v1/evaluate-rules |
batch_risk_scores(markets) |
POST /v1/risk-scores:batch |
batch_expected_delays(markets) |
POST /v1/expected-delays:batch |
price(request) |
POST /v1/pricing |
batch_price(items) |
POST /v1/pricing:batch |
create_webhook(url, events) |
POST /v1/webhooks |
list_webhooks() |
GET /v1/webhooks |
delete_webhook(webhook_id) |
DELETE /v1/webhooks/{webhook_id} |
rotate_webhook_secret(webhook_id) |
POST /v1/webhooks/{webhook_id}/rotate-secret |
list_webhook_deliveries() |
GET /v1/webhook-deliveries |
replay_webhook_delivery(delivery_id) |
POST /v1/webhook-deliveries/{delivery_id}/replay |
status() |
GET /v1/status |
Development
pip install -e ".[dev]"
pytest tests/ -v
Metadata
Release files for settlerisk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| settlerisk-0.1.0.tar.gz | 7.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| settlerisk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.6 kB
Release files / settlerisk-0.1.0.tar.gz
| Download URL | settlerisk-0.1.0.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5d4175eed4530d7146d830ace160dba7b98b8f976cc68276b99a14cd20fe6cc
|
|
BLAKE2b-256 checksum How to use checksums |
79154a94b655cdbf0344dd2abbe2d2e4734b91fe20afe671bdfb789204096ecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / settlerisk-0.1.0-py3-none-any.whl
| Download URL | settlerisk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7dca6df51ba33f7896ba54ca4547a973b2a7cae66177ece213fc7c4e9a2db38
|
|
BLAKE2b-256 checksum How to use checksums |
1f7e6b541349dde99b177552874489bf3740d3ccde36282d6a619fef11f3bd8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|