How amidamaru161/pfm works
This repository implements reinforcement-learning portfolio optimization: market-price data is prepared into features, a DRL policy proposes portfolio weights, and a trading environment simulates rebalancing and returns. The agent layer coordinates training and validation; prediction supports inference and simulation from saved weights. The README establishes the broad capabilities, while the excerpts show only selected calls, so unsampled preprocessing-to-training wiring is documented rather than assumed.
Main entry points: predict_future_distribution.py Distribution prediction · policy_gradient.py Policy gradient · hyper_policy.py Hyper policy · portfolio_memory.py Portfolio memory
Components 14
Market data
- Market CSVs
data - Feature engineering
preprocessing/feature_creating.py - Market utilities
utils/utils.py
RL training
- DRL agent
agents/dlr_agent.py - Policy gradient
agents/policy_gradient.py - Hyper policy
agents/hyper_policy.py - Portfolio memory
environments/portfolio_memory.py
Policy networks
- EIIE / EI3 / GPM
models/models.py - Hyper network
models/hyper_net.py - Hyper network base
models/hyper_net_base.py
Portfolio simulation
- Portfolio environment
environments/portfolio_env.py
Prediction
- Saved weights
saved_models - Distribution prediction
prediction/predict_future_distribution.py
Other components
- MOEX ISS
Connections 15
- Market CSVs → Feature engineering: prepares features
README.md - Market utilities → MOEX ISS: downloads candles
utils/utils.py - Feature engineering → Market utilities: uses indicators
preprocessing/feature_creating.py - DRL agent → Policy gradient: selects algorithm
agents/dlr_agent.py - DRL agent → Hyper policy: selects algorithm
agents/dlr_agent.py - Policy gradient → Portfolio environment: steps environment
- Hyper policy → Portfolio environment: steps environment
agents/hyper_policy.py - Policy gradient → Portfolio memory: uses memory
agents/policy_gradient.py - Hyper policy → Portfolio memory: uses memory
agents/hyper_policy.py - Policy gradient → EIIE / EI3 / GPM: uses policies
agents/policy_gradient.py - Hyper policy → Hyper network: uses policy
agents/hyper_policy.py - Distribution prediction → EIIE / EI3 / GPM: loads model
prediction/predict_future_distribution.py - Distribution prediction → Portfolio environment: steps simulation
prediction/predict_future_distribution.py - Distribution prediction → Portfolio memory: retrieves actions
prediction/predict_future_distribution.py - Distribution prediction → Saved weights: loads weights
prediction/predict_future_distribution.py