Skip to main content
Deploy strategies to the Horizon Cloud and monitor them in real time, all from Python or the MCP server. The full lifecycle (create, validate, deploy, monitor, stop) works entirely from the SDK with no browser required.

Setup

Generate an SDK key from horizon.mathematicalcompany.com under Settings > SDK Keys.

Quick Start - Full Lifecycle

API Reference

Constructor

Methods

Create Strategy

Code validation runs automatically on creation:
  • 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 and hz.quotes()/hz.run() usage.
  • Code is sanitized: BOM stripped, line endings normalized, common whitespace dedented.
If validation fails, returns 422 with detailed errors:

Validate

Two-phase validation:
  1. Static analysis (platform-side, instant): forbidden patterns, import whitelist, SDK usage checks.
  2. Sandbox validation (worker-side): AST parsing, import resolution, forbidden attribute access.

Save Credentials

Security guarantees:
  • 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 in save_credentials response.
  • 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 - patches hz.run(markets=[...]) in the strategy code.

Logs

Returns log entries in chronological order (oldest first).

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.
Check your current usage:

Deployment Lifecycle

Rate Limits

Exceeding the limit returns 429 Too Many Requests.

MCP Tools

When running the MCP server, cloud operations are available via the cloud 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”
All cloud actions use HORIZON_API_KEY from the environment for authentication.

Error Handling

All API errors raise HorizonCloudError with status_code and body:

Architecture

The SDK client (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.