dnQuant

tradeEngine

What it owns

Question Answer
What does it do? Supports agent opportunity/portfolio judgment and separately governed paper execution.
What does it receive? Bounded read-only Alfa snapshots, current public pair pricing, explicit missing checks, policy, and a virtual portfolio.
What does it produce? Structured model proposals, admitted or blocked paper actions, modeled fills, portfolio accounting, and telemetry.
What decisions does it own? Agent opportunity selection and hold/exit judgment; deterministic engine admission, sizing, and paper accounting.
What can it not decide? Alfa/DD authority, arbitrary risk changes, wallet signing, or live orders.

Implementation boundary: tradeEngine is the responsibility name, not a package in this repository. Inspected external alfa_trader code supports the Qwen paper campaign; an independently copied implementation supports the Codex paper campaign. This repository contains agent setup/telemetry and context producers. It does not contain the full trader source or its private campaigns.

The verification map pins external source and activation evidence. There is no verified live-capital trading interface. Do not infer production wallet or exchange access from the word “execution,” from an alert titled “TRADE,” or from alfaEngine/trades.py (which collects trade witnesses).

Inputs and trust boundaries

tradeEngine diagram
Open diagram at full size
Diagram source
---
config:
  theme: "base"
  look: "classic"
  themeVariables:
    fontFamily: "system-ui"
    fontSize: "16px"
    primaryColor: "#202020"
    primaryTextColor: "#f4f4f5"
    primaryBorderColor: "#81818c"
    secondaryColor: "#303034"
    tertiaryColor: "#202020"
    lineColor: "#81818c"
    textColor: "#f4f4f5"
    edgeLabelBackground: "#202020"
    clusterBkg: "#141416"
    clusterBorder: "#55555a"
  flowchart:
    wrappingWidth: 230
    nodeSpacing: 32
    rankSpacing: 46
    curve: "basis"
    padding: 18
  themeCSS: ".node rect, .node polygon, .node path { filter: none !important; } .nodeLabel { font-weight: 500; } .edgeLabel { font-size: 13px; color: #f4f4f5; } .edgeLabel p { background-color: #202020; padding: 3px 7px; border-radius: 5px; } .flowchart-link { stroke-width: 1.4px; } .legend text { font-weight: 600; }"
  fontFamily: "system-ui"
---
flowchart TD
    Alfa["Alfa snapshots and optional context"] --> Validate["Validate identity, schema,<br/>digests and evidence clocks"]
    Price["Current exact-pair pricing"] --> Validate
    Validate --> Packet["Bounded agent packet"]
    Portfolio["Virtual portfolio and fixed policy"] --> Packet
    Packet --> Agent["Agent judgment<br/>enter / skip / hold / exit"]
    Agent --> Gate{{"Valid state-bound proposal<br/>and deterministic controls?"}}
    Gate -->|"No"| Blocked["Block action; retain reason"]
    Gate -->|"Yes; admissible fill"| Paper["Paper fill and append-only journal"]
    Paper --> Telemetry["Validated dashboard telemetry"]
    DD["Independent DD reports"] -.-> Human["Human review only;<br/>no automatic agent import"]

    classDef default fill:#202020,stroke:#81818c,color:#f4f4f5,stroke-width:1px,rx:12,ry:12;
    classDef info fill:#303034,stroke:#c4c4c4,color:#ffffff,stroke-width:1.5px,rx:12,ry:12;
    classDef gate fill:#202020,stroke:#ffffff,color:#ffffff,stroke-width:1.5px;
    classDef success fill:#14271d,stroke:#4ade80,color:#4ade80,stroke-width:1.5px,rx:12,ry:12;
    classDef warning fill:#2b261b,stroke:#ead09b,color:#ead09b,stroke-width:1.5px,rx:12,ry:12;
    classDef failure fill:#301f20,stroke:#ffb4ab,color:#ffb4ab,stroke-width:1.5px,rx:12,ry:12;
    classDef secondary fill:#202020,stroke:#a2a2aa,color:#c4c4c4,stroke-width:1px,stroke-dasharray:4 4,rx:12,ry:12;
    class Validate,Packet,Agent info;
    class Gate gate;
    class Blocked failure;
    class Paper success;
    class Alfa,Price,Portfolio,DD,Human secondary;
Input Actual producer and use
Candidate identity and observations Alfa saved records; exporter selects a bounded set, ordinarily up to 20 recent candidates
Features, scores and checks Saved/recomputed Alfa projections with original references; incomplete scores and pre-alert candidates may be considered
Security/liquidity/concentration Explicit pass/fail/unknown checks; recorded failures block new entry, stale passes become unknown
Token/provider and pool context Optional canonical context with digest, policy, original clocks, and limitations; current Qwen consumer delivery is supported by dated acceptance samples
Current pair pricing Separate public exact chain/token/pool data; indicative price and modeled capacity, not an executable route or independent native proof
Portfolio/balances/positions The agent's own simulated cash, positions, cost basis, risk, and journal—not wallet balances
Trading configuration Bound campaign risk/venue/inference configuration plus accepted forward amendments
DD reports Independent research exists, but no automatic DD result/score import in the inspected exporter or current model packet
Execution-provider information Indicative paper venue is active in the evidenced campaigns; a stricter exact-size quote experiment exists separately and is not the active fill model

The indicative venue supports Ethereum and Solana. Alfa can supply other-chain candidates, but that does not make them executable by the paper venue. Source snapshots are not an exhaustive market scan.

Data handling and revalidation

The exporter reads Alfa in read-only mode, preserves exact identity/pool, receipt IDs, policy and field clocks, and reports unknown reasons. SSH authenticates the source host; content digests bind the returned envelope, not the truth of a provider claim.

A separate current pair response can refresh market pricing while source safety evidence remains stale. The indicative feed explicitly admits unknown provider observation time and retains receipt timing. It must not be described as a fresh native security assessment. Optional context cannot turn aggregate holder data into individual-wallet proof or rolling five-minute pool values into closed candles.

Model packets carry candidate and portfolio fingerprints, available evidence fields, allowed actions, current positions, remaining slots, dollar risk capacity, and uncertainty multipliers. The current protocol requires the model to repeat capacity facts correctly and cite available fields. Malformed output, unavailable citations, false capacity facts, or changed input state are rejected. Optional context must fit the bounded packet and cannot displace required portfolio/risk information.

A proposal is not a fill. The engine rechecks current candidate/quote age, latency, portfolio state, risk limits, same-token exposure, and modeled liquidity/capacity before admitting an action. Journals bind policy, model/protocol, candidate, quote, and decision context. Code/config amendments preserve historical replay rather than reinterpret prior events.

Qwen uses pinned local inference. The Codex runner uses the signed-in Codex CLI with tools disabled, read-only decision workspace, structured output, and a bounded deadline; it uses a cloud inference service. Thus local-first collection/research does not mean every optional agent's inference is local. Its integration fingerprint is not a hash of model weights.

Agent decision-authority matrix

“Enforced” below means checked by the inspected paper code, not a newly recommended live-trading policy.

Decision Agent discretion Enforced approval or gate Verified implementation
Candidate consideration May consider pre-alert or incomplete-score candidates Exported identity, supported venue, valid input schema External source exporter and model packet
DD requests No direct model DD tool found Human bot authorization and DD budgets remain separate DD intake exists; no agent-to-DD wiring verified
Opportunity rejection May skip for insufficient edge/evidence Output schema and truthful blocker/capacity validation Model enter/skip protocol
Trade selection May propose an entry below rules-baseline opportunity thresholds Known check failures, freshness, risk pauses and capacity still block Model mode in paper engine
Position sizing No quantity or risk-percentage selection Deterministic risk, costs, cash, exposure, uncertainty and capacity calculation Engine entry sizing
Entry timing May propose enter now or skip Post-decision latency, fresh evidence/quote, current state and cadence Pending proposal then revalidated quote
Order placement No independent order API Deterministic modeled fills only No live exchange submission/signing found
Position management Whole-position hold/exit judgment Latched exits and automatic protections take precedence Portfolio-aware model review
Stop-loss changes Cannot widen, disable, or choose stop Fixed hard-stop policy preserved 8% entry-price stop in evidenced active policy
Profit taking May hold or propose exit based on remaining opportunity Valid current proposal and admissible paper fill Fixed target removed by accepted forward policy
Emergency exit May propose exit through same interface Automatic stop/time rules; fresh price and capacity required No bypass or guaranteed emergency liquidation
Risk-limit changes No model discretion Manifest/policy binding; narrow explicit forward amendment Model output has no policy mutation capability
Wallet and credential access No wallet/signing access in decision interface Runner owns configured source/inference access outside model packet No live wallet, key-management, or funding interface

Within an authorized paper campaign, an admitted proposal can produce a simulated fill without a separate human approval for each action. This grants no live-trading authority.

The user's broader preference for discretionary sizing is not the implemented sizing contract. Paper models can make investment judgments within fixed limits; they cannot select their own limits.

Evidenced current paper policy

The October 20 forward transition is moderate-paper-discretionary-exits-v2. Both campaign receipts record adoption. The earlier fixed +16% target remains in old configuration/history but is disabled prospectively via take_profit_fraction=null.

Control Value / behavior
Planned loss budget At most 0.5% of current equity, including modeled stop costs
Position / total entry exposure At most 10% / 30% of equity
Aggregate planned stop risk At most 1.5% of equity
Positions At most three total, one with unknown checks
Uncertainty Each unknown security/liquidity/concentration check multiplies risk and position allowance by 0.5
Daily loss / drawdown entry pause 2% / 8%; exit handling continues
Hard stop / holding limit 8% below modeled entry / 24 hours
Profit target None; agent hold/exit judgment, with already-latched historical exits preserved
Candidate / quote age At most 60 seconds / 15 seconds under their accepted clocks
Post-decision latency At least one second
Re-entry cooldown 30 minutes per chain/token across pools
Minimum indicative liquidity / order $50,000 / $10

Three unknown checks reduce the risk multiplier to 0.125. This is an explicit paper-policy allowance to act under uncertainty, not evidence that unknown checks passed. It differs from Alfa's full required-evidence alert contract. No quote/price means no fabricated fill, and known check failure is not waived.

Indicative fills model a 20-basis-point total spread, 30-basis-point per-side fee, 50-basis-point per-side adverse slippage, and fixed per-side costs of $5 for Ethereum / $0.05 for Solana. Capacity is modeled as 0.5% of reported pool liquidity. These assumptions do not establish on-chain depth, route availability, or achievable net proceeds. An 8% stop is not a maximum realized loss guarantee.

Failure and safety behavior

Situation Implemented behavior and limitation
Alfa source unavailable Saved snapshots may be reused with original clocks; stale evidence is not rejuvenated. Independent public pricing cannot reconstruct missing Alfa security history
Public price/provider failure Attempt is retained; no invented price/fill. Missing sell capacity can delay or partially fill a latched exit
Stale or incomplete evidence Entry freshness gates apply; stale passes become unknown with explicit reduced allowance. Incomplete score itself is not an entry veto
DD contradicts Alfa No automatic conflict arbiter is wired because DD results are not imported. A human must inspect the independent findings
Model fails, times out, or gives invalid output No proposal/fill is fabricated and no automatic model substitution is authorized
Inference budget exhausted Model review defers; automatic risk processing can continue while runner and pricing remain available
Runner unavailable or machine asleep No ongoing risk handling by that stopped process. Resume/replay preserves state; it cannot guarantee liquidation during the outage
Stop or time limit reached Exit is latched; model cannot cancel it. Sale still needs an admissible quote/capacity and may gap
Duplicate or restart Append-only journal, event IDs, serialized writer and deterministic replay avoid duplicate accounting
Order failure In this system it is a blocked/failed paper action; there are no on-chain transaction receipts or broker reconciliation to claim

The journal records proposed actions, skips, rejection reasons, modeled fills, costs, positions and policy transitions. Receipts are provider/model/paper-accounting records, not blockchain settlement receipts. Telemetry publishes recorded state without granting control. Dashboard distinguishes agent setup preferences from running policy.

Remaining boundaries

The stricter route-native paper experiment requires exact-size buy/sell quotes, native metadata, independent USD marks, and execution-policy checks. Its existence does not upgrade indicative campaigns to route-verified execution. No automatic promotion from paper to real capital is implemented.

A repository-only checkout cannot reproduce the complete external campaigns. External source/config/receipt bindings and the limitations of this review are listed in verification. No portfolio database, model request, market experiment, or trade was accessed or initiated by this documentation milestone.

Forward common request interface

The implemented shared consumer interface lets the separately configured Qwen and Codex clients request and read compatible canonical market evidence. DD reports and agent decisions retain their existing ledger owners; no cross-store output publication or dual writes are introduced. Existing consumers must explicitly adopt that client. Merely merging or deploying Alfa does not restart a campaign, import DD conclusions into model prompts, change paper controls or grant live execution.

dnQuant documentation · Published from the main repository