Skip to main content
Ultra Feature. Requires an Ultra subscription. Get started at api.mathematicalcompany.com

Triggers

Set conditions, get actions. Horizon’s trigger system evaluates rules each cycle and fires actions when conditions are met. Supports 8 condition types, 5 action types, cooldown periods, and hysteresis to prevent trigger storms. The evaluation logic is pure Rust (stateless); all mutable state lives in the Python closure.

Overview

8 Conditions

Above, below, cross above/below, percent change, absolute change, between, outside.

5 Actions

Alert, webhook, order, hedge, kill switch.

Cooldown & Hysteresis

Prevent trigger storms with configurable cooldown and hysteresis bands.

Oracle Server

hz.oracle() exposes feed prices as a JSON HTTP endpoint.

Core Functions

hz.evaluate_trigger

Evaluate a trigger rule against current market state. Pure function (no side effects).

hz.create_trigger

Create a trigger rule with full configuration.

Condition Types

Action Types


Pipeline Functions

hz.trigger

Evaluate multiple trigger rules each cycle.

hz.conditional_hedge

Automatically hedge when a condition is met.

hz.oracle

Start a minimal HTTP server exposing live feed prices as JSON.

Examples

Alert on Price Moves

Oracle for External Systems