The cycle
One cycle is one pass from what the market is doing to a decision that is either an intent or a refusal with a reason. It is the unit this project works in, and the unit an auditor replays.
tra init my-desk --profile autonomous # the core laid down wired, the experiments commented
tra init my-desk --profile rule # the example daily rule as the one decision, no model
tra run # data.toml, strategy.toml, envelope.toml and .env from the project
tra run --instrument ETHUSDT --margin 5 --mode signals
tra run --every 15m --cycles 12 # one cycle every fifteen minutes, on the boundaryA rule as the one decision
The decision can be a rule rather than a model: a class in your own file with a name and decide_on_bars(bars), which reads the decision interval's closed bars and answers with one idea (a side, the stop and the take in bps, the longest hold in bars) or none. No model is asked and no [agents] table is needed. Everything after the decision is the cycle every desk runs: the round trip priced on the book, the exits, the paths reading, the gates you declared, the risk gate and the venue.
[strategy]
file = "strategies/momentum_long.py" # an example, not a recommendation
class = "MomentumLong"
edge_bps = 105 # the rule's mean net per trade from your own arena run
lookback_bars = 200 # closed candles the rule is handed
[exit]
mode = "analyst"
max_stop_frac = 0.12 # a rule's stop past this refuses the trade
timeout_bars = 6- The arena asks the same rule the same way (
--rows strategies/momentum_long.py:MomentumLong), on the same closed bars, so a replay and a run share one code path. On five years of Binance USD-M hours for BTC, ETH and SOL the example decided exactly as the arena's fixedmomentum_longrow. edge_bpsis required and is what the cost gate weighs the round trip against. Nothing guesses it: take it from your owntra arenarun, on your own costs.- The package ships no rule.
tra init --profile rulecopies the example beside your config.tra backtest,paperandlivefeed a bar-by-bar strategy and refuse a rule by name.
Running it on a schedule
--every runs a cycle on the interval's own boundary, so a cycle reads a bar that has finished happening rather than one that is half built. One process, no cron, no daemon: the loop is in the same command, and everything that should end it ends it by name.
The first pass runs as soon as the desk starts. After that, passes land on the clock: with --every 30m they fall at :00 and :30 UTC, with --every 15m at :00, :15, :30 and :45. So the wait after a pass is whatever is left to the next boundary, not a full interval, and a pass that takes several minutes shortens it further. The desk says it plainly after every pass, for example next pass at 08:30:00 UTC, in 20m 00s.
| Ends the loop | Why |
|---|---|
| the budget | a cycle that stopped because the token budget is spent will not be followed by one that costs more |
| the kill switch | the file named in [controls].kill_switch exists |
--cycles N | N scheduled passes, whether or not the trigger let a cycle through |
| a keyboard interrupt | the operator stopped it; the cycle that was running is already on disk |
| SIGTERM, SIGHUP, SIGBREAK | a service manager stopping the desk, or an SSH session dropping; handled exactly like Ctrl-C |
Some lines end the day's entries without ending the run. While one of them holds, each pass still looks after open positions (time exits, venue exits, the kill switch) and asks no model:
| Holds new entries | Until | Set with |
|---|---|---|
| the pause switch | the file is removed | tra pause (writes PAUSE), tra pause --off; or [controls].pause_switch names another file |
| the daily token budget | 00:00 UTC | [agents].daily_token_budget: tokens recorded today by every role and both auditors, across runs and restarts |
| the daily cost budget | 00:00 UTC | [agents].daily_cost_budget: the same in model cost, from [agents.pricing] |
| trades per day | 00:00 UTC | [controls].max_trades_per_day: orders written today across every instrument |
| a losing streak | 00:00 UTC | [controls].max_losing_streak: losing round trips in a row today; a winner resets it |
| the daily loss limit | 00:00 UTC | [controls].daily_loss_limit_bps, checked inside each cycle |
| the drawdown limit | the peak file is cleared | [controls].max_drawdown_bps, with on_drawdown = "flatten" to flatten and stop as well |
tra kill writes the kill switch file ([controls].kill_switch), so the next pass flattens and stops; tra kill --off removes it. tra check prints every line in force on one row. Each count is read from the records on disk, so restarting a desk does not reset a day.
A refusal is not a reason to stop. A cycle that refused because a gate said no is a cycle that did its job, and the next one decides again with fresh figures. The frequency cap in [targets] still applies across the whole day, so an interval shorter than the desk's own limit simply produces more refusals, each one named.
Every start and stop of tra run is one line in runs/cycles/scheduler.jsonl: when it started, what it watched, in which mode, and what stopped it after how many cycles. Each cycle already keeps its own directory; this file is what says when the desk was running at all, which matters on a server whose terminal output nobody kept.
{"at": "2026-10-04T06:56:38+00:00", "event": "started", "every_s": 300.0, "mode": "venue", ...}
{"at": "2026-10-04T09:12:04+00:00", "event": "stopped", "stopped_by": "SIGTERM from outside the process", "cycles": 27}Stopping while an order rests on the book. A maker entry waits up to [execution].limit_timeout_s for a fill. If the process is told to stop during that wait, the order is cancelled first, placed.json and cycle.json say so ("interrupted": true, and whether the cancel went through), and only then does the run end. Stopping between cycles exits with the last cycle's outcome; stopping inside one always exits as a refusal, so a supervisor can tell the two apart.
A send that is never answered. A create call can time out after the venue took the order. The order hand never sends a second one: it looks for the order by the client id it carried, a few times, a second apart. Found, the cycle carries on with what the venue listed ("recovered" says why). Not found, placed.json says "status": "UNKNOWN" - neither filled nor failed - and the order is written to unknown_orders.jsonl. While it is there, the risk gate admits no new entry on that instrument; every pass looks for it again, and it is resolved when the venue lists it (it is then looked after like any filled entry) or when ten minutes pass with every order list readable. A venue that answered no (InsufficientFunds, InvalidOrder) is a refusal, recorded and not retried; a duplicate client id is read back like a timeout, because it proves the order exists.
One case nothing in a process can cover: closing a Windows console window. Windows gives the process a few seconds and ends it whatever it is doing. What protects capital then is what was already at the venue - the stop and take profit travel with the entry, and the next cycle refuses while any order still works on the instrument. A desk that has to survive its terminal belongs under a supervisor, not in a window.
tra init my-desk --profile autonomous is the short way in. It writes the same project as tra init, with these differences: the structure lead is the core, deciding on 15-minute bars with the hour and four hours as context and naming its own stop and target; [execution].mode is sandbox; and the project's README opens with what is still yours before a cycle can decide anything - a model and its key, and the mechanism the analyst reasons from. Add --agent PROVIDER --model MODEL and the model is named for you. tra check names whatever is still missing, including the provider placeholder, and reads the three files against each other: the instrument as the sources know it, a venue supplying data that is not the venue whose fees are priced, and an [execution].venue that does not match [run].venue_key - that last one is a refusal rather than a note.
What it writes is the core and nothing more: data, one decision, the exits, the cost gate, the risk gate and execution, with [trigger] deciding when a cycle is worth asking. Everything else that can refuse or resize a trade is an experiment: the confluence matrix, the conviction ladder, a regime the setup must fit, the trigger's widening, a floor in bps beside the multiple, reviewers, the team and the readings. They are written commented, under "Experiments", because none has been measured against the core yet. tra check lists the ones a desk has on. Turn on one at a time, and keep it only if tra arena shows the core with it doing better than the core without it, out of sample.
the universe (system: one data pull each, the trigger per instrument, ordered by movement over cost)
-> the instrument this pass takes
-> snapshot (engine)
-> trigger (system: has anything moved? nothing below here runs if not)
-> briefs (system, each role's own sections only)
-> readings (system: your thresholds over macro, on-chain, sentiment series)
-> structure lead (proposes a direction; with a team, a blind confirmer must agree and a
flow specialist reads the book, funding and open interest)
-> the round trip priced (system)
-> the stop and the target (the lead's levels, held in your [exit] bounds)
-> paths (system: how often the instrument's own paths reach the take before the
stop at these levels; recorded as a risk reading, and a floor only
when [targets].min_path_ev_bps is declared)
-> reviewers (when configured: pro and contra apart, then neutral judges both)
-> confluence matrix (system: declared states and votes) -> whether to trade at all
-> conviction (system: the same voices, weighted) -> how much the desk wants on
-> sizing (system, when [sizing] is declared: Kelly from the desk's own round trips,
cut for the drawdown ahead) -> how much the record supports
-> risk per trade (system: the loss at the stop, round trip included, against equity)
-> how much it can afford
-> the desk (system: what the whole book is already carrying) -> whether it fits
-> cost gate (system: the claim against the cost)
-> targets (system: net bps, the edge over the cost, reward-to-risk, research, count)
-> risk gate (system: hard caps, the loss at the stop recomputed from the intent, the
switches, unanswered sends, today's trades and losses; signs the intent)
-> intent, or a refusal that names the figure that refused itNothing in that line is optional and nothing in it is reordered. The engine fetches; the system computes; models read figures and answer inside a schema; the system prices the round trip and decides whether the claim clears it. In the default mode the intent is written to the cycle's own directory and no order leaves the machine.
Which instrument, before any of this
A desk that watches one instrument runs it. A desk that declares a universe takes the cheap look first, and only then spends a cycle. The system finds, measures and orders; no model chooses.
[universe]
instruments = ["BTCUSDT"] # always looked at, whatever discovery finds
discover = true # add the venue's most traded perpetuals each pass
top = 20 # how many discovery adds
min_quote_volume = 10000000 # 24-hour volume in quote currency
max_spread_bps = 5 # the book now, from the venue's ticker
min_listed_days = 30 # nothing listed this month
crypto_only = true # leave out stocks, ETFs, commodities and currencies
exclude = [] # instruments never to take
quote = "USDT" # the settlement currency to look in
# type_field = "symbolType" # the venue's own market field that says what a market is,
# exclude_types = ["stock", "etf", "commodity", "forex"] # and the values to leave out
max_per_cycle = 1 # how many one pass runs a full cycle on
max_intents_per_day = 6 # held as [controls].max_trades_per_day since 0.13Discovery (system, every pass). One market list and one ticker call cover every linear perpetual the venue lists in quote (USDT by default). The system removes what cannot be traded: too little volume, a book wider than max_spread_bps, listed too recently, not crypto, or a maximum leverage below [execution].leverage. Bybit marks its stock, ETF, commodity and currency perpetuals, and that is the default there; for any other venue, type_field and exclude_types name the venue's own field and the values to leave out, and exclude takes out single instruments. Every one of these is yours to set: the defaults are a starting point, not the screen. The most traded top join the declared instruments. Each discovered instrument carries the venue's own symbol and size step, so an order is never sent under the wrong market or off the step. Discovery needs [run].size_quote and [controls].max_position_quote: one base size, or one cap counted in units, across coins priced from cents to tens of thousands is no size and no cap at all. With a quote cap declared, every instrument is capped at that much quote currency at its own mid, and [controls].max_position (units) still applies to [run].instrument, the one it was written for. tra universe shows what discovery finds right now and what each filter took out.
Measurement (system). Each instrument gets one data pull, the book and the recent bars, no tokens. The same [trigger] and desk limits apply to each. What survives is measured: the move since the last look and its pressure against the spread, the window's move, z-score, trend strength and regime, volume against the window, where the close sits in its range, 24-hour volume and change, and the correlation with BTC.
Order (system). What the trigger admitted is ordered by its room: the range the instrument's own paths draw over the next 24 bars (see the paths) against the spread it costs to cross. A market expected to move far for what it costs is worth a cycle before one that has merely moved; the move already seen against the spread orders what the paths cannot read (too few candles), and the order you wrote breaks the last tie. runs/screens/<time>.json keeps every candidate with its room and pressure and the code_order.
Until 0.12 a market screener, a model, could narrow and reorder this list. It was retired: ordering by a measured, forward-looking range is what it was asked to judge, and the system answers it the same way every time at no cost. [universe].screener is still read, so an older desk runs, and does nothing; tra check says so.
Each instrument keeps its own history: its own trigger streak, its own carried research spend, its own daily round trips. A position on an instrument discovery stops listing is still counted by the desk and looked after by the keeper until it closes. [controls].max_trades_per_day is the one figure that counts the whole desk; [universe].max_intents_per_day counted the same intents and is held as it since 0.13, the smaller where both are declared.
Before anyone is asked: the trigger
A five minute schedule is two hundred and eighty-eight passes a day, and a fifteen minute one ninety-six. Most of them should refuse, and refusing is the right answer - but the tokens were spent finding that out, and a desk that spends more on research than it can win on a trade is not a desk. The answer is not to abandon the schedule. It is to put a check in front of it that costs nothing.
[trigger]
min_move_bps = 15 # the mid has to have moved this far since the last cycle
# min_move_atr = 0.25 # or a fraction of the instrument's own ATR; the bps above when
# # the ATR cannot be read (an experiment, like the widening)
max_spread_bps = 8 # a book wider than this cannot be traded through
cooldown_s = 900 # one decision per instrument in this window
widen_after = 6 # after this many straight refusals, ask for more movement
look_valid_for = "1h" # a last look older than this counts as a first look; 1h by defaultEvery figure it reads is free: the touch of the snapshot the cycle has already taken, the cycle summaries on disk, the clock, and the count of intents already written today. A cycle that holds costs one data pull and no tokens, and the hold is written down with its arithmetic - what the mid moved, what the desk asked for, and why.
"Since the last look" is measured against the latest mid the desk recorded for that instrument, whether in a cycle or in a pass over the universe. A pass looks at every instrument but runs a cycle on a few, so the passes are the record that matters. A last look older than look_valid_for is dropped, and the instrument is a first look: it has no move to report, and the trigger admits it instead of measuring hours of drift against it.
widen_after is the part that answers a whole quiet day. After a run of refusals with nothing changing, the movement required grows with the streak, to a hard ceiling of eight times the declared minimum so a desk can never be talked into going blind. The streak is the refused cycles since the last intent, and a real move ends it as well: when the mid moved at least min_move_bps between two refused cycles, only the refusals after that move count. Either brings the bar straight back to the baseline. A cycle the trigger itself held does not count towards the streak, and neither does one that stopped before the lead was asked (data that would not come, a loss limit): that is the desk not looking, not the desk looking and finding nothing.
tra run --now asks the roster whatever the trigger would have said. The override is written into the cycle, so a reader can tell a forced cycle from a natural one.
What a cycle leaves behind
runs/cycles/2026-09-27T14-51-23Z-BTCUSDT/
snapshot.json every value the engine fetched, with source, tier and age
inputs.json.gz the raw inputs: candles on every timeframe, the book levels,
funding, open interest, and the settings the briefs were
computed with
briefs/structure_lead.json the figures the lead was given, computed here, not by the model
briefs/cost.json what a round trip would cost, per component
briefs/risk_gate.json every check the risk gate ran, and why it refused if it did
briefs/reviewer_pro.json the proposal and the figures a reviewer was given
answers/structure_lead.json what the model answered, as it answered it
intents.jsonl the intent, if the gates and the risk gate admitted one
placed.json what the venue did with it, in venue mode
cycle.json the whole cycle in one file, with a sha256 of every file above
runs/cycles/index/2026-09-27.jsonl one line per cycle that day, with the hash of its cycle.jsonA cycle written before 0.12 names the lead's brief and answer technical.json. Everything that reads them, tra runs verify and the lead's own previous reading included, takes either name.
A cycle that refuses writes the same files minus the intent. That is the point: a refusal is a result, and it is as readable as a trade.
Keeping the record honest
Everything is files: JSON, JSON lines, gzip and Parquet. There is no database and no cache server to run, and every record can be read with a text editor.
| Concern | What the desk does |
|---|---|
| a crash in the middle of a write | appends end with a newline guard, so a torn line costs only itself; order, position and equity records wait for the disk; whole files are written beside and renamed into place |
| a brief nobody can check | inputs.json.gz keeps what the brief was computed from; tra runs verify computes the lead's figures again and compares them |
| a record changed after the fact | cycle.json holds a sha256 of every file in the cycle, and the day's index line holds the hash of cycle.json; tra runs verify checks both |
| a desk that has run for months | the trigger, the targets, the desk limits and the position keeper read the day index, not every directory, so a cycle costs the same on day 300 as on day 1 |
| disk use | tra runs prune --keep 90d says what it would remove; --yes removes it, --archive zips each month first; the index and the logs are kept, so the desk's memory of its own past does not change |
A desk that ran before the index existed builds it from its cycle directories on its first cycle. A cycle that stopped before writing its index line, a crash or an interrupt at the venue, is still read from its directory, so an order it sent is never missing from what the desk knows.
Briefs: the model does no arithmetic
The structure brief carries returns over several horizons, the close as a z-score of its window, the distance from VWAP, the volume and range ratios, where the close sits in the window's range, the current spread, the funding rate that stands, and the age of the candles it was built from. The model receives those numbers and answers with a target, a confidence, a horizon and a reason. It never adds anything up, so a wrong sum is a bug in the system with a test, not a sentence in a prompt.
The market around the decision
A desk decides on one timeframe and reads the bigger picture before it does. The brief carries that picture too, all of it computed by the system from the snapshot:
| Figure | What it says | Where it comes from |
|---|---|---|
regime | trending up, trending down, ranging or mixed, on the decision timeframe | trend_strength against the lines in [regime] |
trend_strength | net move over the path walked, times the square root of the steps; a random walk sits near 1 on any window | the window's closes |
market_structure | the trend the swings make, the last break of structure or change of character, the level whose loss changes the trend, and the nearest unbroken support and resistance; see Market structure | the window's bars |
variance_ratio | the variance of four-bar returns against four times that of one-bar returns: below 1 the window's moves were given back, above 1 they were followed by more of the same, near 1 is a random walk | the window's closes |
window_move_bps | the price move from the first close of the window to the last; a market move, not the trade's net | the window's closes |
timeframes.<tf> | the same regime, net move, z-score and position in range on each higher timeframe, with its structure and its last structure event | [run].context_intervals, one candle pull each |
book_imbalance | resting bids against resting asks over the first 10 levels, from -1 to 1; positive leans to the bid | the order book already in the snapshot |
open_interest | the change in percent since the previous snapshot of this instrument, and how long ago that was | the open interest already pulled, and the last snapshot on disk |
Nothing here is required. A higher timeframe the venue cannot serve is named in the refusals and left out, and so is an open interest with nothing earlier to compare it to.
[run]
bar_interval_s = 900 # what `tra init --agent` writes: 15m decisions
context_intervals = ["1h", "4h"] # up to three, each a whole multiple of bar_interval_s
[regime]
trend_above = 2.0 # trend_strength at or above this is a trend
range_below = 1.0 # at or below this is a range; between the two is mixed
setups_must_fit = true # false: a misfit is written down and the trade goes on
fade_below_variance_ratio = 1.0 # a range fade needs the window's variance ratio below this; 0 is offMarket structure
The system reads structure from the swings before any model is asked, and the analyst is given what it read. A swing high is a bar whose high stands above the two bars on each side of it; a swing low the same, below. Swings alternate: two highs with no low between them are one swing, the higher. Each swing is labelled against the last one of its kind.
| Last high | Last low | trend |
|---|---|---|
| HH | HL | uptrend |
| LH | LL | downtrend |
| LH | HL | range, contracting |
| HH | LL | range, expanding |
| fewer than two of either | unclear |
What the closes did after the last two swings is the event. Only a close counts; a wick through a level and back is not a break.
event | When |
|---|---|
bullish break of structure | in an uptrend, a close above the last swing high: the trend went on |
bearish break of structure | in a downtrend, a close below the last swing low |
bearish change of character | in an uptrend, a close below the last swing low: the higher low the trend leaned on gave way |
bullish change of character | in a downtrend, a close above the last swing high |
break above the range, break below the range | in a range, a close outside its last high or low |
invalidation is the swing whose loss changes the trend: the last higher low in an uptrend, the last lower high in a downtrend. support and resistance are the nearest swing low below the close and swing high above it that no later close went through, each with its distance in bps. The analyst is told to put a stop beyond the level its idea leans on and a target at the next one, from these figures.
The same trend and event are read on every timeframe in [run].context_intervals, so a 15m long in a 4h downtrend is visible as exactly that. tra run prints the structure beside the regime.
A setup has to fit what the system measured. Each setup is a claim with a direction built into it, and the figures that make the claim are in the brief. On the decision timeframe, the system refuses:
| Setup | Refused when |
|---|---|
trend_continuation, pullback_in_trend | the market is not measured as trending (ranging or mixed), the trade points against the trend, or it points against the market structure (a long in a downtrend, a short in an uptrend) when the structure has not just changed character |
range_reversion | the market is not measured as a range (trending, or mixed with a measured trend strength), the window's moves have been carrying on (variance ratio at or above fade_below_variance_ratio), or the trade does not fade the stretch: a long with the close at or above the window's mean (z-score 0 or more), a short at or below it |
momentum_exhaustion | the trade goes with the move it says is exhausted: with the trend, or with the window's move |
range_breakout | the trade is on the other side from where the close sits: a long with the close in the lower half of the range, a short in the upper half |
volatility_expansion | never on direction: it is about a regime changing, not which way |
The rule came from a live cycle on 2026-10-08: a pullback_in_trend short in a market measured as mixed and rising over the window, which the earlier rule let through because it only checked trends it could measure. A short setup against a higher timeframe's trend is still left to the analyst to weigh, because fading the hourly on the minute chart is sometimes the whole trade; the reason has to say so. With setups_must_fit = false a misfit is written down and the trade goes on. tra check prints the lines and the timeframes in use.
Why the variance ratio, and not trend strength alone: a window can net out to nothing, and read as a range, while each move inside it is followed by more of the same. A fade is paid only where moves are given back, so that is what it is held to. The line sits at 1, the random walk, rather than at a value fitted to any desk's trades.
The fade has been held to the same standard as the trend setups since 0.6.4. Before that, range_reversion was refused only in a trend, so in a mixed market it was the one regime-bound setup still allowed.
The analyst picks the setup; the mechanism does not. In tra run the structure lead reads the regime and the higher timeframes first and names the setup the market supports. A mixed market takes range_breakout, momentum_exhaustion, volatility_expansion or flat. [agents].mechanism is your thesis: the setups you favour when the market offers them. It never turns a trending market into a fade, and the universe is ordered by where the market has room to move, not by one mechanism. tra init --agent writes a mechanism that names no setup ("trade the setup the measured regime supports: with a trend, inside a range, or flat"). Write a narrower one only if you trade a single idea. The research core in tra backtest and tra agent session is different: it trades one registered mechanism, by design.
The macro reading's regime is a different thing: risk-on or risk-off is about the world outside the chart, and it can disagree with what price is doing. Both are kept, apart: the structure lead does not see the macro state, and conviction weighs the macro reading's graded score against the structure lead's proposal after it has answered.
Who is asked, and what is read
One model is asked. Everything else beside the market is read by the system.
| Step | Reads | Gives | When |
|---|---|---|---|
structure_lead (a model) | the closed candles of the snapshot, the spread, the funding rate, the regime on each timeframe, the book imbalance, the open interest change; none of the readings | a target, a named setup, a confidence, a horizon, a reason, and the figures it read | every cycle; the role that proposes |
blind_confirmer (a model, optional) | the structure lead's brief, blind to its answer | the same, independently; the side must agree | when [agents].team names it |
flow_specialist (a model, optional) | the spread, the book imbalance, funding and open interest, which then leave the analyst's brief | a side and a confidence | when [agents].team names it |
macro (system) | macro series and the dated text of news.toml | the declared state of your thresholds and its graded score | when sources/macro.toml or sources/news.toml declares something, or --macro / --news names a file |
onchain (system) | chain figures and derivative figures, read side by side | the declared state and its graded score | when sources/onchain.toml or sources/derivatives.toml declares something, or --onchain / --derivatives |
sentiment (system) | dated scores, plus the same dated text as notes | the declared state and its graded score; undeclared when nothing crosses a line | when sources/sentiment.toml declares something, or --sentiment |
The readings ask no model. Until 0.11 each was an analyst whose model also labelled its figures; every gate already read the declared state rather than the label, measured on the demo desks the labels added nothing a decision could use, and they cost about a quarter of a cycle's tokens. [confluence].required, [conviction].weights and [agents].readings name them macro, onchain and sentiment; a desk that still writes the old analyst names runs unchanged, and tra check names the new one.
The shelf
A desk does not have one data source. It has a shelf of them, and the shelf changes when a subscription starts or a free endpoint goes away. So the declarations are one file per class of data, never one file per vendor:
my-run/
strategy.toml
data.toml live values for the cycle: candles, book, funding, open interest
sources/
macro.toml dated levels and rates
news.toml dated text: releases, statements, the desk's own notes
sentiment.toml dated scores: a fear index, a positioning score
onchain.toml dated chain figures: venue flows, supply held, active addresses
derivatives.toml dated funding, open interest, basisA vendor is a line inside one of those files, so replacing one with another is an edit in one place and nothing else in the project moves. tra init writes all five as forms with every entry commented out, and a form declares nothing: an untouched project asks only the structure lead and reads nothing else. Fill one in and its reading joins the roster on the next run. Two classes can feed one reading, which is why the on-chain reading takes chain and derivative figures together.
tra check reads the shelf without reading the data: it names what each file declares, names an export that is declared but not on disk, and prints the roster the next tra run will use. The older layout (series.toml, onchain.toml, sentiment.toml beside the config) is still read, so a project written before the shelf existed keeps working.
Each file goes through the same series engine as tra agent session: publish_lag decides when a figure became knowable, and a free CSV export and a paid vendor's dump are read the same way. The live numbers a cycle decides on are a different thing, and they come from data.toml with their age attached. Keeping them apart is what stops a daily file from standing in for a number that has to be fresh.
A file can keep itself current: a fetch line refreshes it from FRED, the Crypto Fear & Greed Index or any vendor that answers JSON over https, and tra run does that before each pass once the series' refresh interval has passed. Every series also has a max_age; a value older than that is shown as stale and never counted. Sources covers both.
Each reading goes through the same series engine as tra agent session, with the same as-of rule: a value is never used before the moment it was published, and the operator's publish_lag is what decides that moment.
Two habits are enforced rather than encouraged. Nothing is scraped: a role reads the files its operator declared, and the engine refreshes a fetched file. And a role with no source says so: its state is undeclared, never neutral, because those are different facts and an operator has to be able to tell them apart. A role whose files are all unreadable is not read at all, and the cycle records which files it could not read.
A role that asks a model can run on its own. [agents.roles.<role>] overrides the provider, the model, the output cap, the timeout and the retries for that role alone, and anything it does not override it inherits.
Where a direction came from
Two fields make the deciding analyst's answer reviewable a month later, and both are checked by the system before anything downstream sees them.
The setup. One name from a closed list - trend_continuation, pullback_in_trend, range_reversion, range_breakout, momentum_exhaustion, volatility_expansion, no_setup. A direction with no_setup is refused: a desk cannot review, count or compare a trade whose shape nobody named, and a paragraph is not a shape. The name travels into the intent, so "which setups have paid for themselves this month" is a question the records can answer.
The figures. Every role that says something about numbers answers with figures_used - each figure by the brief's own name, with the value it read - and the system checks each one against the brief it was handed. A figure that is not there, or a value that does not match, is discarded and the discard is recorded. For the analyst that decides it has teeth: if not one citation survives, the cycle refuses, because a direction that cannot point at a figure in its own brief came from somewhere this cycle cannot see.
The check is fair about names. A brief carries a row per series, so one number's full name is series.us10y.correlation_measured.value, and no model writes that when it means "the correlation". A citation resolves when its words are the tail of exactly one figure's name; where several share a tail, the shallowest wins; and a block measured with its own sample size resolves to the number in it. Nothing about that loosens the rule - whichever figure a citation lands on, the value still has to match, so a citation that resolved to the wrong figure is discarded anyway.
Every role inside its own job
A desk works because a job has edges. The analyst that reads the bars does not size the order, the role that prices the round trip does not decide whether the idea is any good, and none of them places anything. Four things keep a role inside its job, and only the last is words:
| Enforced by | What it prevents |
|---|---|
| the brief | A role cannot reason about what it was never given. No reviewer's brief carries equity, size, the controls or the exit distances. agents/scope.py filters every brief to that role's declared reads, and what it removed is written in the record. |
| the schema | A closed schema with only that role's own fields. A reviewer has nowhere to put a size, and a field outside the schema is a parse error rather than a surprise. |
| the wiring | Nothing downstream reads a sentence. The confluence matrix and the conviction score read the declared state the system derived from the operator's thresholds; the cost gate reads the snapshot's own book; the size comes from the operator's ladder and caps. |
| the prompt | One line naming what is not this role's job, plus a small vocabulary the system looks for in case it appears anyway. |
The last line needs care and gets the least authority. Pattern-matching prose is blunt, and "buy" and "sell" belong in a proper sentence about what a central bank did, so the vocabulary is only the phrases that carry an order or a size - "go long", "stop loss", "position size", "leverage". A hit is recorded as a crossing beside the answer and changes nothing, because the answer was never what decides. We cannot stop a model from writing a sentence; we can make the sentence carry no authority and leave a mark when it tries to.
The same check looks for a rule a role made up. No role is told the desk's rules, so an answer that says "the desk requires" or names a desk minimum is stating one that does not exist. That is recorded for every role, the structure lead included, and changes nothing: the rules that apply are the ones in your configuration, run by the system after the answer.
The confluence matrix
Deterministic, in the configuration, reading the declared state rather than the model's label:
[confluence]
required = ["macro", "onchain"]
long_states = ["bullish"]
short_states = ["bearish"]
on_missing = "refuse" # refuse | ignore
min_support = 1 # reviewers that must support it
max_opposition = 0 # reviewers that may oppose it; 0 is the strictest there isIt fails closed. A required role whose declaration is undeclared or mixed has produced no state, and a state nobody produced is not a neutral state: the cycle refuses and names the role. An operator who means to run on one leg writes on_missing = "ignore", and the record says they did. tra check refuses a matrix that can never pass - a required role the roster does not ask, or more support required than there are reviewers to give it.
The reviewers
Three stances of one role, asked after the deciding analyst answers and after the round trip is priced:
[agents]
reviewers = ["pro", "contra", "neutral"]With all three, they work as a judged case rather than a vote:
proposal -> pro (the strongest case that the reading is right) \ apart, at the same time,
-> contra (the strongest case that it is wrong or noise) / neither sees the other
-> the system checks every claim in both cases against the figures
-> neutral (judges the two checked cases) -> the one verdict that countsPro looks for what makes the setup real: the regime and structure it belongs in, higher timeframes agreeing, a move beyond one bar's ordinary range, levels resting on structure. Contra looks for what makes it wrong, early or noise: a regime or structure it does not fit, a higher timeframe against it, a move inside the noise, a stop inside that noise, a target behind the next level, a book leaning the other way. Neither is told what the other found.
Neutral then reads both cases, but only the claims that survived the check, so an invented figure never reaches the judge, and not the advocates' own verdicts, so it weighs evidence rather than votes. It is told to weigh claims about the premise of the setup above claims about details, to treat several claims that say the same thing as one, and to abstain only when the two cases are even. Its verdict is the one that counts in confluence and conviction.
When there is nothing to weigh, the system decides without paying for the call: no surviving claim on either side is an abstention, a contra with nothing that holds is support, a pro with nothing that holds is opposition, and the record says neutral was not asked.
Every stance receives the proposal and the figures it was built from: not the round trip, not the claimed edge, and not the macro, on-chain or sentiment readings, which the system weighs once in conviction. Each answers with claims that cite a figure by the brief's own name, with that figure's value:
{"stance": "contra",
"claims": [{"figure": "atr_bps", "value": "61.32", "says": "the last move is inside one bar's range"}],
"verdict": "oppose",
"reason": "..."}A figure that is not in the brief is discarded, a value that does not match is discarded, both are recorded, and a verdict with no surviving claim becomes abstain. A claim may round the figure it cites: "-1.63" against a brief's "-1.631" is the same citation said with fewer digits, and it is kept.
Why it is built this way: when the three were asked side by side and each counted, pro supported 63 times in 64 and contra opposed 61 times in 63 on the first demo desk, so their votes carried their assignment and nothing else, and a neutral asked alone on the OKX demo desk abstained in 33 of 37 cycles. An advocate's value is the evidence it finds; the decision belongs to the role that sees both sides.
Each stance is one more call, which is why they are off until an operator asks for them; with all three, a cycle makes two calls at once and then at most one more.
What counts, and where, is yours to declare:
| Where | Setting | Effect |
|---|---|---|
| the confluence matrix | [confluence].min_support, max_opposition | a hard gate: too few supports or too many opposes refuses the trade |
| conviction | [conviction].reviewer_weight | each counted vote that says something adds or takes away that weight; the size follows the score |
With neither declared, the verdicts are recorded and move nothing, and tra check says so.
Other sets of stances still work. Neutral alone weighs the proposal itself. Pro or contra without neutral are counted for what they say beyond their stance: a pro that supports or a contra that opposes says nothing new and weighs nothing in conviction, while a pro that abstains or opposes counts as opposition and a contra that abstains or supports counts as support.
Conviction: who weighs the voices, and how much goes behind the idea
The matrix answers whether the context agrees with the direction. [conviction] answers the question a desk actually has next: how much. The voices are allowed to disagree - crypto doesn't move in straight lines, and a macro reading against a technical setup is ordinary. What matters is how strong each side is, so every voice counts as strong as it actually is.
[conviction]
weights = { structure_lead = 2.0, onchain = 1.5, macro = 1.0, sentiment = 0.5 }
reviewer_weight = 1.0
min_score = 0.4 # below this the desk does not trade
max_leverage = 3.0 # notional against [run].equity; a ceiling, never a target
[[conviction.ladder]]
at_least = 0.75 # the case is strong and the context backs it: the whole base size
size_multiple = 1.0
[[conviction.ladder]]
at_least = 0.55
size_multiple = 0.5
[[conviction.ladder]]
at_least = 0.4
size_multiple = 0.25Each reading's score
Each reading's score is computed by the system from its own figures against the lines you drew in sources/*.toml, signed for the instrument and between -1 and 1:
threshold = { bullish_below = 4.05, bearish_above = 4.25 } # US10Y: low yields are good for cryptoThe two lines make a neutral band 0.20 wide. A yield of 4.02 is 0.03 past the bullish line, which is 0.15 of a band: a score of +0.15, barely bullish. A yield of 3.80 is more than a full band past it: +1.0. Anything inside the band is 0. With several series, the reading's score is their average. A threshold with only one line declared has no band to measure against, so it counts as a full +1 or -1 whenever it is crossed, and tra check says so.
No model reads these figures. The score is what gets weighed, because it comes out the same every time from the same figures, and the record keeps every series it came from.
Adding them up
| Voice | Brings | Counts toward the total by |
|---|---|---|
| the deciding analyst | weight * confidence | weight |
| a reading | weight * score, plus when it agrees with the direction, minus when against | weight * abs(score) |
| a reading with nothing past its lines | 0 | nothing; it is listed as silent |
| a reviewer that supports, after its claims were checked | +reviewer_weight | reviewer_weight |
| a reviewer that opposes | -reviewer_weight | reviewer_weight |
score = max(0, what they bring) / what they count toward, so it sits between 0 and 1. With nobody else speaking it is the deciding analyst's own confidence. Agreement lifts it, opposition lowers it in proportion to how strong the opposition is, and only opposition that outweighs the case takes it to zero. Silence neither lifts nor dilutes it: a reading barely past its line moves the score barely, and silence is the limit of that.
The first rung of the ladder the score reaches gives the size multiple, and then every cap that already existed still applies: [controls].max_position, the notional ceiling implied by max_leverage against [run].equity, the risk per trade, the desk limit, and the venue's step, rounding down and never up.
Worked through, with the weights above
| What the desk sees | Score | Size |
|---|---|---|
| a short at 0.70, macro barely bullish (+0.15), sentiment barely bullish (+0.057) | 1.222 / 2.178 = 0.561 | half the base |
| a long at 0.70, macro +0.6, on-chain +0.5, sentiment -0.4 | 2.55 / 3.55 = 0.718 | half the base |
| a long at 0.90, every reading a full band in agreement, the judge for | 5.8 / 6.0 = 0.967 | the whole base |
| a short at 0.70, every reading a full band bullish | below zero, so 0 | no trade |
The first row is a real cycle from 2026-10-04. Before scores were graded it read as two full voices against and refused at 0; as figures it is a small dent in a clear case.
The size is still a rule rather than a judgement. A model asked "how big should this be" answers differently on Tuesday than on Monday from the same figures, and a size that depends on which sentence was written last cannot be backtested, reproduced or audited. Leverage is not a lever any role pulls either - it is what the notional works out to against the equity, and max_leverage is the ceiling on that.
The confluence matrix above is different on purpose: it reads the words, not the scores, and a reading you list in required vetoes when it points the other way however slightly. Use it only for the readings you really want to have a veto; leave the rest to conviction.
When the size the ladder chooses is not the base size, the round trip is priced again at the size that is actually going out, because impact is a function of size. The cost in the record is the cost of the trade that was admitted.
The base size, said once
[run].size is in base units, which is fine for a desk on one instrument and awkward for a desk on several: 0.01 is eight hundred dollars of BTC and twenty-seven of ETH. A desk that watches more than one instrument says it in quote currency instead:
[run]
size_quote = 100 # quote currency, per order, before conviction
size_step = { BTCUSDT = 0.001, ETHUSDT = 0.01, SOLUSDT = 0.1 }- Exactly one of
sizeandsize_quoteis declared. Two figures that could disagree are refused when the file is read. - The cycle converts it at its own mid, after the trigger and before any model is asked, and rounds down to the instrument's step. A size that comes to less than one step stops the cycle there and costs nothing. The conversion is in
cycle.jsonundersize: the quote amount, the mid, the step and the base size it became. size_stepmay be one number or a table with one increment per instrument. Venues step instruments differently (Bybit: BTC 0.001, ETH 0.01, SOL 0.1), and a table must name every instrument the desk can trade.- Everything after the conversion is unchanged: the conviction ladder multiplies it, and
[controls].max_position, the leverage ceiling and the risk per trade cut it.max_positionis still in base units, so on a quote-sized desk it caps each instrument at that many units whatever they are worth;tra checksays so. - A replay, paper or live session trades one fixed size and has no cycle mid to convert at, so it refuses
size_quoteby name and asks for[run].size.
tra check puts the size against the venue cap before a cycle is paid for: a size_quote above [execution].max_notional is a refusal, and a ladder whose top rung would cross the cap is named.
In venue mode the hand also checks the size against the venue's own market before sending. ccxt rounds an amount to the market's precision on its way out - 0.036 ETH goes out as 0.03 - which is a different trade from the one the cycle priced and wrote down. A size off the venue's step, or under its minimum, is refused with both figures instead.
Risk per trade: the size the account can afford
Conviction answers how much of the base size the desk wants behind an idea. That is a different question from how much the account can afford to be wrong about, and the second one is what a risk manager is paid to ask: with the stop where it is, what does this position lose if it is hit?
[controls]
max_risk_per_trade_bps = 50 # of [run].equity, at the stop from [exit]The arithmetic is what a stopped-out position loses: the distance to the stop plus the round trip it pays on the way in and out, times the size, against the equity, in basis points. The round trip is priced at the size being checked or the base, whichever is larger, so neither a conviction rung above 1x nor the cut that follows understates it, and the cap is decided on the exact figure, not the one rounded for the record. If it is over the allowance, the size is cut until it fits - never the stop moved, because moving a stop to make a trade fit is how a desk learns the wrong lesson from a loss. If the size that would fit is below one step of the venue, the cycle refuses. The cut and the figures behind it go into the record and into the intent, so risk_bps is there beside the size for every trade the desk took.
This is a fixed calculation, not a role. A model asked how much to risk answers differently on Tuesday than on Monday from the same figures, and the session runtime has always enforced this limit - a cycle that can send its own orders has to enforce it too. tra check refuses the combination that cannot be applied: a declared risk limit with no stop, or with no equity to measure against.
With [sizing] declared, the desk's own finished trades can lower that allowance: the Kelly fraction the record supports, a fraction of it, and a seeded Monte Carlo of the drawdown the next trades could take the account through. It never raises it, and a record that shows no edge refuses new entries. Sizing from the record has the arithmetic.
The desk: what the whole book may carry
Every bound before this one is about one position. A desk that watches three instruments can pass all of them three times over and still be carrying more than anyone decided to carry, because nothing was ever asked about the total.
[desk]
max_open_risk_bps = 150 # the sum of what every open position loses at its own stop
max_open_positions = 3 # how many instruments may be open at once
correlation_above = 0.7 # a candidate moving with something already open is one tradeThe first figure is the one that matters. A per-trade limit of fifty basis points is a different promise when one position is open and when six are, and only the sum says which promise is being kept. It is applied after the per-trade cap, so what it adds is the figure that trade actually carries rather than the one it asked for.
What counts as open comes from the venue in venue mode - the venue is the book, and it knows what filled and what an attached exit closed while nobody was watching - and from the intents on disk everywhere else. The cycle records which, in desk.source, so nobody has to guess how the total was reached. A position whose risk is not on the record refuses the next trade: a sum that quietly leaves something out is worse than no sum at all.
Expect this on a universe of majors. BTC, ETH and SOL move together on one-minute returns most of the time (0.82 to 0.86 on the demo desk on 2026-10-05), so with correlation_above = 0.8 one open position holds the other two back, and the desk carries one position at a time whatever max_open_positions says. That is the rule doing its job, and a pass that ran no cycle says so in those words. If you want more than one position, either raise the threshold (0.9 admits most pairs of majors) or watch instruments that do not move together. The hold applies whichever way the new trade would point, so a hedge against the open position is held too.
correlation_above belongs to the pass rather than the cycle, because it decides which instrument is worth a cycle at all. It is measured on the bars the pass already pulled - the correlation of bar-to-bar returns over the window, and nothing at all under twenty points, because a correlation on ten bars is a number with no claim behind it. A candidate moving with an open position at or above the threshold is refused with the figure and the name:
ETHUSDT: has been moving with BTCUSDT at 0.931 over the window, at or above the declared 0.7; one trade in two names is not two tradesThe targets
What the desk is trying to do, in numbers, checked before there is an intent:
[targets]
min_path_ev_bps = 0 # an experiment: worth at least this over its own paths
min_net_bps = 5 # an experiment: what must be left of the edge after costs
min_edge_multiple = 2.0 # an experiment: the edge, as a multiple of the round trip
min_reward_risk = 1.5 # take profit against stop, both from [exit]
max_research_bps = 25 # model spend since the last intent, against this notional
max_round_trips_per_day = 6 # intents already written today for this instrumentmin_path_ev_bps is an experiment, off unless declared: the trade's value over the instrument's own paths at its levels, net of the round trip. Declared, that value becomes the edge the other rules read. It is off because the paths are drawn from the instrument's own candles, a calibrated random walk, and over 16,458 readings their value told one moment from another no better than chance. min_edge_multiple and min_net_bps are experiments too. min_edge_multiple is the difference between trading and collecting tolls for a venue. A round trip costing 18 basis points against a claimed edge of 20 is not a two basis point trade: the fees are certain, the edge is a probability, and slippage only ever moves one of them. Live cost cannot be known exactly in advance either - the spread the cycle priced on is the spread it saw, not the one the order gets. Requiring the edge to be a multiple of the cost prices that asymmetry before a model is believed rather than after the fills come in. A real refusal reads: the claimed edge is 1.94x the round trip and the desk declared 2.0x; the cost is certain and the edge is not.
max_research_bps prices the other real cost. It is every model call since the desk last wrote an intent, against the notional of the trade those calls produced, so a day of refusals is paid for by whatever the day eventually trades rather than disappearing from the track record. It needs [agents.pricing.<model>] to mean anything, and tra check says so when the target is declared and the price is not - including when the declared price is zero.
The round trips are counted from the intents the cycles actually wrote today, not from a counter in memory: a process that restarts must not forget what it has already done. Every refusal names its figure, so "targets: net 4 bps is below the declared minimum 10 bps" is the whole explanation.
The targets panel reads the trade the way a trader does, then shows what the desk checked:
position short at about 86114.35
take profit 84392.06 price -2.00%, the position +200.00 bps
stop loss 86975.49 price +1.00%, the position -100.00 bps
reward : risk 2 : 1
expected edge 25.00 bps a trade on average; [agents].magnitude_bps, declared by the operator
and not measured here
round trip 12.46 bps, paid win or lose
after cost +12.54 bps (the edge is 2.01x the cost; the desk asks 2.0x)
model spend 0.00 bps of this notional; not priced: google:gemini-flash-latest
trades today 0 before this oneEach exit shows two numbers because a short gains when price falls: the price's move, and what that move does to the position.
Where the stop and the take profit sit
[exit].mode picks one of three ways. The analyst proposes, the system bounds, and you set the bounds.
Analyst is what tra init --agent writes, and what an agent desk uses when [exit] is left out. The structure lead names two prices with its decision: stop_price, where its reading is wrong (beyond the swing or the range edge the setup leans on), and target_price, where the mechanism is done. It is handed the window's range_high, range_low and atr to name them from. The system then:
| Check | What happens |
|---|---|
| a level on the wrong side of the price (a long's stop above it) | set aside; the measured stop below stands, and the record says why |
the stop inside min_stop_atr average true ranges (1 by default) | widened to it: a stop inside one bar's ordinary range is hit by noise before the idea is wrong, and the wider stop makes the position smaller, not the loss bigger |
the stop tighter than min_stop_frac or wider than max_stop_frac | held to that bound |
the target closer than min_reward_to_risk times the stop, when declared (an experiment, off by default) | the trade is refused; moving the analyst's target out would be inventing one |
the target past max_reward_to_risk times the stop | brought in to it; a far target makes the break even look easy and is rarely reached |
| no stop named | the volatility stop below; no target named, reward_to_risk times the stop |
[exit]
mode = "analyst"
min_stop_frac = 0.002 # a stop never tighter than 0.2 percent of price
max_stop_frac = 0.03 # and never wider than 3 percent
min_stop_atr = 1.0 # nor inside one bar's ordinary range; 0 turns this off
# min_reward_to_risk = 1.5 # an experiment: refuse a target closer than 1.5x the stop
max_reward_to_risk = 4.0 # a target past 4x the stop is brought in
stop_atr = 1.5 # with no level named: the measured stop
reward_to_risk = 2.0 # and the take profit at twice itSize still comes from [controls].max_risk_per_trade_bps against the stop that was placed, so an analyst who names a wide stop gets a smaller position, never a bigger loss.
Volatility measures the stop on every trade from the market it is in, whatever the analyst named:
stop = stop_atr x ATR(atr_bars) / price x sqrt(horizon bars), held in [min_stop_frac, max_stop_frac]
take profit = reward_to_risk x stop[exit]
mode = "volatility"
stop_atr = 1.5 # the stop in average true ranges
reward_to_risk = 2.0 # take profit against stop
min_stop_frac = 0.002 # never tighter than 0.2 percent of price
max_stop_frac = 0.03 # never wider than 3 percent
atr_bars = 14 # the defaultATR is Wilder's average true range on the decision timeframe's closed candles, the same figure a charting terminal shows, so any stop can be checked against one. A trade meant to last longer gets room to match: the square root of the analyst's horizon (capped by [exit].timeout_bars when the desk closes on time) is how far a market usually wanders in that many bars. Read off OKX's one-minute candles on 2026-10-10 with the defaults and a five-bar horizon:
| Instrument | ATR | Stop | Take profit |
|---|---|---|---|
| BTCUSDT | 1.4 bps | 20 bps (the floor) | 40 bps |
| SOLUSDT, 30 bars | 4.6 bps | 37 bps | 75 bps |
| FILUSDT | 10.8 bps | 36 bps | 72 bps |
| FILUSDT, 30 bars | 10.8 bps | 88 bps | 177 bps |
measure = "paths" measures the stop from the instrument's own paths instead (see the paths): where they reach against the side inside the hold, wicks included, at paths_quantile (0.9 by default, so one path in ten touches the stop on noise alone). It suits a market whose wicks the square root of time understates. The same floor, ceiling and reward to risk apply, and a reading that cannot be made (fewer than 30 closed candles, a market that did not move) refuses the trade rather than falling back to the ATR.
[exit]
mode = "volatility"
measure = "paths" # "atr", the default, or "paths"
paths_quantile = 0.9 # the share of paths the stop sits beyond, 0.5 to 0.99A wider stop does not mean a bigger loss. [controls].max_risk_per_trade_bps cuts the size until the loss at the stop fits, so a volatile coin with a wide stop puts the same share of equity at risk as BTC with a tight one, on a smaller position. The cycle record keeps the ATR, the horizon, the stop it measured and the bound that held it under exits.measured, and the cycle output says it in one line.
When the candles cannot give a range (fewer than atr_bars + 1 closed, or a market that did not move), the trade is refused with the reason. A guessed stop is not a stop. Volatility mode is for agent desks; a scripted strategy is simulated bar by bar and stays on fixed. Outside the agent cycle, where one number is needed up front, the widest stop the rule can place stands in, which overstates the risk rather than understating it.
Fixed puts every trade at the same distance:
[exit]
mode = "fixed" # the default when mode is left out
stop_frac = 0.01 # 1 percent of price, on the adverse side
take_profit_frac = 0.02It is simple and it is the same for every market, which is the problem: 1 percent is wide for BTC over a few minutes and narrow for a coin that moves that much in an hour. The two modes do not mix; a volatility key in a fixed table, or stop_frac in a volatility one, is refused rather than half read.
Either way, a take profit closer than the round trip is refused (exit: ... a winner would lose money): the best outcome the trade can have would still lose.
Why it is built this way
- The analyst proposes, the system bounds. Where an idea is wrong and where it is done is a reading of the chart, which is the analyst's job. How far that may be, how much it may risk and whether the costs leave it worth taking is arithmetic on your limits, which is the system's job. A model left to place stops on its own gives a different answer on the same chart; a model whose levels are held inside your bounds cannot hurt you by it.
- The range, not a percentage. The average true range is the most common way a trading desk measures how far a market moves in one bar, and it is the figure every charting terminal publishes, so a stop in this record can be checked by hand against one.
- The square root of the horizon. A market that wanders one ATR in a bar usually wanders about the square root of N ATRs in N bars. A trade the analyst expects to last 30 bars needs more room than one meant to last 5, or the stop is hit by ordinary noise before the idea has had its time.
- A floor and a ceiling. On a very quiet minute the measured stop can sit inside the spread and the fees; on a violent one it can be wider than anyone meant to risk. The bounds are yours, and the record says when one of them held.
- The claim is what the operator measured, or the analyst's target. A rule desk claims
[strategy].edge_bps, the rule's mean net per trade from the operator's own arena run. An agent desk claims the analyst's own target when one was named, or[agents].magnitude_bps. Only a desk that declares[targets].min_path_ev_bpsclaims the paths' value instead. The record says which one was used (edge_source). - No guessed stop. When the candles cannot give a range, the trade is refused. Falling back to some default would put a stop on the venue that nothing measured.
- One mode at a time. A table holding both
stop_fracandstop_atrwould be read by a person one way and by the system another, so it is refused, as is any key[exit]does not know. A typo in an exit setting should stop the desk attra check, not at the venue.
Every intent also records break_even_win_rate, and the cycle output says it in one line: the share of trades like this one that must reach the take profit for the stops and the round trip to come out even, (stop + round trip) / (take profit + stop). It is arithmetic on figures already priced, with no guess at the odds. A 2:1 bracket needs a third of its trades to win before costs; with a 20 bps stop and a 13 bps round trip it needs 55 percent. Compare it with the win rate your round trips actually reach.
[targets].max_break_even_win_rate (an experiment since 0.13, 1, off, unless declared) refuses a trade whose own stop, target and round trip would need more than that share of winners. It reads the levels alone and says nothing about how often the take is reached, which is what the paths read. It is the bound on the analyst's levels and on the measured ones alike, and it is why a one-minute desk refuses many trades a fifteen-minute desk takes: the round trip does not shrink with the timeframe. Set it to 1 to turn it off.
The expected edge is a different thing from the take profit, on purpose. The take profit and the stop say where this position closes; the edge is what the desk expects to earn a trade on average, across the ones that hit the stop, the take profit or the time limit. The cost gate and [targets] judge the trade on the edge less the round trip, because that is the number a desk lives on. Model spend names the calls that had no declared price in [agents.pricing], rather than counting them as free.
The paths
The structure lead names where a trade is wrong and where it is done. The system then asks the instrument's own history how often a take at that distance comes before a stop at that distance inside the hold. It does not predict the next price; it reads the odds at the two levels the trade carries.
| Step | What it does |
|---|---|
| the unit | every closed candle as its open, high, low and close against the previous close, so a take a wick reaches counts |
| the window | the last 512 closed candles, normalised on their own volatility and clipped at five deviations; a mean move its own noise does not support is taken out |
| the tokens | each candle gets a coarse token (its move) and a fine one (its range); the next candle is drawn from those that followed the same token, leaning on the coarse token and then the whole window when a token was rarely seen |
| the paths | 1000, each drawn forward bar by bar at the volatility of the last 64 candles, seeded by the cycle so a replay gives the same figures |
| the reading | the share that reaches the take first, the stop first or neither within the hold; a candle that reaches both counts as the stop, as the arena settles it |
Every cycle records the reading under paths in cycle.json and prints it beside the exits, with its value net of the round trip: take first x take distance - stop first x stop distance + neither x the mean move of those paths - round trip. The lead never sees it. It is a risk reading by default: the odds are calibrated on average (within 1.5 points over 16,458 readings), but drawn from the instrument's own candles they carry no direction, so their value is not an edge. A desk that declares [targets].min_path_ev_bps runs it as a floor, an experiment: the reading becomes the claimed edge, a trade below the floor is refused, and so is one whose reading could not be made. The paths row of the arena reads the same way, so whether the reading separates good trades from bad is measured before a desk leans on it.
The reference is Kronos (arXiv 2508.02739), a model of candles that tested well: the candle as the unit, each window normalised on itself, the next candle drawn on a coarse and a fine token, many paths. What its audit found wanting is not carried over: no transformer to train or ship, since its skill on the direction of crypto was small and on volatility real; every path kept rather than averaged; every draw seeded; and the question asked of the paths is the trade's own barrier.
The cost gate, and what each number is worth
Before there is an intent, the system prices the round trip on the book the snapshot is holding. Every component says how much we actually know:
| Component | Certainty | Where it comes from |
|---|---|---|
fee_round_trip | declared | the channel's schedule in envelope.toml |
spread_cost | measured | half the spread of this snapshot's book, both legs |
impact | computed | walking the visible levels at the declared size, in the base; the exit leg is assumed symmetric |
funding_accrual | declared | the settlements a horizon spans at the venue's own interval for that instrument, at the rate that stands now; only what the position pays |
latency_slippage | estimated | [run].slippage_bps, an operator's bound, not a measurement |
The gate is one comparison: the claimed edge must be at least the total plus the margin the operator declared. The claim itself is labelled too. It is the analyst's own target when one was named and survived the [exit] bounds, and [agents].magnitude_bps, a declaration, otherwise; when layer 1 or layer 5 has measured the phenomenon, the same field carries the measurement and the label changes with it.
A real cycle (2026-09-27, live data and a real model), in the form this release prints it. The lead's line is left out: that cycle predates the setup a lead now names, so its line cannot be printed as it would be today.
cycle 2026-09-27T14-51-23Z BTCUSDT: 8.46s of agents
funding ccxt:bybit age 0.764s
ohlcv ccxt:bybit age 35.705s
orderbook ccxt:bybit age 5.303s
cost: 13.48 bps round trip, 2.00 of it estimated
gate: 25.0000 bps claimed clears 13.4800 bps cost plus 0.0000 bps margin
the edge is declared: [agents].magnitude_bps, declared by the operator and not measured here
fee_round_trip 11.0000 bps declared
spread_cost 0.0118 bps measured
impact 0.0000 bps computed
funding_accrual 0.4682 bps declared
latency_slippage 2.0000 bps estimated
intent: long 0.01 (sandbox)Read the fee line again: eleven of the thirteen and a half basis points are the venue's own schedule. That is the number most agent frameworks never show, and it is usually the number that decides whether the whole idea is worth running.
Three details decide whether these figures are right on every venue, and each was checked against the venues on 2026-10-21:
- Depth is read in the base. OKX and Gate quote a perpetual's book in contracts (0.01 and 0.0001 of a Bitcoin), every size here is in the base, so the book is converted with the market's contract size before it is walked. A contract with no published size is refused rather than guessed.
- Funding settles on each instrument's own clock. On Binance, Bybit, OKX, Gate, Bitget and BingX, 40 to 58 percent of the perpetuals settle every four hours, and every Hyperliquid perpetual every hour, not every eight. The interval comes from the venue with the rate, or from its own interval endpoint, and
[run].settlement_interval_sis only the fallback. The cost line says which one it used. - A receipt is not a discount. When the standing rate would pay the position, nothing is taken off the cost: the rate can turn before the settlement comes. The cost line says how much was left out.
- No rate, no price. A perpetual whose funding rate could not be read is refused before it is priced, with the reason the data chain gave. Spot pairs and prediction outcomes settle no funding and are not asked for it.
Watching a desk you are not running
tra watch is the other half of the console, and the answer to "can I look at a running desk without disturbing it":
tra watch --every 5s --limit 20It opens the directory a desk writes into, reads the records that are already there, and redraws them. It opens no socket, builds no client, holds no key and takes no lock - so opening it, closing it and opening it again does nothing at all to the desk. A record caught halfway through being written is skipped rather than shown wrong.
What it shows, all of it from files: the last decisions with their setup, conviction, risk and what became of them; the last pass over the universe; the book as the newest cycle recorded it; anything that broke; and what the models have cost across the cycles in view.
This matters for how a desk is deployed. The console runs commands in its own process, so a tra run --every 15m typed at the prompt ends when the console does. A desk meant to keep running belongs under a supervisor, and tra watch is how it is looked at from anywhere else.
Watching it work
A cycle spends most of its wall clock waiting on sockets, so a terminal that prints only the outcome looks like a hung process. Every step says when it starts and how it ended, and the console draws the pipeline the project configured with each step pending, running, done, refused, held or skipped. The rows and their wording are what the console draws for the desk tra init --profile autonomous writes, while its lead is being asked; the figures are an example, and a terminal adds colour and a spinner:
step | state | detail
---------------+------------+----------------------------------------------------------------------------------
data | done | 4 of 4 kind(s) answered
trigger | done | moved 41.20 bps
regime | done | ranging on 15m, 1h ranging, 4h trending
structure lead | - running | 5s
macro | skipped | nothing declared in sources/macro.toml, so not read
onchain | skipped | nothing declared in sources/onchain.toml or sources/derivatives.toml, so not read
sentiment | skipped | nothing declared in sources/sentiment.toml, so not read
cost | pending |
exit | pending |
paths | pending |
conviction | pending |
risk | pending |
cost gate | pending |
targets | pending |
risk gate | pending |
intent | pending |Progress travels on its own wire and can change nothing: a watcher that throws is swallowed, because a broken progress bar is not a reason to lose a decision. --json, a pipe and --plain all give the lines instead, unchanged.
Agents run together, and one failure is not the end
Analysts go out on a small pool of threads, because a model call is seconds of waiting on a socket. Each answer is written the moment it arrives, so what a cycle already paid for is on disk even when a later call fails. A failed agent becomes a line in cycle.json rather than a traceback, and the results are always reported in the same order no matter who finished first.
A cycle is not resumed. Its answers belong to the snapshot it took, and asking the next model on a newer book would mix two moments in one decision; the next cycle takes its own snapshot and asks again. tra agent session --resume is different: a session replays recorded data, so its answers do not go stale.
The execution mandate
Three modes, and the distance between them is deliberate.
| Mode | What happens to an admitted intent | What it needs |
|---|---|---|
sandbox | written into the cycle's own directory | nothing; this is the default |
signals | written for execution somewhere else, by someone else's system | nothing |
venue | sent to the venue, with real capital behind it | a mandate, a leverage, a cap per order, the keys; on mainnet the canary tier |
Venue mode does not start until all of this is true, and tra check names whatever is not:
MANDATE.mdis in the project and carries the mandate text word for word, and[execution].acknowledged_byandacknowledged_onname who signed it and when. Read it withtra mandate- it says that the losses are yours - thentra mandate --sign "Your Name"does both: it writesMANDATE.mdwhen the project has none (one you wrote yourself is never overwritten) and sets the two lines, with today's date or--on YYYY-MM-DD. Venue mode stays off until you set[execution].mode = "venue", or sign with--venue-mode, which does it too.- The signature is yours alone: no role, model or tool on the MCP surface can sign.
[execution].max_notionalcaps one order, and[execution].leverageis chosen. Neither has a default in the code: both are what a defect would cost you.tra init --venuewrites 200 and 3x as a start, on lines you can see and change.- On mainnet, the ladder stands at
CANARY, promoted with evidence and a signature. A demo or testnet API holds no capital, so it is where that evidence is earned and does not wait on the ladder. - The venue's keys are in the environment: the shell, an
--env-fileyou name, or the.envbesidestrategy.toml, neverstrategy.tomlitself. They are read by the execution layer alone, and they never appear in a brief, a prompt, a record or a log. [execution].environment(else[live].environment, elsedemo) says which of the venue's environments an order goes to:demo,testnetormainnet. These are three different places with three different accounts, and a key for one is rejected by the others. A cycle that cannot route to the environment it was told refuses rather than sending somewhere close.
tra keys --probe answers the question tra check cannot: not whether a key is set, but whether it works - one free authenticated call per provider, and for the venue an account read through the very client an order would go through. No prompt is sent and no order is placed. Nothing prints a key: each one is shown as eight hex characters of its own SHA-256, which is enough to tell two keys apart and cannot be turned back into either.
ok provider groq ([agents].provider): verified [GROQ_API_KEY 8e4edee0]
ok provider google ([agents].fallback): verified [GEMINI_API_KEY d3869001]
ok venue bybit (demo), for `tra live`: verified [BYBIT_API_KEY da8c3e5b, BYBIT_API_SECRET 9f9bfb94]
ok venue bybit (demo), for `tra run`: verified [BYBIT_API_KEY da8c3e5b, BYBIT_API_SECRET 9f9bfb94]The last two rows are two different clients reaching the same venue: tra live has its own signed REST client and tra run sends through ccxt. They are listed separately because a readiness check that proves one path works proves nothing about the other, and it is the second one a cycle uses. A role that names its own base_url is a row of its own for the same reason, probed on that server with the key it will be sent: provider openai at https://... ([agents.roles.<role>].base_url).
A desk that watches several instruments builds one hand per instrument, and a hand refuses an intent about any other instrument. One symbol, one instrument, one order.
The order follows the channel. [run].venue_key names a channel in envelope.toml, and the name is <entry>-<exit>, each maker or taker:
| Channel entry | What is sent | If it does not fill |
|---|---|---|
taker | a limit IOC at most [execution].max_slippage_bps through the touch, crossing the book at once | what did not fill inside the band is cancelled, never chased |
maker | a post-only limit at this snapshot's own touch, offset by price_offset_bps | cancelled after limit_timeout_s; nothing is chased across the spread |
| anything else | nothing | venue mode refuses: the fee you priced depends on the answer |
That is not a style preference. A channel named maker-taker was priced at the maker fee, and sending a taker order under it would pay a fee the gate never priced.
Three habits make this auditable after a failure, which is the only time it matters. Every order carries a client id derived from the cycle and the instrument, so the same cycle run twice cannot open two positions. The account is read before anything is sent, and an order is never added to a position pointing the other way unless adopt_open_position says so - a hand that cannot read the account does not send at all. And nothing is retried: a venue that refuses is recorded as a refusal, because a retry loop around real capital is how one defect becomes ten orders.
The size is the one the conviction rule chose, capped again by [execution].max_notional. What came back is written to placed.json beside the intent, and the intent is written first: whatever the venue does next, the record of what this cycle decided survives it.
The book at the moment of sending
The snapshot a cycle priced on is as old as its slowest model: half a minute is ordinary. Before an order goes out the venue hand reads the book again. A maker order rests at the touch as it is now, not as it was, and the record keeps the priced mid, how far the mid moved (drift_bps) and where the order rested. [execution].max_drift_bps refuses the order when the mid has moved further than that against the trade, because a decision the market has already left behind is not the decision the gates admitted. A move in the trade's favour never refuses.
Capital, orders and positions in venue mode
Before every order the account's equity and free margin are read, and sizing uses the smaller of the account's equity and [run].equity. At send time your leverage and margin mode are applied at the venue and read back, the estimated liquidation must sit beyond the stop, and a taker entry goes out as a limit IOC within a slippage band. At the start of every pass each open position is matched to the order that filled it, closed by time past [execution].hold_limit, written up when the venue's exits closed it, and flattened when the kill switch is armed. Capital, orders and positions has every setting, every check in order, the arithmetic and the records.
What happens after the order
The stop and the take profit go to the venue attached to the entry, in the same call. The system computes both against the price the cost gate priced on, from the market's own range or from the fixed fractions (where they sit), so no model is ever asked where a stop belongs. A filled position with no exit is the one state this software must never create, because it is the state that survives our process dying - and if the venue cannot take them with the entry, the order is not sent at all, unless [execution].exits = "separate" places them as reduce-only orders the moment it fills (Venues). An operator who carries the exits in their own system says so with [execution].exits = "none", and tra check lists that as something to fix rather than a setting to admire.
The same read that protects against a wrong-way position protects against a second one: any open position on the instrument refuses a new entry unless adopt_open_position says otherwise, because adding to a position is a larger position than the conviction rule sized. An order still working on the instrument refuses too - a second one would be a second decision on the same position - and the client order id is derived from the cycle and the instrument, so the same cycle run twice cannot open two.
Modes
| Mode | What happens |
|---|---|
sandbox (default) | the intent is written into the cycle; nothing leaves the machine |
signals | the intent is written for your own executor to act on |
venue | the intent is sent to the venue through ccxt, after the checks in the execution mandate |
When a cycle refuses
| Refusal | What it means |
|---|---|
data <kind>: ... | a chain was exhausted; see The data gate, and give that kind a longer ttl or another source |
no structure brief: ... | there were not enough closed candles in the snapshot to compute features |
trigger: the mid has moved ... | nothing happened worth paying a model to look at; no tokens were spent |
structure_lead: flat | the analyst saw nothing worth pricing |
structure_lead: ... with no setup named | a direction nobody could name the shape of is not a trade |
structure_lead: not one figure ... survived | the direction could not point at a figure in its own brief |
structure_lead: confidence ... below | the answer was under [agents].min_confidence, when declared (an experiment, none by default) |
exit: ... closed candle(s); an average true range over ... needs ... | volatility mode could not measure a range; raise [agents].lookback_bars or lower [exit].atr_bars |
exit: the take profit is ... a winner would lose money | the take profit sits inside the round trip cost |
exit: ...% of trades like this would have to reach the take profit ... | the break even is above [targets].max_break_even_win_rate, when declared |
exit: the analyst's target is ...x its stop ... | the analyst's own target is closer than [exit].min_reward_to_risk allows, when declared |
risk: ... bps of equity at the stop | the smallest size the venue takes still risks more than [controls].max_risk_per_trade_bps |
desk: ... bps of equity is already at risk | what the book already carries plus this trade is over [desk].max_open_risk_bps |
desk: ... has at risk is not on the record | a position is open whose risk nobody can state, so the desk's total cannot be stated either |
targets: the claimed edge is ...x | the edge was not the multiple of the cost the desk declared |
cost: no book in the snapshot | nothing can be priced without a book, so nothing is |
cost gate: ... is below ... required | the claim did not clear the cost plus the margin |
Every refusal on this list stops the cycle before an order exists. The last one is the gate doing the job the research programme this package came from was built to do.
Did the gates earn their place: tra hindsight
A gate that refuses is easy to defend and hard to judge. It refused a trade; nobody saw what the trade would have done. tra hindsight replays every directional decision in runs/cycles on the candles that followed it, then puts each gate's refusals next to what the desk let through:
hindsight: <n> decisions replayed over <d> day(s), <k> of them independent, each held <hold> on <bar> candles, net of its round trip
admitted <n> mean <net> bps median <net> won <%> sum <net>
refused by targets <n> mean <net> bps median <net> won <%> sum <net> <what the refusals would have done>
refused by regime <n> mean <net> bps median <net> won <%> sum <net> <what the refusals would have done>
all refused <n> mean <net> bps median <net> won <%> sum <net> <what the refusals would have done>
side: the model's <net> bps against <net> on the reverse; <which side did better>
written to hindsight.json; <what the replay was based on>Each row is one gate: how many decisions it refused, and what those decisions would have done net of their round trip, beside the ones the desk let through. The verdict at the end of a row says whether the gate kept out worse trades or better ones; with few decisions it says there is no clear difference yet, and that is the honest answer until the sample grows. The last line asks whether the deciding model's side did better than its exact reverse. No gate can fix a side with no edge: a gate only refuses; it cannot turn a call with no edge into one with an edge. Read these numbers only once there are enough independent decisions behind them to audit.
How each decision is replayed:
- From the open of the first candle after the cycle finished, on the side the analyst took.
- On the stop and take profit the record holds: the levels sent with the order, else the exits the cycle measured, else the analyst's own named levels. With none, the trade closes at the hold limit.
- A candle that touches both levels counts as the stop. Inside one candle the order is unknown, so the replay takes the worse reading.
- Held for
[exit].timeout_barson the decision bar (--hold 4hto change it), on 5-minute candles (--bar 1mfor a finer path), net of the round trip the cycle priced. - The same path on the opposite side gives the side check.
The verdicts are deliberately reluctant:
| Verdict | When |
|---|---|
too few to tell | fewer than 10 decisions on either side, or fewer than 5 days for the side check |
refused worse trades than it let through | a permutation test puts the admitted group ahead with p at or below 0.05 |
refused better trades than it let through; review it | the same test, the other way |
no clear difference yet | anything between |
The side check resamples whole days, because one day's tape moves every decision on it together. "Independent" counts decisions after dropping those on an instrument inside an earlier one's hold; the rest are the same bet asked again.
Two more lines ask whether the numbers a desk acts on mean anything. The analyst's stated confidence sets a floor, and the conviction score sets a size; neither is a probability. confidence and conviction in the report each give the rank correlation between that figure and the decision's net over the replay, tested against 1,000 seeded shuffles of the same outcomes, and the confidence bands (below 0.6, 0.6 to 0.7, 0.7 to 0.8, 0.8 and up) with the outcomes in each. "Higher came with worse outcomes" is the one to act on: a score that runs backwards should not size a trade, and a ladder rung above 1x should come down. With fewer than 10 decisions or 5 days the answer is too few to tell.
The candles come from the desk's own ohlcv chain, the venue first. A path is kept under runs/cycles/hindsight/ once its hold is over, so a second run asks the venue for nothing it already has. The report goes to runs/cycles/hindsight.json, and the quant auditor reads it there, beside the round trips the venue closed.
A replay is not a fill. It assumes the entry at the next candle's open and an exit exactly at the level, with no queue, no partial fill and no gap past a stop. That is why it is reported beside the real round trips, never in place of them.