Skip to main content
Horizon reads credentials and configuration from environment variables as a fallback when not passed explicitly to constructors.

Horizon API Key

Get your key at api.mathematicalcompany.com. See the Authentication page for details.

Polymarket

Kalshi

Database

Logging

Valid levels: debug, info, warn, error

Python Logging

Horizon uses Python’s logging module for the Python layer:

Rust Logging

Set the Rust tracing level via environment variable:

CLI Log Level

The --log-level flag sets both Python logging and the HORIZON_LOG environment variable:

Credential Resolution Order

Both Polymarket and Kalshi resolve credentials in this order:
1

Explicit constructor arguments

2

Environment variables

Explicit arguments always take priority over environment variables.

Hot-Reload Parameters

Update strategy parameters at runtime without restarting. Three approaches: pipeline function, standalone ParamReloader, or engine runtime params.

Pipeline Function

Drop hz.hot_reload() into your pipeline to inject parameters into ctx.params every cycle. File-based:
Write new parameters (takes effect next cycle):
Dict-based:

ParamReloader

Standalone class for watching a JSON parameter file. Useful outside of hz.run().
check() returns None on the first call if the file hasn’t changed since construction. Use current() to get the initial values.

Engine Runtime Params

Set and retrieve parameters directly on the Engine.
These are injected into ctx.params every cycle when using hz.run().