Skip to content

docs: add a paper on the signals and the position engine - #909

Merged
tschm merged 2 commits into
mainfrom
feat/paper
Aug 23, 2026
Merged

docs: add a paper on the signals and the position engine#909
tschm merged 2 commits into
mainfrom
feat/paper

Conversation

@tschm

@tschm tschm commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Adds docs/paper/main.tex (+ references.bib), giving the github-paper workflow
something to compile. 8 pages, builds clean with latexmk -pdf.

The derivation. osc() divides the EWMA difference by
s = 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 sum
of squares is exactly . So s is the standard deviation of the numerator under a
driftless 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 s itself 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.0 fails outrightSingularMatrixError out of Engine.cash_position.
    The final EWMA correlation matrix over the 47 finite assets has condition number
    2.79e18 and smallest eigenvalue 9.16e-17, i.e. numerically rank-deficient even
    though the window (129) is longer than the cross-section (49). Shrinkage is
    load-bearing infrastructure here, not a tuning knob.
  • The failure is preceded by leverage, not by a worse Sharpe. Mean gross exposure
    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.
  • The parameter reads backwards. shrink2id(M, λ) = λM + (1-λ)I, so shrink=1.0
    means no shrinkage and shrink=0.0 discards correlations entirely — and 1.0 is the
    value 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.

Copilot AI lite review requested due to automatic review settings August 23, 2026 12:26
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tschm, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review or push new commits to the PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7b54d7ad-66e3-4b9f-83db-0c0b1466e4cb

📥 Commits

Reviewing files that changed from the base of the PR and between c619ce8 and 2601395.

📒 Files selected for processing (2)
  • docs/paper/main.tex
  • docs/paper/references.bib

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@tschm
tschm merged commit 2e4edb8 into main Aug 23, 2026
44 checks passed
@tschm
tschm deleted the feat/paper branch August 23, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants