Skip to content

Memory-aware trading prototype

See why a setup is allowed, resized or refused.

When trade history sits apart from entry decisions, an operator has to reconstruct why a setup passed or was blocked. This engineering prototype brings recalled outcomes and the rule rationale into one decision trace. Evaluate it on controlled data before deciding whether it fits your risk process.

Prototype
for engineering evaluation
Decision trace
history, rationale and gate verdict
Dry-run
documented with simulated fills
TRIGGERED_BYONINRESULTED_INMADE_BYONSIGNALPAIRREGIMEDECISIONAGENTTRADErecall → rule threshold reached → BLOCK

What you inspect

  • recalled outcomes
  • decision rationale
  • allow / resize / refuse
  • seeded-history labels

The problem

Review the evidence behind the entry decision.

For trading-system operators and risk owners, the useful question is specific: which prior outcomes changed this decision, and why? The prototype makes that question inspectable before you consider integration.

  • 01

    History sits outside the entry decision

    If your entry rules do not consult prior outcomes, a repeated setup can pass without that context. The prototype tests bringing matching closed outcomes into the entry check.

  • 02

    Averages leave a review question open

    An overall result does not explain a specific refusal. Recall matches the signal type, instrument and volatility bucket, so you can inspect which outcomes informed the rule.

  • 03

    A fill does not explain a decision

    An operator or risk owner needs the reason for an entry, resize or refusal. Decision records connect the signal and rationale, with a trade link when available, rather than leaving you to piece together separate logs.

  • 04

    A rule change needs a bounded check

    Before adding a memory rule to your workflow, inspect what it blocks, what it resizes and what it permits without history. Controlled data lets you review those decisions without committing capital.

The intended change to your day: open a decision trace, inspect the recalled history and rule, and judge whether the allow, resize or refusal matches your policy.

How it works

From prior outcomes to a decision you can inspect.

The prototype records signals, recalled outcomes and decision rationales. These source excerpts show what recall matches, where gate thresholds apply and how an outcome can inform a later review.

  1. 01Inputsticks · funding · OI · sentiment
  2. 02Graph memoryrecorded decisions + outcomes
  3. 03Recall3-hop Cypher, worst loss first
  4. 04Decisiongate · analyst · risk manager
  5. 05Executiondocumented dry-run engine
  6. 06Outcomelinked back for later recall

Stage 01

What goes in

Four input streams supply the documented prototype’s signal and regime context. Their configured sources and cadences are listed below.

InputSourceCadenceUsed for
Price ticksExchange public API via ccxt → LaserData market.ticks2 s, batchedsignal detection, regime tagging
Funding rate + open interestSame venue, same batch60 s refreshfunding_extreme signal, context
Market sentimentFear & Greed index → LaserData market.context10 minsentiment bucket on the regime
Trade eventsEngine webhooks → bridge → LaserData bot.eventsper eventwriting outcomes back into memory

A regime records volatility and trend, with optional sentiment — high-vol/down for example. The recall query below filters by volatility bucket; it does not require the trend or sentiment to match.

Stage 02

What gets remembered

Decision records hold the rationale and signal context. A resulting trade is linked when its identifier is available; incoming trade events update the recorded outcome.

memory/schema.py — the decision-rationale graph
(:Signal {type, ts, strength})   -[:ON]->            (:Pair {symbol})(:Signal)                       -[:IN]->            (:Regime {vol_bucket, trend, sentiment})(:Decision {action, rationale,              confidence, vetoed}) -[:TRIGGERED_BY]-> (:Signal)(:Decision)                     -[:MADE_BY]->       (:Agent {name})(:Decision)                     -[:VETOED_BY]->     (:Agent) when vetoed(:Decision)                     -[:RESULTED_IN]->   (:Trade {id, side, size, pnl, status}) when linked

A Decision keeps its rationale text and links to the resulting Trade when available. This gives an operator a way to compare the stated reason with the recorded outcome. Demo-seeded history is labelled and must be distinguished from observed outcomes.

Stage 03

The question asked of memory

The query matches signal type, pair and volatility bucket. It sorts closed outcomes by loss first and returns at most five by default — a cautionary sample, not an unbiased performance summary.

memory/recall.py — the 3-hop recall
MATCH (d:Decision)-[:TRIGGERED_BY]->(prior:Signal {type: $sig})-[:ON]->(p:Pair {symbol: $pair}),      (prior)-[:IN]->(r:Regime {vol_bucket: $vol}),      (d)-[:RESULTED_IN]->(t:Trade)WHERE t.status = 'closed'RETURN t.pnl AS pnl, d.rationale AS rationale, d.confidence AS confidenceORDER BY t.pnl ASCLIMIT $limit

In English: which matching closed outcomes were recalled, and what rationale accompanied those decisions?

Recall matches those three keys exactly. An empty result means no matching history, not a safe setup. The entry gate can fall back to pair-and-volatility history when the signal is unknown, or whole-pair history when no regime is known. Seeded outcomes are not excluded by this query.

Stage 04

The decision — path A, the entry gate

The strategy uses custom_stake_amount() for sizing and confirm_trade_entry() for refusal. Both consult a cached gate verdict; the gate applies fixed rules without a model call.

bridge/gate.py — the memory gate
bridge/gate.py — rule excerpt, no model call in this gateif losses >= self._losses_to_veto:    action, allow, factor = "block", False, 0.0elif losses >= self._losses_to_cut:    action, allow, factor = "resize", True, self._loss_cut_factorelse:    action, allow, factor = "allow", True, 1.0
Gate condition (demo defaults)VerdictEffect
≥ 3 recalled closed lossesblockentry refused
≥ 2 recalled closed lossesresizestake × 0.5
fewer losses, including an empty recallallowproposed stake unchanged
recall unavailable (DB down, timeout)blockgate failure returns a block

The gate records a Decision when the graph is reachable. Recall or write failures return a block; an empty recall can allow entry. The table shows demo defaults, not validated risk limits. An evaluation should check both missing-history and failure cases.

Stage 05

The decision — path B, judgment and governance

A separate decision loop gives recalled rows to an analyst, then a risk manager. This path can propose engine actions; it is distinct from the deterministic strategy entry gate.

Analyst system prompt excerpt

You are the Signal Analyst of a governed crypto trading pipeline … You receive one computed market signal and the graph memory of prior closed trades triggered by the same signal type on the same pair in the same volatility regime. Weigh the recalled outcomes heavily: repeated past losses in this regime must lower confidence and size_factor, or flip bias to flat.

The local analyst validates the reply against a schema. A schema violation is retried once, then raises instead of returning a verdict. Validation checks the output structure; it does not establish that the reasoning is correct.

Local risk manager — source order, first match wins
1session loss reaches the configured drawdown limitstop — circuit breaker
2recalled losses reach the veto thresholdveto
3confidence below the configured floorveto
4proposal is flathold, no trade
5entry proposal at the open-position caphold, no new entry
6otherwiseapprove; size cut if recalled losses reach the cut threshold

The source also includes a mirrored-entry harness for comparing gate behaviour, and a Guild governance path with human approval. An unanswered Guild approval prompt becomes a veto. These are implementation paths to verify in an evaluation; their presence does not establish a controlled result.

Stage 06

What can inform the next review

Trade-event handling updates the graph. A linked, closed outcome can be included in a later recall if it matches the query and falls within its limit.

  1. 01A detector produces a signal; the loop checks strength, cooldown and minimum-hold guards.
  2. 02Recall returns matching closed outcomes, worst first, with their recorded rationales.
  3. 03The analyst proposes and the risk manager reviews; the strategy gate checks a prospective entry separately.
  4. 04Decision records make the action and rationale available to the operator UI when the graph is reachable.
  5. 05Trade webhooks update fills and closed outcomes; decision links depend on an available trade identifier.
  6. 06A later review can use the matching history recorded by then.

The entry gate can retain the proposed stake, reduce it or refuse entry. Those rules do not predict prices or establish a profit edge. Their usefulness depends on the history, policy and evaluation controls you choose.

Architecture

Architecture

Trace a decision through its dependencies.

These prototype layers explain where the evidence, proposal and final rule come from. Compatibility with your environment and behaviour under failure still need to be checked before integration.

Data flow

Where decision evidence comes from

The repository diagram connects input streams, graph recall, deciders and the dry-run engine. Trade events return through the bridge. Use it to identify which dependency supplies each part of the decision trace.

Where decision evidence comes from — architecture diagram
One decision

Where a proposal can be changed or stopped

The source diagram shows recall, analyst reasoning and governance branches. The local rules and optional Guild approval path differ; the source-order table above describes local behaviour.

Where a proposal can be changed or stopped — architecture diagram

Engineering posture

  • Specific failure handling

    Gate recall or write exceptions return a block, and the strategy blocks on gate request errors. An empty recall is different: it can allow entry. These paths need evaluation alongside your operating policy.

  • Fixed rules in the entry gate

    The entry gate uses graph queries and loss thresholds without a model call. The separate analyst loop uses a model and can propose engine actions.

  • Boundaries to inspect before integration

    Typed signal, verdict and decision contracts connect the source modules. A bounded evaluation should check how your engine, data and risk rules would map to those contracts.

  • Traceable records, with provenance limits

    Decision nodes retain rationale and context; the UI exposes seeded-history labels. Its history drawer re-queries context rather than storing the gate’s exact recall snapshot. Missing writes or trade links also limit the trace.

Documented prototype captures

What an operator can inspect.

The source repository dates these screenshots to epoch 1, 3 August 2026: a dry-run experiment with simulated fills and demo-seeded history. They show the inspection workflow, not a current live demo or a controlled performance result.

Mission control

Review a decision and its recorded rationale

The captured operator UI groups the signal, regime, agent, rationale and available trade link. Its comparison strip belongs to the flawed first experiment described below; the displayed numbers are not an edge result.

Review a decision and its recorded rationale
What memory knew

Inspect the history behind a refusal

The expanded drawer reconstructs matching history and shows recorded rationales, including labelled seeded outcomes. It re-queries context rather than storing the gate’s exact recall snapshot; use the recorded gate rationale to understand the verdict.

Inspect the history behind a refusal
Gate verdicts

Read the reason for a block, veto or resize

The capture shows gate and risk-manager decisions. The displayed “5 of 5” counts outcomes in a demo recall; it is not an accuracy score, loss-avoidance rate or profit measure. Seeded history is part of the demo.

Read the reason for a block, veto or resize
The graph

Decision, Signal, Trade and Agent nodes with their edges

A captured database-browser view of the prototype graph and its decision links. This static image helps explain the records behind recall; it does not show current service health or deployment status.

Decision, Signal, Trade and Agent nodes with their edges
A/B harness

The first experiment’s two engine views

The engines appear side by side, but the repository audit says the overlay sent entries only to the baseline in this epoch. The comparison was not controlled; see the limitations below before interpreting its numbers.

The first experiment’s two engine views
Baseline

The ungated leg

The baseline dashboard from the first dry-run epoch. The repository attributes its closed losses to decision-overlay churn; they do not establish the effect of adding memory.

The ungated leg
Memory-gated

The gated leg

The memory-gated dashboard from the same epoch. The repository describes the open position as resized, but this leg did not receive the baseline’s overlay entries. Its lack of closed losses is not proof of avoided losses.

The gated leg
Stack

Technology

The components behind the prototype.

For technical review after the decision flow: these are documented implementation components. An evaluation would establish which integrations are usable for your scope and which need work.

Execution

  • freqtradeThe prototype engine. The strategy subclass consults the gate through sizing and entry-confirmation hooks.
  • ccxt · Bybit futuresMarket-data and venue connectivity. The documented experiment used dry-run trading with simulated fills.
  • DockerContainer definitions for the engine legs and graph. Reproducing a controlled comparison also requires matching inputs and checking the harness.

Memory

  • FalkorDBThe graph store for signals, decisions and outcomes. Exact-match Cypher recall returns a bounded, loss-first sample of linked closed trades.

Streaming

  • LaserDataThe source stream integration for market ticks, funding, open interest, trade events and sentiment.

Pipeline

  • RocketRide.aiPipeline artifacts and a WebSocket client for the prototype’s cloud proposal path.

Governance

  • Guild.aiAnalyst and risk-manager integration with human approval handling. An unanswered approval prompt becomes a veto in this path; it is separate from the local rule table.

Reasoning

  • Analyst modelThe local analyst source names gpt-5.4-mini as its configurable default. Schema validation checks the verdict format, not the quality of its trading judgment.

Services

  • Python · uvThe documented Python runtime and dependency tooling for the prototype services.
  • FastAPISource endpoints for the webhook bridge, event feed, entry gate and operator UI.
  • pydanticTyped signal, verdict and decision contracts at the integration boundaries.

Verification

  • pytestRepository checks for prototype logic and integrations, to support technical evaluation.
  • PlaywrightBrowser tooling suggested in the source demo guide for repeatable UI captures.
  • MermaidRepository diagram sources. The exported images on this page are static artifacts.

What we don’t claim

What the first experiment could not establish.

The source repository documents an internal review of the 3 August 2026 dry-run experiment. Its headline comparison did not hold up. These are the reported limitations, not an independent re-audit or evidence of a profitable trading system.

  1. Finding 01

    The overlay opened the baseline entries

    The repository’s epoch-1 audit attributes the baseline’s closed trades to the decision overlay, rather than organic strategy entries. They do not measure the strategy’s independent behaviour.

  2. Finding 02

    Short holds confounded the comparison

    The audit reports a median six-second hold and fee-dominated dry-run losses. That is a finding about overlay churn in this run, not a customer outcome or evidence of a strategy edge.

  3. Finding 03

    The two legs did not receive matching entries

    The audit says the loop sent those entries only to the baseline. Fewer closed losses on the gated leg cannot establish that memory prevented them; the first epoch was not a controlled comparison.

  4. Finding 04

    The revised harness still needs evaluation

    The source includes mirrored-entry dispatch and anti-churn guards after epoch 1. Those changes address the setup of the experiment; their presence is not evidence of a successful controlled study or improved returns.

What is available to evaluate

The source implements recall, fixed gate rules and decision records. The captures show how an operator can inspect a refusal or resize. Demo-seeded outcomes and a loss-first recall sample limit what those examples establish. They are a starting point for checking the mechanism under your controls.

A useful evaluation would agree the dataset, gate thresholds and review criteria first, then inspect allowed, resized and blocked cases — including missing history and dependency failures. This page establishes no profit edge, controlled performance result or investment advice.

Inspect the mechanism. Agree the evaluation.

Request an evaluation discussion

Which decision do you need to understand?

If you operate a trading system or own its risk policy, tell us what you want to inspect. This is a request to discuss a bounded evaluation of the prototype. A session, data scope and integration work would be agreed separately.

  1. 01

    Name the decision you want to inspect

    Describe your engine, instruments and the entry or refusal you need to understand. A short workflow description is enough for the initial request.

  2. 02

    Agree a controlled evaluation

    The next discussion would define a bounded dataset, distinguish seeded from observed history, and agree thresholds and review criteria before a session is arranged.

  3. 03

    Review the trace before integration

    The proposed output is a review of recalled evidence, rationale and gate verdicts, including empty-history and failure cases. Use it to decide whether further integration work is justified.

Or write directly

info@kodai.com.pl

Send the same evaluation request by email if you prefer.

Instruments, venues and engine. A description is enough; data access can be scoped separately.

Requests a discussion. A session and data scope are agreed separately.