feat: integrate alphalens factor analysis - #12
Merged
Merged
Conversation
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fincore Alphalens Integration
Implements the full iteration plan
docs/plans/2026-08-13-fincore-alphalens-integration.md:a traceable, testable, independently installable integration of the local
Alphalens factor-research capability into fincore, with every pinned upstream
test scenario rewritten as a strongly-asserted fincore compatibility test.
59 commits, 104 files changed, ~40.7k insertions. All 12 tasks (1, 1.5, 2–11, 12)
complete and accepted.
Frozen source identity
cloudquant-local-3fa17ad3fa17ad4c3edb025d1410de7aeba9673cba7791c(the reported
v0.4.0/1.0.0+devstrings are recorded as conflictingevidence; the full commit is the identity)
performance,utils,plotting,tearstests/compat/fixtures/alphalens-0.4.0-cloudquant-*.json;docs:
docs/compatibility/alphalens-0.4.0-cloudquant.mdArchitecture
fincore.alphalens— lightweight strict façade preserving the legacy modulepaths, signatures, call grammar (incl. hidden
set_contextand the dualquantize_factorsignature), exceptions, stdout/plt.show()projections.fincore.factor_analysis— canonical enhanced domain: data preparation,calendar, performance kernels, compute-once
FactorAnalysisModel,lazy Matplotlib renderer, 7 tear-sheet workflows,
prepare_factor_data(),analyze_factor().PyfolioFactorInputs/create_pyfolio_input— bridges factor output intothe existing real
fincore.pyfolioworkflow. No externalempyrical/pyfolio/alphalens runtime dependency; the one upstream
ep.cum_returnscall is re-routed to the fincore internal kernel.import fincore,import fincore.alphalensload nostatsmodels/Matplotlib/Seaborn/IPython; no
matplotlib.use(); no writes topackage/source/site-packages.
fincore[factor-analysis](compute incl. alpha/beta regression),fincore[alphalens](rendering stack);allis the exact normalized union.Compatibility levels (C0–C4)
pd.testing/numpy.testingassertionsPinned upstream test migration
sibling package): 117 active declared rows (116 diagnostic-collectible + 1
source-shadowed) + 24 dormant tear rows expanding to 96 internal invocations.
fincore targets (
rewritten_strict/rewritten_invariant/rebuilt_c4);no
skip,xfail,smoke_only,raw_copy, bare.equals(), or siblingtest import.
scripts/check_alphalens_upstream_test_migration.py --scope allwith controlled collection proof + non-xdist result JSON
(
--alphalens-upstream-result-json), HEAD-bound.Test plan
Executed at HEAD
2bf6d00(Darwin/arm64, Anaconda base: Python 3.11.8,NumPy 1.26.4, pandas 3.0.3, SciPy 1.17.1, Matplotlib 3.10.9, statsmodels 0.14.6):
TODOs before release (explicit human gates — release remains blocked)
docs/upstream-provenance.md,checklist item 7.4): root MIT text vs file-level Quantopian Apache-2.0
headers; destination header/NOTICE decision pending.
(
benchmarks/factor-analysis-baseline.jsonkeepsapproved_by/approved_atempty; checklist item 6.5) before any performance claim.or claim Stable/Production/1.0).
Remaining gates
All engineering gates are green. The human license, benchmark-approval, CI
artifact, and version gates above are intentionally open; per the plan the
release candidate stays Beta at 0.3.0 until they are closed.
Provenance / license impact
docs/upstream-provenance.mdand the compatfixtures; static AST extraction only, no sibling imports, no network.
Owned files (by track)
fincore/alphalens/,scripts/generate_compat_manifest.py,scripts/generate_alphalens_upstream_test_inventory.py,scripts/check_alphalens_upstream_test_migration.py,tests/compat/{fixtures/alphalens-*,alphalens/,test_alphalens_upstream_test_migration.py},tests/conftest.pyfincore/factor_analysis/{calendar,data,exceptions}.py,fincore/contracts/factor_analysis.pyfincore/factor_analysis/{performance,portfolio}.pyfincore/factor_analysis/{models,analysis,render_matplotlib,tears}.pypyproject.toml,requirements*.txt,tests/packaging/,scripts/{test_installed_wheel,check_release_consistency}.py,.github/workflows/{ci,publish}.yml, docs, examples, benchmarks🤖 Generated with Claude Code