Skip to content

Overview

execute is the downstream half of the trading-strategy framework's (decide, execute) coalgebra pair (see the behaviour spec): a strategy worker decides to submit an order and publishes it; an executor worker picks it up, actually places (or simulates) the order, and reports back what happened via the pubsub-topics spec's Trade Lifecycle Events. The two halves are separate processes connected by CloudEvents, not a direct function call -- they scale, deploy, and restart independently.

This repo holds the concrete, deployable executor workers. The generic bridge (ExecutorWorkerBase<TState>, decoding "Order submitted" and encoding Trade Lifecycle Events) lives in virtufin-execution-devkit; each worker here is a thin subclass pairing that bridge with a specific IExecutor implementation.

Picking a worker for a scenario

Scenario's strategy.world Worker
hyp.* (backtest, paper trading) SimulatedExecutor
SHADOW_* (trial a strategy without risk) ShadowExecutor
LIVE / act (real capital) LiveExecutor

Routing is by deployment, not runtime branching: each scenario's orders go to whichever worker subscribes to that scenario's trading topic (sc.<scenarioid>.trading.order.submitted). There's no single "universal" executor worker that inspects strategy.world and decides what to do -- that keeps a live deployment's blast radius limited to the LiveExecutor code path alone.

Before wiring a strategy to LiveExecutor, see the strategy devkit's testing guidance: unit-test, backtest against SimulatedExecutor, then shadow-trade against ShadowExecutor before ever setting strategy.world = act. LiveExecutor itself is untested against the real exchange -- see its own page's pre-deployment checklist.