Documentation for Deptle Terminal.
Guides for setup, scripting, troubleshooting, and more.
A whole strategy at a glance
One complete strategy showing the pieces you will use most often.
This one file uses every idea you need: two kinds of tunable input, a rolling-average indicator, a value that survives between ticks, the market event, the run context, and a price-capped order.
What this language is
Deptle strategies are written in a small, trading-focused slice of Python.
You write Python; only the parts that make sense for a trading strategy are available. Anything outside that set stops compilation with an error pointing at the exact spot.
Results are exact and reproducible everywhere.
Write with autocomplete
Install the deptle package so your editor understands strategy files.
Any editor using pyright or mypy — VS Code, PyCharm, and the rest — gets autocomplete, hover documentation, and red underlines before you run anything. Install from the repository root:
- Start every strategy with
from deptle.api import Strategy, Parameter, State, Extra, Tick, Sys, Order, Signal. - Add
from deptle.indicators import RollingMean, RSI, RollingMeanF32, RSIF32when you use indicators. - Every built-in helper (
base,price,clamp,rand_ppm,portfolio_score, and the rest) is importable fromdeptle.api.
The package is editor help only. The Deptle compiler runs your strategy and ignores the import lines.
The entry point: on_tick
Every strategy is one class with an on_tick method, called on each market event.
- Inherit from
Strategyand writedef on_tick(self, tick):ordef on_tick(self, tick, sys):. - Add
sysonly when you readsys.*fields or call the portfolio lookups. - There is no
on_bar. Choose bar data in the Optimizer feed settings; your logic stays inon_tick.
Numbers
int is a whole number. float is a decimal with up to 8 decimal places.
Prices and sizes are exact — write them naturally: price(42000.5), base(0.05).
- A variable's kind is set by its first assignment and cannot change.
- Assign a variable on every path before you read it.
and,or,nottake true/false values — a bare number is not a condition.
/ between two whole numbers is a compile error (E0385). Use // for whole-number division, or wrap one side in float(...) for a decimal result.
Supported control flow
A small set of familiar Python statements.
if/elif/else.for i in range(...)with 1, 2, or 3 arguments.break,continue,pass,return Order.*(...).- A line that is only a string (a docstring) is ignored.
while, for ... else, and other unsupported statements stop compilation.
What is intentionally left out
Familiar Python features that are deliberately unavailable.
- Imports of outside libraries in strategy logic (the
deptleimports are the exception). - General-purpose functions, lambdas, comprehensions, and generators.
- Writing to
Extra(...)buffers — they are read-only. - Attributes on anything other than
tick,sys, andself.
If launch fails, include your loader version, OS, and latest crash log so support can reproduce the issue quickly.