Bentrix Docs
HomePricingDashboard

What the engine supports for an autonomous agent

One list for a team building its own trading agent — what Bentrix does for you today, what you build yourself on top of it, and what this version does not do — with the page that shows each.

A team that builds its own agent — its own observations, actions, rewards, position logic and risk rules — wants a platform that does three things well and stays out of the rest: replay the market, execute the orders, keep the account. This page is the whole list of what Bentrix gives such a team in this version, what remains yours, and what is not there.

01In one paragraph

Your agent talks to an environment you write. That environment calls Bentrix's engine for candles, ticks, orders and the account — in your own Python process, with no window — and returns to your agent whatever observation and reward you designed. No ready-made environment, action space or reward is required. Orders are filled by a venue that works on bid and ask, tick by tick, with commission, swap, margin, stops rules and stop-out; the clock cannot be read past; equal inputs give equal results.

your agent  →  your environment class  →  Bentrix's engine  →  replay clock + venue + account
                (observation, reward)        (candles, ticks, orders, book, deals)

02What Bentrix does

An environment of your own

You canPage
Write a Gymnasium environment without the ready-made one: your spaces, state, reward, episodes, terminationAn environment of your own
Call the engine directly from Python, with no application openThe engine in your own program
Use any Gymnasium library — Stable-Baselines3 shown — or your own loopAn environment of your own, with Gymnasium and Stable-Baselines3
Start from a ready-made environment instead: three action kinds, eight rewardsHow one step works, every setting

Positions and orders

You canPage
Hold several positions of one market at once, each with its own ticket, entry, stop, target and profit — long and short together (a hedging account); or one net position per market (a netting account)Orders, legs and exposure
Open, add, reduce part of a position, close one, close chosen ones, close all, reversesame
Market, limit, stop and stop-limit orders; cancel; modify price, stop and target; trailing stopsame
Read every fill as a deal with its time, price, volume, commission, swap and profitsame
Compute net, gross, long and short exposure, against equity and against marginsame
Ask what an order would cost before sending itOrders and the book

Execution

You canPage
Fill buys at the ask and sells at the bid, on the next tick after the decision; meet stops and targets tick by tick between closesChecking the engine yourself
Add slippage — fixed, random from a seed, scaled to the market's move, extra in chosen hours — and a delay before market orders fillSlippage, latency and spread
Widen, fix, floor or schedule the spreadsame
Measure your own broker's slippage and delay and replay under themYour own fills
Choose the account's currency, opening balance, leverage and hedging or netting; set a workbench's own commissionThe account
Trade under the contract your data source gives: contract size, point, volume limits and step, swap, trading hours, stops levelOrders and the book

Replay and data

You canPage
Step the clock by ticks, candles or to a moment; seek; rewind; play at a speedMove the replay clock, the engine in your own program
Replay recorded ticks, ticks modelled from one-minute candles, the four prices of each minute, or opening prices — and see which was usedTick models
Read many timeframes, standard and custom, cut at one instant, with closed and forming candles told apartSeveral timeframes without look-ahead
Trade several markets under one account on one clockA strategy in Python, candle by candle, several markets at once
Bring your own files, or generate markets from a recipe and a seedImport your own files, generated markets
Read candles as NumPy columns, label them, split them without leakageDatasets and a fast first pass

Training at scale, and reproducibility

You canPage
Step several environments together, one workbench each; run several programs over one set of recordingsMany environments at once
Keep a state in memory and return to it in a millisecond; resume a workbench in another sittingSnapshots and branching
Get the same episode from the same seed, and the same fills from the same fill seedEpisodes and seeds, slippage, latency and spread
Tag runs in MLflow or Weights & Biases with the engine's build, seed and ledger hashThe engine in your own program

Checking and evaluating

You canPage
Verify fills, stops, money and determinism against the raw ticksChecking the engine yourself
Run sixteen checks of the engine on your own recordingThe verification battery
Compare a trade list with MetaTrader's tester or another backtesterAgainst another engine
Evaluate over seeds with an interquartile mean and an interval; keep count of every trialEvaluating a policy honestly, the trial ledger
Run the same policy on a paper or a real workbench, and compare what it saw with the laboratoryOn a live market

03What is yours

Bentrix gives you the facts; these are your design, computed in your own code from the book, the deals and the account:

  • The observation and the features — from candles, ticks, indicators, or your own sources.
  • The action space and how an action becomes orders.
  • The reward — any function of equity, drawdown, exposure, costs, holding time or anything else you can compute.
  • A logical session: a group of positions you treat as one. Keep the tickets; sum the deals.
  • Risk rules: limits on exposure, loss or margin, checked in your own code before an order is sent.
  • Risk and performance statistics: drawdown, expected shortfall, Sharpe, Sortino, Calmar and the rest, from the equity you record at each step and the deal list.
  • Train, validation and test periods: separate, non-overlapping date ranges that your environment draws its episode starts from — the one in an environment of your own draws its start from one range. An episode can never read past its own clock, so a training episode cannot see a test period that lies after it; keep the ranges apart and leave a gap between them as long as your longest observation window.
  • Your environment's own state beside a snapshot: counters, memory, random generators.

04What this version does not do

Said plainly, so that nobody builds on something that is not there:

Not thereWhat happens instead
Partial fills, several fills of one orderAn order fills whole, at one price.
A chance that an order is not filled or is rejected at randomAn order is refused only for a reason: volume, stops, margin, a closed market.
A limit on order size from the market's volume, and market impact on the fill priceSize is limited by the contract's maximum and by margin. The ready-made environment can charge the reward for size against a candle's volume (participation, impact); the fill itself is unchanged.
An expiry time on a pending orderIt rests until it is met or cancelled. Cancel it from your own loop at the time you choose.
A broker's freeze levelThe stops level is enforced; no separate freeze distance.
A trailing stop moved at every tick on the engineIt is moved when your program calls settle(). A fixed stop is watched at every tick.
The time a position was opened, its commission and swap, on the position itselfIn its deals.
The largest adverse and favourable move of a position (MAE, MFE), kept by the venueRecord the open profit of each position at each step in your own code.
A tag or a comment of your own on an orderKeep a table from ticket to your own data.
A snapshot saved to a fileA snapshot lives in memory; a closed workbench is on disk and resumes.
Environments in parallel threads inside one programOne program steps its environments one after another; several programs run side by side.
An event for each order state on the engineRead last_answer after a send, and the deals.
A ready library of risk statistics in PythonCompute them from your recorded equity and the deals.

05Requirements

Python 3.9 or later; pip install "bentrix[gym]"; Bentrix installed on the computer; the engine in your own program needs an account on Plus or Pro. The engine reaches laboratory and paper workbenches. A real account is reached only through the open application, where the person decides how an agent's orders are sent: real accounts and safety.

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed