You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Goal — first small vertical slice after rollback #709
Prove that Trader can run an external strategy using the same existing onBars / OnBars execution path as an in-process strategy. Do the minimum needed for a real historical backtest where the worker receives bars and always returns no orders.
Do this increment only. Stop and open a PR for review when it works. We will decide the next feature after building and testing this one.
Scope
Inspect and reuse Trader's current strategy callback, marketdata.Bar, backtest loop, and domain types. Use OnBars semantics: one callback per availability instant, with the completed bars available then; no look-ahead.
Implement a small loopback TCP adapter that lets an external worker participate in that callback. Use standard Go encoding/json and simple explicit framing (e.g., a 4-byte length prefix so TCP message boundaries are unambiguous).
The adapter sends the existing bars as JSON and receives an empty order list [] (or a minimal typed response containing it). Reuse existing Go structs wherever they work.
Provide one small example external worker that accepts bars and returns no orders.
Wire this adapter to the existing historical backtest engine; do not create a second run loop or execution pipeline.
Test the actual end-to-end path with a small canonical historical fixture: multiple successive OnBars deliveries, empty responses, normal completion. Include a basic disconnect/error test so a dead worker does not hang the backtest.
Acceptance criteria
A real Trader backtest can drive the external example worker over loopback TCP.
Each OnBars call delivers the same completed bar group and timing as the in-process path.
Worker returns no orders; the backtest finishes with no trades.
Repeated frames and clean shutdown work; disconnected worker returns an error promptly.
Small focused integration tests pass, and make check passes.
PR documents how to run the example, and shows the test command/output.
Explicitly out of scope
New strategy.Order or any second order/intent lifecycle.
Custom JSON parser/codec, golden fixtures, generalized protocol framework, registration schema or negotiation.
RunID transport protocol, registry/catalog, subprocess launch/management, multiple clients, or remote-network security.
Order submission/execution, account/risk changes, position/fill feedback, journaling, results REST API.
Generalized studies, scanners, indicators, or pre-emptive future-proofing.
Keep the implementation small and readable. If the existing interface needs modification, explain the minimum change in the PR. Do not silently expand scope. Preserve Trader's authority over risk, sizing and execution per ADR-093.
Context:#690 / milestone #27. PR #709 removed the prior overbuilt strategy protocol. This issue replaces its former broad implementation scope.
Activity
trader serve starts the strategy service on a default loopback port (#…
strategy/server and the strategy service in trader serve (#701) (#708)
[-]Strategy Protocol: drive external OnBars into existing backtest engine[/-][+]Strategy Protocol: minimal external OnBars TCP/JSON backtest (empty orders)[/+]Run an external strategy over loopback TCP: bars in, empty orders out (…
Move the remote strategy transport to package strategy; add a respons…
strategy: rename Remote to Client, remote.go to client.go (#703)
onBars returns an error; strategy.ListenAndServe; strategy_remote.go (#…
strategy: finish the nil-ready ListenAndServe test with a real exchan…
Remote strategy over loopback TCP: bars in, empty orders out (#703) (#…