Trading NVIDIA Derivatives using SAC
12 JULY 2025: Project EOL. Moving on to pastures new.
DerivSAC/
├── config/
│ ├── config.yaml # Configuration parameters
├── docs/
├── hyperparameters/
│ ├── sac.yml
├── notebooks/
├── tests/
│ ├── __init__.py
│ ├── alpha_test.py
│ ├── conftest.py
│ ├── test_engine.py
│ ├── test_simple.py
├── trading_bot/
│ ├── analysis/
│ │ ├── __init__.py
│ │ ├── technical.py # Technical analysis
│ ├── core/
│ │ ├── bot.py
│ │ ├── sac_bot.py
│ ├── data/
│ │ ├── local_data/
│ │ │ ├── NVDA_1d_max.pkl
│ │ ├── __init__.py
│ │ ├── data_pipeline.py # Data fetching and processing
│ │ ├── indicators.py # Technical indicators
│ │ ├── sentiment_pipeline.py
│ ├── sac/
│ │ ├── zoo/
│ │ │ ├── __init__.py
│ │ │ ├── gradient_clipping_callback.py
│ │ │ ├── hyperparams_opt.py
│ │ │ ├── rl_zoo_env.py
│ │ │ ├── trading_zoo_callback.py
│ │ │ ├── train.py
│ │ │ ├── utils.py
│ │ ├── __init__.py
│ │ ├── test_model.py
│ ├── strategies/
│ │ ├── macd.py
│ ├── trade_env/
│ │ ├── __init__.py
│ │ ├── engine.py
│ │ ├── metrics.py
│ │ ├── nvidia.py
│ │ ├── position.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── config.py
│ │ ├── logger.py # Logging utilities
│ │ ├── output.py
│ ├── __init__.py
│ ├── main.py # Main entry point
├── trading_bot.egg-info/
│ ├── PKG-INFO
│ ├── SOURCES.txt
│ ├── dependency_links.txt
│ ├── requires.txt
│ ├── top_level.txt
├── utils/
│ ├── README.md
│ ├── __init__.py
│ ├── generate_directory_structure.py
│ ├── update_readme_directory.py
├── .gitignore
├── README.md
├── backtest_results.png
├── pyproject.toml
├── requirements.txt
├── setup.cfg
├── setup.py
├── strategy_comparison.png
- Create and activate virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\Activate.ps1- Install dependencies:
pip install -r requirements.txtNOTE: If the dependencies did not install CUDA toolkit for you, go online to download it. The version used here is CUDA 12.4. This is required to train the model using GPU.
- Run main.py for current analysis
python trading_bot\main.py- Run this command to begin RL-Baseline3 Zoo environment wrapped to ours.
python -m trading_bot.sac.zoo.train --algo sac --env NVIDIATrading-v0 --device cuda --conf-file .\hyperparameters\sac.ymlpython -m trading_bot.sac.zoo.train --algo sac --env NVIDIATrading-v0 --device cuda --optimize --n-trials 50 --max-total-trials 50 --n-jobs 4 --sampler tpe --pruner median --n-evaluations 5 --eval-episodes 10 --conf-file .\hyperparameters\sac.yml --optimization-log-path logs/optimizer_results --tensorboard-log logs/tensorboardpython -m trading_bot.sac.zoo.train --algo sac --env NVIDIATrading-v0 --device cuda --optimize --n-trials 100 --n-jobs 6 --sampler tpe --pruner median --conf-file ./hyperparameters/sac.yml --optimization-log-path /opt/ml/model/optimizer_results --tensorboard-log /opt/ml/model/tensorboard --n-evaluations 5 --eval-episodes 5 --storage sqlite:////opt/ml/model/optuna.dbpython -m trading_bot.sac.zoo.train --algo sac --env NVIDIATrading-v0 --device cuda --optimize --n-trials 150 --n-jobs 8 --sampler tpe --pruner median --conf-file ./hyperparameters/sac.yml --optimization-log-path /opt/ml/model/optimizer_results --tensorboard-log /opt/ml/model/tensorboard --n-evaluations 5 --eval-episodes 8 --storage sqlite:////opt/ml/model/optuna.dbpython -m trading_bot.sac.zoo.train --algo sac --env NVIDIATrading-v0 --device cuda --optimize --n-trials 200 --n-jobs 24 --sampler tpe --pruner median --conf-file ./hyperparameters/sac.yml --optimization-log-path /opt/ml/model/optimizer_results --tensorboard-log /opt/ml/model/tensorboard --n-evaluations 5 --eval-episodes 10 --storage sqlite:////opt/ml/model/optuna.dbTo begin unit testing, run the following command:
pytestRunning main one time would generate a default config file. From there, you can edit and change certain parameters to your liking.