mr.piron.Back to the research desk
TECHNICAL RESEARCH

The strategy architecture map: signals, models, execution and evidence.

A technical comparison of momentum, statistical arbitrage, ML ranking, regimes, foundation models and adaptive execution — with equations, causal data rules and platform design.

TECHNICAL RESEARCHAdvanced20 primary sources2,170 words
MR. PIRON / RESEARCH DESK13 min read

01 /Begin with the decision contract

An algorithm is a sequence of decisions under constraints. Its specification should say what is observed, when the information becomes usable, what action is permitted, how that action reaches the market, and how success will be evaluated. Choosing a fashionable model before writing that contract makes comparisons difficult. A daily equity ranker and a queue-sensitive market maker solve different problems even when both are described as AI trading.

A useful architecture separates six components: the data clock, feature state, forecast or signal, portfolio target, execution policy, and operational controls. Each component has its own input and output schema. A forecast can be replaced without changing the risk limits; an execution adapter can be replaced without redefining the label. This makes experiment results attributable to a specific change instead of an entire stack rewrite.

The examples below are research specifications, not a ranking by expected profitability. Horizon, liquidity, available data, capital constraints, and implementation resources determine which family is worth investigating. Start with the simplest credible baseline that satisfies the mandate, then require each additional component to improve a predefined forward metric.

02 /Momentum and relative value ask different questions

Time-series momentum asks whether an instrument’s own past movement contains useful directional information. The original research distinguishes this from ranking instruments against one another. [1] A practical baseline aggregates lagged returns across a small, prespecified set of horizons and scales exposure by a volatility estimate. Portfolio-level normalization then controls aggregate risk. Signal prices, execution prices, and futures roll adjustments must remain separate records.

Relative value instead asks whether a relationship between instruments leaves a residual with useful mean-reverting dynamics. Estimate the intercept and hedge coefficient on a training window, form the spread, and test its statistical assumptions. Statsmodels implements the augmented Engle–Granger test with a null hypothesis of no cointegration and an assumption of integrated input series. [2] A small p-value is evidence about that specification, not an entry rule or a guarantee that the relationship persists.

For a residual modeled as a stable AR(1) process with coefficient between zero and one, the displayed half-life gives a first approximation to the decay horizon. It must be reconciled with spread, borrow, two-leg execution, and structural-break risk. A statistically interesting spread can still be economically untradable.

Residual and discrete half-lifeEQ. 02.1
et=log⁡PtA−α^−β^log⁡PtB,h1/2=−log⁡2log⁡ϕ^e_t=\log P_t^A-\hat\alpha-\hat\beta\log P_t^B,\qquad h_{1/2}=-\frac{\log2}{\log\hat\phi}

The half-life expression assumes eₜ = φeₜ₋₁ + εₜ with 0 < φ < 1. Estimate all coefficients using only the training window.

03 /Rank forecasts; optimize positions separately

A cross-sectional model predicts relative opportunities across a universe. Inputs might include lagged returns, liquidity, valuation, or quality features that were available at the decision time. The target could be a forward excess return, a class label, or a pairwise ordering. Current XGBoost documentation exposes regression, quantile and ranking objectives; these are implementation choices rather than interchangeable descriptions of the same loss. [3]

For a pairwise research loss, define the desired order from forward labels and penalize reversed score differences. Group comparisons by date so that the model learns an ordering among simultaneous opportunities. Missing delisted names or revised historical fundamentals can make the resulting universe materially easier than the universe a trader actually faced.

Scores then enter a separate portfolio problem. Exposure neutrality, position bounds, turnover, and liquidity caps are constraints on weights, not on the prediction metric. CVXPY’s quadratic-program example illustrates the distinction between expected-return inputs and covariance-based portfolio risk. [11] Evaluate the full conversion from score to feasible trades. A higher rank correlation may produce no incremental net return if the improvement occurs among instruments that cannot be traded cheaply.

Example pairwise research objectiveEQ. 03.1
L(θ)=∑t∑i,jlog⁡(1+e−yij,t(fθ(Xi,t)−fθ(Xj,t)))+Ω(θ)\mathcal L(\theta)=\sum_t\sum_{i,j}\log\left(1+e^{-y_{ij,t}(f_\theta(X_{i,t})-f_\theta(X_{j,t}))}\right)+\Omega(\theta)

Here yᵢⱼ is +1 or −1 according to the forward ordering. Exclude ties or specify their treatment; Ω regularizes the model.

04 /Regime inference is a causal control input

A regime model represents changing conditions through a latent state. One specification lets returns or volatility have state-dependent distributions and estimates a transition matrix. Statsmodels provides Markov-switching regression with separate filtering and smoothing operations. [4] That distinction is central to a tradable implementation: filtered probabilities condition on observations through the decision time, whereas smoothed historical estimates can incorporate later observations.

Specify what the inferred probability changes. It might reduce an exposure budget, blend two already validated strategies, or route a model to a different calibration. Keep hard limits outside the probability model. State identities can change after fitting, so map states to stable economic descriptors such as estimated variance before carrying a controller across retraining boundaries.

An additional state is not automatically useful. More states increase flexibility but reduce the observations available to estimate each transition. Compare against an ordinary volatility threshold and measure controller turnover as well as portfolio outcomes. If most of the apparent improvement comes from one short historical episode, report that concentration rather than hiding it in an aggregate score.

Filtering update and blended targetEQ. 04.1
pt(j)∝f(rt∣St=j)∑ipt−1(i)Aij,wt=∑jpt(j)wt(j)p_t(j)\propto f(r_t\mid S_t=j)\sum_i p_{t-1}(i)A_{ij},\qquad w_t=\sum_jp_t(j)w_t^{(j)}

Normalize probabilities to sum to one. Strategy targets must themselves be computed causally and satisfy the external risk mandate.

05 /Foundation models and research agents need different tests

Pretrained time-series models are an active engineering option. Amazon’s Chronos repository and Google’s TimesFM repository provide current implementations and model-specific interfaces. [5, 6] Pin the model revision, preprocessing, context length, forecast horizon, and inference configuration. A product name alone does not define an experiment.

Evaluate the forecast distribution on the target that matters: returns, volatility, volume, or another explicitly defined quantity. Prediction of smooth price levels can look strong while saying little about next-period returns. A June 2026 financial benchmark finds useful pretrained priors but sparse improvements over random-walk baselines in its tested setting. [7] That is a reason to measure local utility, not a verdict on every financial dataset or model.

Research agents are a separate layer. Microsoft’s RD-Agent-Quant explores coordinated factor and model development. [8] Such a workflow can generate many candidates, which increases the need to record attempted hypotheses and reserve a final holdout. Freeze the prompt, tools, model revision and available documents for an experiment. The selection process is itself part of the model being evaluated; repeatedly inspecting a holdout turns it into another training signal.

06 /Events and market making move the bottleneck to time

An event strategy needs the original document, entity mapping, first usable arrival time, and a defined processing budget. A historical transcript or filing is not automatically a real-time dataset. Preserve publication, ingestion and model-completion timestamps independently, including revisions and duplicate event identifiers. Test delayed availability by replaying the same event at progressively later decision times.

Market making needs a different record: sequenced book changes, trades, queue rules, and the strategy’s outstanding orders. Avellaneda and Stoikov give a stylized framework that shifts the dealer’s reservation price with inventory and quotes around that price. [9] The attractive simplicity of the equation comes from assumptions about prices and fill intensities; it does not remove the need to calibrate venue-specific behavior.

In either family, a bar-based result can omit the decisive mechanism. An event signal may have arrived after the market response. A passive quote may have touched without filling because earlier orders occupied the queue. Evaluate the weakest timing assumption first. For quote strategies, include adverse selection after fills and the interval between requesting a cancellation and receiving its outcome.

07 /Treat execution as its own constrained optimization

A parent order defines an execution mandate: side, size, arrival benchmark, deadline and participation limits. The execution algorithm chooses child orders while carrying remaining inventory. Its objective should distinguish price improvement, risk, completion and fees. TWAP and an appropriately specified volume schedule are useful baselines because their behavior can be explained and reproduced.

A learned policy changes the action rule but inherits the same mandate. Recent research investigates reinforcement learning for allocating market and limit orders in simulated order books. [10] The reported simulation setting matters: an agent can exploit simulator behavior that is absent from the market. Its state should include outstanding orders and remaining inventory, not simply the last price.

Measure implementation shortfall on identical parent orders for every policy. Report residual inventory and deadline violations alongside cost. Penalizing leftover inventory only weakly can make a policy appear inexpensive by avoiding difficult fills. Apply participation and exposure limits outside the learner, and retain a deterministic fallback for stale observations, rejected orders, or a looming deadline.

Execution cost–risk tradeoffEQ. 07.1
min⁡π  E[Cπ]+λVar⁡(Cπ),Rt=−ct−ηqt2Δt−ξqT21(t=T)\min_\pi\;\mathbb E[C_\pi]+\lambda\operatorname{Var}(C_\pi),\qquad R_t=-c_t-\eta q_t^2\Delta t-\xi q_T^2\mathbf1(t=T)

C is mandate-specific implementation cost. Reward coefficients are design choices; residual inventory and completion must also be reported as independent metrics.

08 /Choose the engine around the market mechanism

Rapid signal exploration and realistic execution simulation have different requirements. VectorBT provides portfolio constructors for orders, signals and custom order functions, including explicit fee and slippage inputs. [12] It is useful for reproducible parameter comparisons when the assumptions fit the strategy. A large sweep still creates a multiple-testing problem; speed does not substitute for a selection protocol.

LEAN provides configurable slippage models within its brokerage and security modeling framework. [13] Inspect the actual model selected for an instrument and override it when the research assumptions require it. The quantity of historical bars does not establish that passive-order or capacity assumptions are realistic.

NautilusTrader documents an event-driven architecture linking data, execution, risk and portfolio components. [14] That design supports a more detailed event-level workflow, but its realism still depends on the replay data and adapter configuration. Choose an engine after identifying the mechanism the experiment must represent. Preserve a small deterministic replay that proves ordering, positions and fees across the complete path.

09 /A timestamp is part of every feature

Attach an availability time to every input. A daily high is unavailable before the session finishes; an earnings estimate may have been revised; a constituent list may describe today’s index instead of the historical index. An as-of join should select the most recent value available at the decision time. A plain date join often cannot express that requirement.

Account for the label interval too. If a training label spans into the validation period, its outcome carries information from that period. Remove such overlap and decide how much additional separation is appropriate for the feature construction and execution horizon. Scikit-learn’s TimeSeriesSplit preserves temporal ordering and supports a gap, but it does not automatically understand a custom event label’s ending time. [15]

The following original helper illustrates a strict forward split for records with explicit decision and label-end times. It intentionally leaves data preparation, model fitting and trade simulation outside the split function. They must be fitted or configured from the permitted training observations, then frozen for the forward slice.

python / RESEARCH IMPLEMENTATION
def forward_split(rows, test_start, test_end, embargo):
    cutoff = test_start - embargo
    for row in rows:
        assert row["feature_available_at"] <= row["decision_time"]
    train = [r for r in rows
             if r["decision_time"] < cutoff
             and r["label_end"] < cutoff]
    test = [r for r in rows
            if test_start <= r["decision_time"] < test_end
            and r["label_end"] <= test_end]
    return train, test

# Fit preprocessing on train only. Choose hyperparameters in an
# inner chronological split. Evaluate once on this outer test.

10 /Measure the portfolio after costs and operational events

A first-order cost accounting view subtracts one-way spread and commission costs from traded notional, then adds financing, borrow and an explicit impact model. Costs should vary where the underlying market varies. Double the assumed spread, delay decisions, cap participation, and inspect whether conclusions survive. The displayed accounting equation is a research approximation; nonlinear impact and partial fills need a richer simulation.

Track exposure, turnover, concentration, drawdown, completion rates and risk-adjusted outcomes by forward period. Block-based resampling can preserve more temporal dependence than independent daily shuffling. Record the number of candidate strategies and parameter settings inspected. A final holdout only remains independent if disappointing results do not send the design back for another round of selection against the same period.

Simulate rejected orders, disconnected adapters and stale observations as ordinary events in the test harness. An attractive forecast cannot reconcile an account after a missed execution event. A strategy that continues sizing from an incorrect position is a different strategy from the one represented in its clean historical simulation.

First-order net-return accountingEQ. 10.1
rp,t+1=wt⊤rt+1−∑ici,t∣wi,t−wi,t−1∣−bt−ft−Itr_{p,t+1}=w_t^\top r_{t+1}-\sum_i c_{i,t}|w_{i,t}-w_{i,t-1}|-b_t-f_t-I_t

c contains one-way spread and fee estimates; b is borrow, f financing and I impact. These terms must share the same return and notional convention.

11 /Broker connectivity is an acknowledged state machine

Submitting an order is one transition, not proof of a fill. Interactive Brokers exposes socket-based TWS / IB Gateway integration and Web API interfaces. [16] Select the authentication and connection model that fits the project, then design position reconciliation around the actual event semantics and account permissions.

MQL5’s OrderSend documentation explains why a successful call does not mean a market order has already executed; inspect the result and subsequent trade events. [17] cTrader’s Open API documentation specifies TCP and WebSocket connections. [18] These transport choices require heartbeat, reconnect and state-recovery behavior in the surrounding service.

TradingView webhooks deliver HTTP POST alerts to an external application. [19] A bridge should validate the payload, deduplicate the signal and translate it through independent order controls. Keep broker credentials in the server environment, outside alert text. Across platforms, assign stable identifiers to signals, orders and executions. After reconnecting, reconcile the broker’s positions and open orders before accepting another target. Paper trading adds operational evidence, while its fill assumptions remain a separate question.

12 /What a technically complete research deliverable contains

The deliverable should let another engineer reconstruct the experiment: a frozen universe, versioned data manifest, feature-availability rules, training and selection protocol, signal specification, portfolio constraints, execution assumptions, and an ordered results ledger. Model artifacts alone cannot explain which information the system used or why a particular experiment was selected.

Include simple counterfactuals. Replace the learned forecast with zero, equal scores, or a transparent factor while retaining the same allocator and cost model. Replace the adaptive executor with its baseline while retaining identical parent orders. These comparisons reveal which component is contributing and whether a complex system is mostly benefiting from ordinary market exposure.

For a custom engagement, acceptance criteria should be measurable before implementation begins: reproducibility on a pinned environment, compliance with the stated position limits, correct replay behavior, and specified forward evaluation. Qlib offers a documented example of separating forecasting, portfolio and execution stages in a research framework. [20] The architecture should make those boundaries visible, so that promising research can be challenged, reproduced and, where evidence supports it, engineered into a controlled deployment.

∎

Research is complete only when the assumptions, experiment, and limitations can be reconstructed.

This perspective is research commentary. It does not constitute investment advice or evidence of live strategy performance. Experimental methods require project-specific testing. Equations and code illustrate research formulations, not measured live returns.

More perspectivesExplore the engineering atlas