Documentation for Deptle Terminal.

Guides for setup, scripting, troubleshooting, and more.

Python DSL · Intro

Deptle strategies use a focused Python-style language built for reliable trading logic.

You write strategy logic in a familiar Python-like style, but only the supported trading subset is available.

If you use something unsupported, the editor stops early with a direct error instead of letting the strategy fail silently later.

By default, quantity (base) and price (price) use 8 decimal places.

Required Entry Point

Every strategy must implement on_tick(self, tick) and may optionally accept sys as the third argument.

  • Supported signatures: def on_tick(self, tick): or def on_tick(self, tick, sys):.
  • on_bar is not supported. Configure feed aggregation in Optimizer UI and keep logic in on_tick.
  • If you need system fields (sys.*) or sys.portfolio_*() helpers, include sys in signature.
minimal_strategy.py
1class MyStrategy(Strategy):
2 threshold: int = Parameter(default=10, min=1, max=100, step=1)
3
4 def on_tick(self, tick, sys):
5 if tick.price > self.threshold:
6 return Order.Buy(quantity=1)
7 return Order.Hold()

Supported Control Flow

Stick to a small set of familiar Python statements.

  • if / elif / else.
  • for i in range(...) with 1, 2, or 3 positional args.
  • break, continue, pass, return Order.*(...).
  • Docstring expression statements are ignored.

while, for ... else, and unsupported statements fail compilation.

Typing & Numeric Model

Keep each value in one clear type and the DSL will stay predictable.

  • Local variable type is fixed by first assignment and cannot later change.
  • Set a variable before you read it on every possible path.
  • / is float division. // is integer/base floor division.
  • Boolean operators (and, or, not) require bool operands; numeric truthiness is not used.
  • int, float, and fixed-point quantity type (base) are tracked explicitly.

Important Unsupported Constructs

This is not full Python, so some familiar features are intentionally unavailable.

  • Arbitrary imports and external Python libraries in strategy logic.
  • General-purpose callables/lambdas/comprehensions/generators.
  • Mutating Extra(...) buffers (read-only by design).
  • Dynamic attribute access beyond recognized DSL objects (tick, sys, self).
Need help?

If launch fails, include your loader version, OS, and latest crash log so support can reproduce the issue quickly.

Check service status