Hedges is an autonomous investment engine that uses NLP and Reinforcement Learning to generate trading signals and execute trades.
It is designed to be modular and extensible, allowing for easy experimentation with different models and strategies.
hedges/
├── README.md
├── pyproject.toml # manage Python dependencies
├── config/
│ └── settings.yaml # central config for API keys, model params, etc.
├── data/
│ ├── raw/ # unprocessed data dumps (news, market data, etc.)
│ ├── interim/ # any partial cleaning or intermediate files
│ └── processed/ # final, cleaned data ready for modeling
├── src/
│ ├── nlp_signals/ # FinGPT (or other NLP) logic
│ │ ├── __init__.py
│ │ ├── pipeline.py # text ingestion, cleaning, feature extraction
│ │ └── sentiment.py # e.g. sentiment classification
│ ├── rl_trading/ # FinRL logic
│ │ ├── __init__.py
│ │ ├── train.py # RL agent training
│ │ └── evaluate.py # backtesting & performance metrics
│ └── execution/
│ ├── __init__.py
│ ├── live_trader.py # broker connections, order execution
│ └── portfolio.py # basic portfolio tracking
├── tests/
| ├── conftest.py # pytest fixtures
│ ├── test_nlp.py # test NLP pipeline
│ │── test_rl.py # test RL training
│ ├── test_backtesting.py # test RL backtesting
│ └── test_execution.py # test live trading
└── scripts/
├── run_nlp_pipeline.sh
├── run_rl_training.sh
├── run_backtest.sh
├── run_live_trading.sh
├── run_tests.sh
└── run_all.sh
This project uses Poetry for dependency management. Install it first if you don't have it already.
pip install poetryClone the repository and install dependencies:
git clone git@github.com:dnstock/hedges.git
cd hedges
poetry installAPI keys, model hyperparameters, and other settings are stored in config/settings.yaml.
Create it by copying config/settings_template.yaml and modifying in the necessary values.
cp config/settings_template.yaml config/settings.yamlSensitive information like API keys can optionally be stored in an .env file.
Any variables defined here will override those in config/settings.yaml.
cp .env_template .envFrom the project root directory:
./scripts/run_nlp_pipeline.sh # run NLP pipeline
./scripts/run_rl_training.sh # train RL agent
./scripts/run_backtest.sh # evaluate agent performance
./scripts/run_live_trading.sh # execute or simulate live trades
./scripts/run_all.sh # runs all modules (except live trading)Run tests with pytest via the run_tests.sh script:
./scripts/run_tests.sh # run all tests (default)
./scripts/run_tests.sh nlp # run NLP pipeline tests
./scripts/run_tests.sh rl # run RL training tests
./scripts/run_tests.sh bt # run backtesting tests
./scripts/run_tests.sh lt # run live trading testsContributions are welcome!
To contribute, please follow these steps:
- Fork the repository
gh repo fork git@github.com:dnstock/hedges.git- Create a new branch
git checkout -b feature/my-feature- Make your changes
git add .
git commit -m "Add my feature"- Commit your changes to your fork
git push origin feature/my-feature- Create a pull request
gh pr create- Wait for review and approval
gh pr status- Make any requested changes
git add .
git commit -m "Address review comments"
git push origin feature/my-feature- Merge your changes
gh pr merge- Celebrate your contribution!
🎉For support, please contact the author.
This project is licensed under the MIT License - see the LICENSE file for details.