Examples

Runnable examples, from simplest backtest to full production setups

Every example is a full working Python file you can copy, paste, and run. Ordered from simplest to most advanced.

Start here

Code along

Step-by-step tutorials that walk through every line. Start here if you want to understand how the pieces fit together.

Strategy recipes

Focused examples for specific patterns.

Live broker

End-to-end research + paper trading + real-network verification against an actual broker.

Extending Horizon

Running the examples

All examples assume the Horizon package is on your PYTHONPATH:

bash
cd /path/to/profit/new
PYTHONPATH=. python3 my_example.py

Most examples use synthetic data with fixed seeds, so output is deterministic and no API keys are needed.