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,463 words
MR. PIRON / RESEARCH DESK13 min read
0102030405060708091011121234567891011121314151617181920ARTICLE, IN READING ORDER →↑ NUMBERED SOURCES0102030405060708091011121234567891011121314151617181920ARTICLE, IN READING ORDER →↑ NUMBERED SOURCES010203040506070809101112134681013151719ARTICLE, IN READING ORDER →↑ SOURCES
FIG. 0 EVIDENCE MAP · 12 SECTIONS · 20/20 SOURCES CITED · 20 CITATIONS · 5 EQUATIONS · 1 CODE LISTINGComputed from this article. Each bar is a section, as long as its share of the words. A curve joins a passage to a source it cites; a circle grows with the number of passages that cite it. Diamonds mark equations and squares mark code.
Sources cited, equations and code listings per section
SectionSources citedEquationsCode listings
1. Begin with the decision contractnone00
2. Momentum and relative value ask different questions1, 210
3. Rank forecasts; optimize positions separately3, 1110
4. Regime inference is a causal control input410
5. Foundation models and research agents need different tests5, 6, 7, 800
6. Events and market making move the bottleneck to time900
7. Treat execution as its own constrained optimization1010
8. Choose the engine around the market mechanism12, 13, 1400
9. A timestamp is part of every feature1501
10. Measure the portfolio after costs and operational eventsnone10
11. Broker connectivity is an acknowledged state machine16, 17, 18, 1900
12. What a technically complete research deliverable contains2000

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. 2.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. 3.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. 4.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] Licenses differ by checkpoint: the TimesFM repository keeps its code and its weights through version 2.5 under Apache-2.0 and restricts the 3.0 weights to non-commercial use. [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. 7.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; its open-source edition is Apache-2.0 with a Commons Clause, so review the license before building a paid deliverable on it. 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 program applies a strict forward split to 120 synthetic daily records, each with a feature-availability time, a decision time and a label end. Most labels end ten days after the decision, and every eighth record carries a twenty-day label. The test window opens on day 80 and the embargo is five days. The program 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.

A plain date split would train on the 80 records decided before day 80, and eleven of them carry labels that end on or after that day. A fixed gap sized for the ten-day horizon and the embargo, applied to decision times alone, keeps 65 records. Some of them carry twenty-day labels, and two of those labels end too late. They belong to the records decided on days 55 and 63 and end on days 75 and 83: the first on the day the embargo begins, the second inside the test window. The strict split reads each record’s own label end. It trains on 63 records, and the last training label ends on day 74, the day before the embargo begins. The test slice keeps the 20 records whose labels end by day 110. A gap chosen for the usual horizon does not cover a longer label, which is why the rule is applied record by record.

python60 LINES EXECUTED · PYTHON 3.12.3 · 10 ASSERTS PASSED
# Synthetic unit-check fixture; illustrative only, no live market data or performance claims.
horizon, long_horizon, embargo = 10, 20, 5
test_start, test_end = 80, 110
rows = [{"decision_time": day, "feature_available_at": day - 1,
         "label_end": day + (long_horizon if day % 8 == 7 else horizon)}
        for day in range(120)]

def available(row):
    return row["feature_available_at"] <= row["decision_time"]

def forward_split(records, start, end, gap):
    cutoff = start - gap
    assert all(available(r) for r in records)
    train = [r for r in records
             if r["decision_time"] < cutoff
             and r["label_end"] < cutoff]
    test = [r for r in records
            if start <= r["decision_time"] < end
            and r["label_end"] <= end]
    return train, test

# Fit preprocessing on train only. Choose hyperparameters in an
# inner chronological split. Evaluate once on this outer test.
train, test = forward_split(rows, test_start, test_end, embargo)
cutoff = test_start - embargo
date_split = [r for r in rows if r["decision_time"] < test_start]
overlapping = [r for r in date_split if r["label_end"] >= test_start]
# A gap sized for the usual horizon, applied to decision times, never reads label_end.
fixed_gap = [r for r in rows if r["decision_time"] + horizon < cutoff]
gap_only = [r for r in fixed_gap if r not in train]
gap_only_days = [r["decision_time"] for r in gap_only]
gap_only_ends = [r["label_end"] for r in gap_only]
last_train_label = max(r["label_end"] for r in train)
first_test = min(r["decision_time"] for r in test)
last_test_label = max(r["label_end"] for r in test)
same_instant = [{**r, "feature_available_at": r["decision_time"]} for r in rows]
lookahead = [{**r, "feature_available_at": r["label_end"]} for r in rows]

assert all(available(r) for r in same_instant) and not any(available(r) for r in lookahead)
assert all(r not in train for r in overlapping) and all(r not in test for r in train)
assert len(train) + len(gap_only) == len(fixed_gap)
assert max(gap_only_days) < cutoff <= min(gap_only_ends) < test_start <= max(gap_only_ends)
assert last_train_label < cutoff and last_train_label + embargo < first_test
assert first_test == test_start and last_test_label == test_end
assert (len(rows), len(date_split), len(overlapping)) == (120, 80, 11)
assert (len(fixed_gap), len(train), last_train_label, len(test)) == (65, 63, 74, 20)
assert (gap_only_days, gap_only_ends) == ([55, 63], [75, 83])

print(f"RESULT records = {len(rows)}")
print(f"RESULT date_split_train = {len(date_split)}")
print(f"RESULT overlapping_labels = {len(overlapping)}")
print(f"RESULT fixed_gap_train = {len(fixed_gap)}")
print(f"RESULT gap_only_decisions = {gap_only_days}")
print(f"RESULT gap_only_label_ends = {gap_only_ends}")
print(f"RESULT strict_train = {len(train)}")
print(f"RESULT last_train_label_end = {last_train_label}")
print(f"RESULT first_test_decision = {first_test}")
print(f"RESULT test_records = {len(test)}")
print(f"RESULT last_test_label_end = {last_test_label}")
print("OK")
CAPTURED OUTPUT12 LINES · 10 ASSERT STATEMENTS, 10 EVALUATIONS PASSED · RUN NOV 13, 2026 · SHA-256 c59f50fc3cd9…
RESULT records = 120
RESULT date_split_train = 80
RESULT overlapping_labels = 11
RESULT fixed_gap_train = 65
RESULT gap_only_decisions = [55, 63]
RESULT gap_only_label_ends = [75, 83]
RESULT strict_train = 63
RESULT last_train_label_end = 74
RESULT first_test_decision = 80
RESULT test_records = 20
RESULT last_test_label_end = 110
OK

Standard output of the program above, captured when it was run in the journal's sandbox on Nov 13, 2026. The SHA-256 of the program text shown here equals the hash stored with that run. All inputs are synthetic.

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