TPTBusiness
4758de0eee
refactor: remove all proprietary terms from codebase and git history
...
- Rename FTMO_* constants → generic names (RISK_PER_TRADE, MAX_DAILY_LOSS, etc.)
- Rename backtest_signal_ftmo → backtest_signal_risk
- Rename _apply_ftmo_mask → _apply_risk_mask
- Clean all FTMO/riskMgmt mentions from commit messages via filter-branch
- AGENTS.md: add non-negotiable rule — NEVER mention proprietary terms in commits/releases
- Code variables and function names sanitized project-wide
- Force-pushed rewritten history to remote
2026-05-22 15:10:36 +02:00
TPTBusiness
0d9b0916f2
test: 434 deep hypothesis tests across RiskMgmt OOS, Kronos, auto-fixer, factor coder, pipeline, integration
...
- RiskMgmt OOS: 88 tests (leverage bounds, DD limits, trade counting, MC p-value, daily breach)
- Kronos adapter: 73 tests (OHLCV idempotence, batch/sequential equivalence, forward-fill)
- Auto-fixer: 78 tests (fix idempotence, MultiIndex conversion, fuzzing random patterns)
- Factor coder: 65 tests (FactorTask roundtrip, evaluator invariants, workspace paths)
- QLib pipeline: 61 tests (Metrics, bandit, precision matrices, noise_var)
- Integration: 69 tests (portfolio weights, correlation, RiskMgmt limits, JSON roundtrip)
2026-05-11 00:47:38 +02:00
TPTBusiness
cbe1c52e00
refactor: rename project from Predix to NexQuant
...
Rename all source files, scripts, tests, documentation, and configuration
from Predix/predix to NexQuant/nexquant across the entire codebase.
2026-05-09 17:48:22 +02:00
TPTBusiness
0b168fd3e4
feat: Complete P6-P9 implementation (73 tests)
...
P6: ML Feedback Integrator (18 tests)
- MLFeedbackMixin for QuantRDLoop
- Auto-trigger ML training every 500 factors
- Feature importance → prompt feedback
P7: Portfolio Optimizer (28 tests)
- Mean-Variance optimization (max Sharpe)
- Risk Parity (equal risk contribution)
- Correlation analysis (max 0.3)
- Portfolio backtest with weighted signals
P8: Integration Tests (27 tests)
- End-to-end pipeline test
- Parallelization test (4 workers)
- RiskMgmt compliance test
- Error handling test
P9: Documentation
- QWEN.md updated with all new modules
- Project status updated
- Architecture diagram expanded
73 tests passing in 0.48s
2026-04-09 10:09:20 +02:00
TPTBusiness
352dd08514
feat: CLI Commands for strategy generation (P4 complete)
...
New commands:
- rdagent generate_strategies (parallel LLM + Optuna)
- rdagent optimize_portfolio
- rdagent strategies_report
- rdagent fin_quant --auto-strategies
21 integration tests added.
Rich console output with progress bars and tables.
2026-04-09 09:28:24 +02:00
TPTBusiness
127ee0f44f
test: Add CLI model selection and logging tests (10 new tests)
...
- TestCLIModelSelection: 8 tests for predix.py CLI
* predix module imports
* fin_quant --model option
* predix quant --model and --log-file options
* OpenRouter API key validation
* TeeWriter existence check
* health and status commands
- TestLoggingTeeWriter: 2 tests for TeeWriter
* Multi-stream writing
* Broken stream handling
All 103 integration tests pass (93 + 10 new).
Also fix predix.py logging:
- Add --log-file flag (default: fin_quant.log)
- TeeWriter writes to both console AND file
- Works for both local and openrouter backends
2026-04-04 08:38:15 +02:00
TPTBusiness
612ed8a802
fix: Ensure backtest results save to DB and JSON files
...
- Remove duplicate DB save from quant.py (keep only in factor_runner)
- Add explicit DB path creation with mkdir -p
- Add JSON factor summaries to results/factors/
- Add debug logging for result structure
- Fix logger.debug -> logger.info (RDAgentLog compatibility)
- Update tests to match new architecture (240/240 passing)
- Enhance extract_results.py with progress indicators
2026-04-03 15:46:52 +02:00
TPTBusiness
74d5a8234e
feat: Integrate critical features into fin_quant workflow (P0+P1)
...
Connect Protection Manager, Results Database, model_loader, and Technical
Indicators to the main fin_quant trading loop.
P0 - CRITICAL INTEGRATIONS:
1. PROTECTION MANAGER in factor_runner.py
- Automatic protection check after every backtest
- Factors with >15% drawdown are rejected
- Cooldown, stoploss guard, low performance filters active
- Error handling: workflow continues if protection fails
2. RESULTS DATABASE in quant.py
- Auto-save experiment results to SQLite after each loop
- Stores: IC, Sharpe, Max DD, Annualized Return, Win Rate
- Queryable via ResultsDatabase API
- Error handling: warning logged, workflow continues
P1 - IMPORTANT INTEGRATIONS:
3. MODEL LOADER in model_coder.py
- Loads models/local/ as baseline reference for LLM
- Transformer, TCN, PatchTST, CNN+LSTM now used as starting point
- LLM can improve upon existing models instead of from scratch
4. TECHNICAL INDICATORS in factor_coder.py
- RSI, MACD, Bollinger Bands, CCI, ATR available to LLM
- Import paths and usage examples in prompts
- Better factor generation with professional indicators
TESTS (32 new, ALL PASS):
- 23 integration tests in test/qlib/test_fin_quant_integration.py
- 9 enhanced integration tests in test/integration/test_all_features.py
- All 183 tests pass (122 backtesting + 29 qlib + 32 new)
Modified files:
- rdagent/app/qlib_rd_loop/quant.py: Results Database integration
- rdagent/scenarios/qlib/developer/factor_runner.py: Protection Manager
- rdagent/scenarios/qlib/developer/model_coder.py: model_loader baseline
- rdagent/scenarios/qlib/developer/factor_coder.py: Technical indicators
- test/qlib/test_fin_quant_integration.py: NEW - 23 integration tests
- test/integration/test_all_features.py: 9 enhanced tests
2026-04-03 14:10:44 +02:00
TPTBusiness
5ce86c824e
feat: Full system integration - RL + Protections + Backtesting + CLI
...
Connect all Predix components into unified trading system:
INTEGRATION (ALL 295 TESTS PASS):
- RL Trading connected with Protection Manager
- RL Trading connected with Backtesting Engine
- CLI command 'rdagent rl_trading' added (train/backtest/live modes)
- Graceful fallback for users without stable-baselines3
OPEN SOURCE COMPATIBILITY:
- System works WITHOUT stable-baselines3 (momentum fallback)
- System works WITHOUT local models/prompts (uses standard)
- Clear warning messages when optional deps missing
- GitHub users get FULLY WORKING system
CLOSED SOURCE PROTECTION:
- models/local/, prompts/local/, .env stay local only
- .gitignore properly configured
- Our alpha (best models/prompts) remains private
DOCUMENTATION:
- QWEN.md: Open/closed source strategy
- QWEN.md: Development guidelines for AI assistant
- QWEN.md: Open source compatibility principle
- README.md: RL Trading CLI commands and examples
- requirements/rl.txt: Optional RL dependencies
Modified files:
- rdagent/app/cli.py: Added rl_trading command
- rdagent/components/backtesting/backtest_engine.py: RL backtest support
- rdagent/components/coder/rl/costeer.py: Protection Manager integration
- rdagent/components/coder/rl/__init__.py: Conditional imports + fallback
- rdagent/components/coder/rl/fallback.py: NEW - Simple momentum fallback
- requirements.txt: Optional RL deps commented
- requirements/rl.txt: NEW - Full RL dependencies
- test/integration/test_all_features.py: 7 new integration tests
- QWEN.md: Open source strategy + development guidelines
- README.md: RL Trading documentation
295 tests pass: 67 integration + 89 RL + 139 backtesting
2026-04-03 13:53:32 +02:00
TPTBusiness
1bbca062af
feat: Add RL Trading Agent system with 99 tests
...
Implement Reinforcement Learning trading system inspired by FinRL concepts
(100% original code, NOT copied from FinRL MIT project):
RL ENVIRONMENT:
- TradingEnv: Gymnasium-compatible environment
- State: price history + indicators + portfolio state
- Action: continuous position [-1, 1] (short to long)
- Reward: return - transaction costs - drawdown penalty
RL AGENT:
- RLTradingAgent: Wrapper for Stable Baselines3
- Supports PPO (stable), A2C (fast), SAC (continuous)
- Methods: create_model(), train(), predict(), save(), load(), evaluate()
COSTEER (fills TODO at costeer.py:112):
- RLCosteer: RL-based trading controller
- Risk-limit enforcement (15% drawdown stops trading)
- Position scaling based on risk appetite
- Trade history tracking
TECHNICAL INDICATORS:
- RSI, MACD, Bollinger Bands, CCI, ATR
- prepare_features() helper for easy integration
TESTS (99 total, ALL PASS):
- 26 env tests
- 16 agent tests
- 19 costeer tests
- 18 indicator tests
- 10 integration tests
Documentation:
- Update QWEN.md with RL system architecture
2026-04-03 13:26:10 +02:00
TPTBusiness
bd025e50dc
feat: Add Trading Protection System with 4 protections + comprehensive tests
...
Implement automatic trading protection system to prevent excessive losses:
PROTECTIONS (100% original code, NOT copied from Freqtrade):
- Max Drawdown Protection: Blocks trading when DD > 15% (configurable)
- Cooldown Period: 4h mandatory rest after 5% loss
- Stoploss Guard: Detects stoploss clusters (>5 per day)
- Low Performance Filter: Filters factors with Sharpe < 0.5, Win Rate < 40%
ARCHITECTURE:
- Base protection interface with common utilities
- 4 specialized protection implementations
- ProtectionManager orchestrates all active protections
- Time-based blocking with automatic expiry
TESTS (32 total, ALL PASS):
- 25 unit tests in test/backtesting/test_protections.py
- 7 integration tests in test/integration/test_all_features.py
- Tests cover: normal operation, edge cases, error handling
DOCUMENTATION:
- Update QWEN.md with development guidelines for AI assistant
* Mandatory rules: Update QWEN.md, README, requirements.txt, tests
* Pre-commit checklist
* Example workflow
- Update README.md with protection system features
- Update project structure with new modules
All code is 100% original - NO license issues with Freqtrade GPLv3.
2026-04-03 13:01:56 +02:00
TPTBusiness
2a011d262e
chore: Simplify pre-commit to mandatory hooks only
...
- Remove optional code quality hooks (black, isort, ruff, mypy, toml-sort)
* These blocked commits when tools not installed
* Users can run them manually when needed
- Keep only MANDATORY hooks:
* Integration Tests (60 tests, ~7.5s)
* Bandit Security Scan
- Both MUST pass before every commit
2026-04-03 12:33:30 +02:00