Documentation for Deptle Terminal.

Guides for setup, scripting, troubleshooting, and more.

Parameters

Parameter(...) declares an input the Optimizer can sweep. The annotation sets the kind: int for a whole number, float for a decimal.

  • default is required and must sit between min and max.
  • min and max set the sweep range. Both are optional: leave one out and it snaps to default; leave out both and the parameter is fixed at default and never swept.
  • step is the sweep increment. It defaults to 1 for whole numbers, and for decimals to the smallest step at your precision (0.01 at 2 decimal places).
  • name sets the label in the Optimizer UI.
  • Write decimals as numbers (0.05) or quoted strings ("0.05"), up to 8 decimal places. All values in a declaration share the finest precision used.
  • A decimal parameter reads back as a decimal and makes the arithmetic around it decimal. A parameter used as an indicator window or an array size must be an int parameter with min, default, and max all above 0.
parameters.py
1class Params(Strategy):
2 fast: int = Parameter(default=20, min=2, max=200, step=1, name="Fast Window") # swept whole number
3 threshold: float = Parameter(default=0.5, min=0.05, max=2, step=0.05) # swept decimal
4 risk: float = Parameter(default=0.25) # fixed: no min/max
5
6 def on_tick(self, tick):
7 return Order.Hold()

Declarations are strict

Parameter, State, and Extra reject anything they do not recognise — a typo fails loudly.

  • Every argument is a keyword (default=20), not a bare value.
  • An unknown keyword is an error, with a did-you-mean hint for close misspellings.
  • **kwargs-style splats are not allowed.
  • A class field assigned from an unrecognised call is an error.

A bare annotation like x: int or a plain constant like x: int = 5 is inert: it does not become a strategy field. Only Parameter(...), State(...), Extra(...), and the indicator constructors create fields.

Scalar state

A single value that survives from one tick to the next.

  • count: int = State(default=0) for a whole number.
  • avg: float = State(default=0.0) for a decimal (or State(default_f32=0.0)).
  • Assignments are type-checked; decimal state accepts numeric expressions and converts them in.

Array state

A fixed-length buffer you index into, kept between ticks — for rolling windows and indexed memory.

  • buf: list[int] = State(size=64, default=0) — sized by a whole-number literal.
  • win: list[float] = State(size=fast, default=0.0) — sized from an int Parameter (the buffer uses that parameter's max).
  • size must be a positive whole-number literal or the name of an int parameter.
  • Indexing is safe: negative indexes count back from the end, and out-of-range indexes snap to the nearest valid slot.
state_arrays.py
1class Ring(Strategy):
2 n: int = Parameter(default=16, min=4, max=128) # buffer is sized to n's max
3 buf: list[int] = State(size=n, default=0)
4 idx: int = State(default=0)
5
6 def on_tick(self, tick):
7 self.buf[self.idx] = tick.price # store the latest price
8 self.idx = (self.idx + 1) % self.n # advance, wrapping around
9 return Order.Hold()

Extra read-only buffers

Extra(...) reads outside data — reference levels, precomputed series, cross-asset signals — that your strategy never changes.

  • Annotate as list[int] or list[float]. Writing to an Extra is a compile error.
  • binding= is optional. Leave it out and Deptle assigns the lowest free slot (2 or higher) in declaration order. Pass binding= to pin a slot — it must be 2 or higher and unique.
  • Read length with len(self.name) and elements with self.name[i].
  • A missing or empty buffer reads as 0 (or 0.0). Out-of-range indexes snap to the nearest element; negative indexes count from the end.
extras.py
1class WithExtras(Strategy):
2 levels: list[int] = Extra() # auto-assigned to slot 2
3 weights: list[float] = Extra() # auto-assigned to slot 3
4
5 def on_tick(self, tick):
6 if len(self.levels) > 0 and tick.price > self.levels[0]:
7 return Order.Buy(quantity=1)
8 return Order.Hold()

Multi-asset layout

Declare the asset layout up front when your strategy expects more than one market stream.

  • required_assets: int = N, where N is between 1 and 32.
  • asset_slots: list[str] = ["lead", "hedge", ...], with 1 to 32 named entries.
  • If you use both, required_assets must equal len(asset_slots).

Names starting with deptle_bar_ are reserved. Duplicate field names, or two Extras pinned to the same binding, are compile errors.

Need help?

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

Check service status