Merge commit '621a2505bd55db0f8295e5379638d7b1c7523620'

This commit is contained in:
Dobromir Popov 2025-03-10 16:43:19 +02:00
commit 8dafb6d310
17 changed files with 201994 additions and 784 deletions

4
.gitignore vendored
View File

@ -32,4 +32,6 @@ crypto/sol/.vs/*
crypto/brian/models/best/*
crypto/brian/models/last/*
crypto/brian/live_chart.html
crypto/gogo2/models/*
crypto/gogo2/trading_bot.log
*.log
crypto/gogo2/checkpoints/trading_agent_episode_30.pt

View File

@ -6,7 +6,7 @@
"type": "python",
"request": "launch",
"program": "main.py",
"args": ["--mode", "train", "--episodes", "1000"],
"args": ["--mode", "train", "--episodes", "100"],
"console": "integratedTerminal",
"justMyCode": true
},
@ -36,6 +36,15 @@
"args": ["--mode", "live"],
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Continuous Training",
"type": "python",
"request": "launch",
"program": "main.py",
"args": ["--mode", "continuous", "--refresh-data"],
"console": "integratedTerminal",
"justMyCode": true
}
]
}

24
crypto/gogo2/_notes.md Normal file
View File

@ -0,0 +1,24 @@
ensure we use GPU if available to train faster. during training we need to have RL loop that looks at streaming data, and retrospective backtesting/training on predictions. sincr the start of the traing we're only loosing. implement robust penalty and analysis when closing a loosing trade and improve the reward function.
2025-03-10 12:11:28,651 - INFO - Initialized environment with 500 candles
C:\Users\popov\miniforge3\Lib\site-packages\torch\nn\modules\transformer.py:385: UserWarning: enable_nested_tensor is True, but self.use_nested_tensor is False because encoder_layer.self_attn.batch_first was not True(use batch_first for better inference performance)
warnings.warn(
main.py:1105: FutureWarning: `torch.cuda.amp.GradScaler(args...)` is deprecated. Please use `torch.amp.GradScaler('cuda', args...)` instead.
self.scaler = amp.GradScaler()
C:\Users\popov\miniforge3\Lib\site-packages\torch\amp\grad_scaler.py:132: UserWarning: torch.cuda.amp.GradScaler is enabled, but CUDA is not available. Disabling.
warnings.warn(
2025-03-10 12:11:30,927 - INFO - Starting training for 1000 episodes...
2025-03-10 12:11:30,927 - INFO - Starting training on device: cpu
2025-03-10 12:11:30,928 - ERROR - Training failed: 'TradingEnvironment' object has no attribute 'initialize_price_predictor'
2025-03-10 12:11:30,928 - INFO - Exchange connection closed
Backend tkagg is interactive backend. Turning interactive mode on.
2025-03-10 12:35:14,489 - INFO - Episode 34: Reward=232.41, Balance=$98.47, Win Rate=70.6%, Trades=17, Episode PnL=$-1.33, Total PnL=$-559.78, Max Drawdown=7.0%, Pred Accuracy=99.9%

View File

@ -0,0 +1 @@
{"best_reward": 202.7441047517104, "best_pnl": 9.19044876852315, "best_win_rate": 73.33333333333333, "last_episode": 30, "timestamp": "2025-03-10T16:25:14.651996"}

4
crypto/gogo2/cuda.py Normal file
View File

@ -0,0 +1,4 @@
import torch
print(f"PyTorch version: {torch.__version__}")
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"CUDA version: {torch.version.cuda if torch.cuda.is_available() else 'Not available'}")

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,12 @@ pip install -r requirements.txt
```bash
MEXC_API_KEY=your_api_key
MEXC_API_SECRET=your_api_secret
cuda support
```bash
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
```
## Usage

View File

@ -6,4 +6,5 @@ python-dotenv>=0.19.0
ccxt>=2.0.0
websockets>=10.0
tensorboard>=2.6.0
scikit-learn
scikit-learn
mplfinance

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

View File

@ -0,0 +1 @@
episode_rewards,episode_lengths,balances,win_rates,episode_pnls,cumulative_pnl,drawdowns,prediction_accuracy
1 episode_rewards episode_lengths balances win_rates episode_pnls cumulative_pnl drawdowns prediction_accuracy

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB