Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ml4t/engineer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.1.0b9
Choose a base ref
...
head repository: ml4t/engineer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.1.0b10
Choose a head ref
  • 7 commits
  • 20 files changed
  • 2 contributors

Commits on Jul 8, 2026

  1. ci: bump the github-actions group across 1 directory with 2 updates (#12

    )
    
    Dependabot update.
    
    All CI checks were green before merge.
    dependabot[bot] authored Jul 8, 2026
    Configuration menu
    Copy the full SHA
    67cc324 View commit details
    Browse the repository at this point in the history
  2. deps: update numpy requirement from <2.5,>=1.24.0 to >=1.24.0,<2.6 in…

    … the python-dependencies group (#14)
    
    Dependabot update.
    
    All CI checks were green before merge.
    dependabot[bot] authored Jul 8, 2026
    Configuration menu
    Copy the full SHA
    eb1b0af View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2026

  1. chore: address review cleanup

    Address review cleanup backlog.
    stefan-jansen authored Jul 11, 2026
    Configuration menu
    Copy the full SHA
    e99b1f0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f971d4b View commit details
    Browse the repository at this point in the history
  3. ci: bump the github-actions group with 2 updates

    Bump astral-sh/setup-uv and pypa/gh-action-pypi-publish.
    dependabot[bot] authored Jul 11, 2026
    Configuration menu
    Copy the full SHA
    5a085f8 View commit details
    Browse the repository at this point in the history
  4. deps: bump the python-dependencies group with 23 updates

    Bump Python dependency lockfile and update compatibility for newer ruff and ty.
    dependabot[bot] authored Jul 11, 2026
    Configuration menu
    Copy the full SHA
    e3fcf1d View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2026

  1. fix(cross_asset): beta_to_market and rolling_correlation were not Cov…

    …/Var
    
    Both functions hand-rolled their covariance as
    
        ((s1 - rolling_mean(s1)) * (s2 - rolling_mean(s2))).rolling_mean(w)
    
    which is not a covariance. For a point s inside the window ending at t it subtracts
    the mean of the window ending at *s*, not the mean of the window being averaged.
    Both also mixed a divide-by-n numerator (rolling_mean) with a divide-by-(n-1)
    denominator (rolling_var / rolling_std).
    
    The result violated the defining identity: beta(x, x) and corr(x, x) must be exactly
    1.0, and returned ~0.977 and ~0.974 on daily returns at window 60-63. On real ETF
    data the betas were biased low by a consistent ~2.4% (worse in relative terms for
    near-zero betas: TLT by 12.9%). This surfaced in ch08/03_structural_cross_instrument
    _features, whose printed cross-section shows SPY's beta to SPY as 0.977.
    
    Both now delegate to Polars' native rolling_corr / rolling_cov, which are exact and
    consistent in ddof. lead_lag_correlation and correlation_matrix_features call
    rolling_correlation internally and are corrected as a side effect.
    
    Behavior change: a zero-variance window makes these quantities undefined and they now
    return NaN. Previously a 1e-10 epsilon in the denominator turned that into a silent
    0.0 - a fabricated 'no sensitivity' reading for a quantity that does not exist.
    
    Tests: adds the identity checks that would have caught this - beta(x,x) == 1,
    corr(x,x) == 1, exact recovery of a known noiseless beta, agreement with numpy, and
    the documented NaN behavior for a constant market. The pre-existing test asserted
    only 0.5 < mean < 1.2 against a true beta of 0.8, far too wide to notice.
    
    Also fixes two test defects found on the way:
    - test_cross_asset_correlation_bounds used drop_nulls() to filter undefined values,
      but a float NaN is not a null in Polars, so NaN reached a bounds assertion that is
      False for NaN by IEEE. Same drop_nulls-misses-NaN trap as ch08 erratum E8.2.
    - test_dm_performance compared single perf_counter samples against TA-Lib and flaked
      about one run in three under load; now compares the best of 7 runs.
    stefan-jansen committed Jul 20, 2026
    Configuration menu
    Copy the full SHA
    1cefd9d View commit details
    Browse the repository at this point in the history
Loading