Setup
Generate an SDK key from horizon.mathematicalcompany.com under Settings > SDK Keys.Quick Start - Full Lifecycle
API Reference
Constructor
Methods
Create Strategy
- Forbidden imports blocked:
os,subprocess,socket,requests,pickle,ctypes, etc. - Forbidden builtins blocked:
eval(),exec(),compile(),open(),__import__(), etc. - Required SDK patterns: at least one
def ...(ctx)pipeline function andhz.quotes()/hz.run()usage. - Code is sanitized: BOM stripped, line endings normalized, common whitespace dedented.
422 with detailed errors:
Validate
Two-phase validation:- Static analysis (platform-side, instant): forbidden patterns, import whitelist, SDK usage checks.
- Sandbox validation (worker-side): AST parsing, import resolution, forbidden attribute access.
Save Credentials
- Private key is transmitted over HTTPS only.
- Encrypted at rest with AES-256-GCM (platform-side encryption key, not stored in DB).
- Never returned in any API response - not in
list_credentials, not insave_credentialsresponse. - Decrypted only in-memory at deploy time, then sent to the worker over HMAC-signed HTTPS.
- Max 10 credentials per user.
- All credential operations are critically audited (audit log insert failure throws, preventing silent loss).
Deploy
mode="paper"- dry run, no real orders.mode="live"- requires Pro/Ultra plan + circuit breaker enabled.markets- patcheshz.run(markets=[...])in the strategy code.
Logs
Security Architecture
Every request goes through multiple security layers - all enforced server-side, never in the SDK client:Authentication & Authorization
Code Security
Credential Security
- Encryption key is a 256-bit hex string stored in platform env (
ENCRYPTION_KEY), never in the database. - Worker communication uses Bearer token + HMAC-SHA256 signature + HTTPS-only enforcement.
- Worker URL must be
https://in production (localhost exempted for dev).
Deployment Security
Plan Limits
All limits are enforced server-side before any action proceeds.Deployment Lifecycle
Rate Limits
Exceeding the limit returns
429 Too Many Requests.
MCP Tools
When running the MCP server, cloud operations are available via thecloud compound tool with an action parameter:
Example MCP usage (Claude Desktop / Claude Code):
“Create a market making strategy, save my Polymarket key, and deploy it in paper mode”
HORIZON_API_KEY from the environment for authentication.
Error Handling
All API errors raiseHorizonCloudError with status_code and body:
Architecture
HorizonCloud) calls the Platform’s v1 REST API over HTTPS using your SDK key. The Platform validates the key (SHA-256 hash lookup), enforces plan limits and rate limits, then forwards deploy requests to the Worker over HMAC-signed HTTPS. The Worker validates the code in a sandbox, spawns an isolated subprocess running your strategy with risk overrides injected, and reports metrics back via webhooks.