docs: add a paper on the signals and the position engine - #909
Conversation
|
Warning Review limit reached
Next review available in: 11 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds
docs/paper/main.tex(+references.bib), giving thegithub-paperworkflowsomething to compile. 8 pages, builds clean with
latexmk -pdf.The derivation.
osc()divides the EWMA difference bys = sqrt(1/(1-f²) - 2/(1-fg) + 1/(1-g²)), asserted in the docstring without proof.The paper proves it: the difference filter's coefficients sum to zero, so it kills the
unit root and the cumulative coefficients telescope to
g^(m+1) - f^(m+1), whose sumof squares is exactly
s². Sosis the standard deviation of the numerator under adriftless unit-variance random walk, and the oscillator is a t-statistic of trend.
Simulation over 2e5 steps confirms it: realised sd within 1.4% of 1.0 for every
(fast, slow) pair tested, while
sitself ranges over 1.09–6.13.The empirical finding. Running the full engine over the 49-asset,
53-year panel in
tests/tinycta/resources/prices_hashed.csv:shrink=1.0fails outright —SingularMatrixErrorout ofEngine.cash_position.The final EWMA correlation matrix over the 47 finite assets has condition number
2.79e18and smallest eigenvalue9.16e-17, i.e. numerically rank-deficient eventhough the window (129) is longer than the cross-section (49). Shrinkage is
load-bearing infrastructure here, not a tuning knob.
grows 11× from λ=0 to λ=0.99 and max gross grows 311× (706 → 219,768), while Sharpe
stays inside [0.206, 0.327] and non-monotone. Someone watching only the Sharpe ratio
would not see the ill-conditioning arriving.
shrink2id(M, λ) = λM + (1-λ)I, soshrink=1.0means no shrinkage and
shrink=0.0discards correlations entirely — and 1.0 is thevalue that fails. Worth a docstring note or a rename, separately from this PR.
All Sharpe figures are gross of costs, in-sample, one signal, one panel; the paper says
so explicitly and draws no performance conclusion. Also documented: the profit-variance
feedback (κ=0.99, v₀=1, both hard-coded) leaves the book's absolute scale determined by
v₀and the price series' units, and the per-timestamp correlation dict is O(T·n²) —about 265 MB on this panel.
Code and docs are untouched — this PR only adds the paper.