Files
NexQuant/rdagent/components/coder/rl/__init__.py
T
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

35 lines
972 B
Python

"""RL Trading Agent components for Predix.
This package provides:
- RLCoSTEER: LLM-based code generation for RL training pipelines
- RLCosteer: RL-based trading controller using trained models
- TradingEnv: Gym-compatible trading environment
- RLTradingAgent: Stable Baselines3 wrapper for PPO, A2C, SAC
- Technical indicators: RSI, MACD, Bollinger Bands, CCI, ATR
"""
from rdagent.components.coder.rl.agent import RLTradingAgent
from rdagent.components.coder.rl.costeer import RLCoSTEER, RLCosteer
from rdagent.components.coder.rl.env import TradingEnv
from rdagent.components.coder.rl.indicators import (
calculate_atr,
calculate_bollinger_bands,
calculate_cci,
calculate_macd,
calculate_rsi,
prepare_features,
)
__all__ = [
"RLCoSTEER",
"RLCosteer",
"RLTradingAgent",
"TradingEnv",
"calculate_atr",
"calculate_bollinger_bands",
"calculate_cci",
"calculate_macd",
"calculate_rsi",
"prepare_features",
]