Skip to content

4.0.0: Split off finance/trading code to alphapy-finance#7

Merged
mrconway merged 1 commit into
developfrom
feat/ml-only
Apr 26, 2026
Merged

4.0.0: Split off finance/trading code to alphapy-finance#7
mrconway merged 1 commit into
developfrom
feat/ml-only

Conversation

@mrconway
Copy link
Copy Markdown
Collaborator

Summary

BREAKING. Removes all trading, markets, and Alfi code from alphapy-pro. That code now lives in the private `alphapy-finance` repo (initial import landed in https://github.com/ScottfreeLLC/alphapy-finance/pull/1).

See tag `v3.1.1-monolith` for the pre-split state. See full `CHANGELOG.md` 4.0.0 entry.

Removed

  • `alphapy/{mflow_main,system,backtest,metalabel}.py`, `alphapy/{portfolio,indicators,data_sources}/`
  • Market-data functions in `alphapy/data.py` (10 helpers)
  • Top-level `app/` (Alfi) and `agent/` (legacy trading agent)
  • 13 trading project examples
  • Trading tests, scripts, docs, configs
  • Entry points: `mflow`, `scott`, `research`
  • ~30 dependencies (alpaca-py, vectorbt, fastapi, langchain*, yfinance, polygon-api-client, etc.)

Kept

  • 16 ML-core modules in `alphapy/`
  • 3 example projects: `kaggle`, `pizza`, `time-series`
  • 26 ML-core dependencies
  • Single entry point: `alphapy`

Test plan

  • `pytest tests/` → 18 passed, 1 skipped
  • `alphapy --help` works
  • `alphapy.version` → `4.0.0`
  • `rg "yfinance|alpaca|polygon|vectorbt" alphapy/` → 0 hits
  • alphapy-finance test suite → 396 passed, 4 xfailed (verified pre-merge)
  • Smoke-run kaggle (Titanic) project end-to-end
  • Tag v4.0.0 after merge to main

BREAKING: All trading, markets, and Alfi code has moved to the private
alphapy-finance repo. See tag v3.1.1-monolith for the pre-split state.

Removed from alphapy-pro:
- alphapy/{mflow_main,system,backtest,metalabel}.py
- alphapy/{portfolio,indicators,data_sources}/
- Market-data functions in alphapy/data.py (get_market_data,
  get_yahoo_data, get_polygon_data, get_alpaca_data, get_eodhd_data,
  convert_data, convert_offset, assign_global_data, standardize_data,
  resample_ohlcv).
- Top-level app/ (Alfi backend+frontend+agent+research) and agent/
  (legacy trading agent).
- 13 trading project examples.
- scripts/{run_agent,run_research,sync_tradingagents}.py and
  scripts/markets/.
- tests/{agent,app_agent,backend,integration}/ and finance tests
  in tests/alphapy/.
- docs/PLAN-markets.md, docs/markets/.
- config/sources.yml.template, systems.yml, groups.yml,
  indicators.yml.
- Entry points: mflow, scott, research.
- ~30 dependencies (alpaca-py, vectorbt, fastapi, langchain*,
  yfinance, polygon-api-client, etc.).

Kept in alphapy-pro:
- alphapy/{alphapy_main,model,data,frame,features,transforms,
  variables,globals,estimators,optimize,plots,utilities,space,
  group,alias,calendrical}.py.
- 3 example projects: kaggle, pizza, time-series.
- tests/{test_imports,test_utilities,test_version}.py and
  tests/conftest.py.
- 26 ML-core dependencies.
- Single entry point: alphapy.

Updated:
- alphapy/__init__.py: bumped to 4.0.0, added __all__.
- pyproject.toml: trimmed deps, dropped finance entry points and
  packages, kept hatch-managed dynamic version.
- README.md, CLAUDE.md, AGENTS.md: rewritten for ML-only scope.
- CHANGELOG.md: 4.0.0 release notes.
- config/alphapy.yml: stripped mflow section.

Verification:
- pytest tests/ -> 18 passed, 1 skipped.
- alphapy --help works.
- import alphapy succeeds without finance deps installed.
- rg "yfinance|alpaca|polygon|vectorbt" alphapy/ -> zero hits.

Migration for downstream consumers:
- alphapy-finance now owns all trading code.
- alphapy-sports unaffected (already isolated).
@claude
Copy link
Copy Markdown

claude Bot commented Apr 26, 2026

Claude finished @mrconway's task —— View job


PR Review: 4.0.0 Split Trading/Finance Code

Reviewed this major architectural change that removes all trading/finance functionality to create a pure ML framework.

Review Tasks

  • Read key modified files and assess changes
  • Check for lingering trading/finance references
  • Review dependency cleanup in pyproject.toml
  • Verify test coverage adequacy
  • Review configuration file updates
  • Assess documentation completeness
  • Provide comprehensive feedback

Overall Assessment ⚠️

This is a well-executed major architectural change that successfully removes trading/finance code, but has several critical issues that must be addressed before merge.

Strengths

Excellent Dependency Cleanup: pyproject.toml is properly cleaned - removed ~30 trading dependencies (alpaca-py, vectorbt, fastapi, langchain, yfinance, polygon-api-client) while retaining 26 ML-core dependencies.

Clean Documentation Updates: README.md, CHANGELOG.md, and CLAUDE.md are well-updated with clear migration guidance and architectural changes.

Proper Version Management: Version bumped to 4.0.0 with appropriate BREAKING CHANGE designation.

Good Test Structure: Remaining test suite is minimal but focused (6 test files vs previous hundreds).

🚨 Critical Issues

1. Broken Code in alphapy_main.py - ❌ BLOCKING

/home/runner/work/alphapy-pro/alphapy-pro/alphapy/alphapy_main.py:208-216

full_path = SSEP.join([alphapy_root, 'config', 'systems.yml'])
with open(full_path, 'r') as ymlfile:
    trading_systems = yaml.safe_load(ymlfile)
logger.info("Getting Trading Systems")
specs['systems'] = trading_systems

Problem: Code tries to load systems.yml file that was removed in the split. This will cause runtime failures.
Fix Required: Remove this entire section or make it conditional.

2. Stale Trading References - ⚠️ MEDIUM

Multiple files contain outdated references:

  • CONTRIBUTING.md:26 - Still mentions mflow_main.py
  • config/alphapy.yml.template - Contains mflow: section that should be removed
  • config/variables.yml:95 - wdev: 'Portfolio Weight Deviation' variable (trading-specific)
  • alphapy/variables.py:468 - Comment about "assign global frame for trading"
  • scripts/, docs/ - Multiple files with trading references that should be cleaned up

3. Configuration Inconsistencies - ⚠️ MEDIUM

  • config/alphapy.yml still contains hardcoded paths (/Users/markconway/Projects/)
  • Missing proper template configuration for ML-only workflow

📊 Security & Performance

  • Security: No security issues identified
  • Performance: Dependency reduction should improve load times
  • No sensitive data: Clean removal of API keys/credentials

🧪 Test Coverage

Adequate for scope: 6 remaining test files focused on core ML functionality. However:

  • ⚠️ Missing integration test for the incomplete smoke test mentioned in PR description
  • ⚠️ Test fixtures in conftest.py still contain trading-related mocks (Alpaca, Polygon) that should be removed

📝 Documentation Quality

Generally excellent, but needs cleanup:

  • ✅ Clear migration guidance in CHANGELOG.md
  • ✅ Updated README.md with new architecture
  • ⚠️ Many doc files in docs/ still reference mflow command and trading functionality

Recommendations

Must Fix Before Merge

  1. Remove systems.yml loading code in alphapy_main.py:208-216
  2. Clean remaining trading references in key config files
  3. Update config templates to reflect ML-only architecture

Should Fix Soon

  1. Remove trading-related test fixtures in conftest.py
  2. Clean up documentation references to removed functionality
  3. Complete the smoke test mentioned in PR test plan

Migration Strategy

The migration guidance is excellent - downstream repos using { path = "../alphapy-finance", editable = true } is the right approach.

Verdict

Conditional Approval - This is excellent architectural work that properly separates concerns, but the broken code in alphapy_main.py is a blocking issue that will cause runtime failures. Fix the critical issues and this will be a solid 4.0.0 release.

@mrconway mrconway merged commit 0e998dc into develop Apr 26, 2026
5 of 7 checks passed
@mrconway mrconway deleted the feat/ml-only branch April 26, 2026 19:56
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.

1 participant