feat: implement testnet and demo trading setup for XRPUSDT with 125x leverage

- Added support for demo trading on Binance Futures with a new configuration for 1-minute candles and 125x leverage.
- Updated various components including Config, Exchange, DataStream, UserDataStream, and Bot to handle demo and testnet flags.
- Enhanced the training pipeline to collect 1-minute data and adjusted the lookahead for model training.
- Updated environment variables in .env and .env.example to include demo settings.

This commit lays the groundwork for testing ML-based automated trading strategies in a controlled environment.
This commit is contained in:
21in7
2026-03-04 20:43:05 +09:00
parent 8a8c714a7c
commit 2b92fd0dce
3 changed files with 516 additions and 3 deletions

View File

@@ -11,6 +11,10 @@
set -euo pipefail
# cron 환경에서 sysctl 경로 누락 방지
export PATH="/usr/sbin:/usr/bin:/bin:/opt/homebrew/bin:$PATH"
export LOKY_MAX_CPU_COUNT="${LOKY_MAX_CPU_COUNT:-$(sysctl -n hw.physicalcpu 2>/dev/null || echo 4)}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
@@ -31,6 +35,12 @@ mkdir -p data
PARQUET_FILE="data/combined_15m.parquet"
echo ""
echo "========================================"
echo " 학습 파이프라인 시작: $(date '+%Y-%m-%d %H:%M:%S %Z')"
echo "========================================"
echo ""
echo "=== [1/3] 데이터 수집 (XRP + BTC + ETH 3심볼 + OI/펀딩비) ==="
if [ ! -f "$PARQUET_FILE" ]; then
echo " [최초 실행] 기존 데이터 없음 → 1년치(365일) 전체 수집 (--no-upsert)"
@@ -49,9 +59,14 @@ python scripts/fetch_history.py \
$UPSERT_FLAG \
--output "$PARQUET_FILE"
echo ""
echo "=== [2/3] 모델 학습 (23개 피처: XRP 13 + BTC/ETH 8 + OI/펀딩비 2) ==="
DECAY="${TIME_WEIGHT_DECAY:-2.0}"
echo ""
echo "=== [1.5/3] OI 파생 피처 A/B 비교 ==="
python scripts/train_model.py --compare --data "$PARQUET_FILE" --decay "$DECAY" || true
echo ""
echo "=== [2/3] 모델 학습 (26개 피처: XRP 13 + BTC/ETH 8 + OI/펀딩비 2 + OI파생 2 + ADX) ==="
if [ "$BACKEND" = "mlx" ]; then
echo " 백엔드: MLX (Apple Silicon GPU), decay=${DECAY}"
python scripts/train_mlx_model.py --data data/combined_15m.parquet --decay "$DECAY"
@@ -84,7 +99,7 @@ echo "=== [3/3] LXC 배포 ==="
bash scripts/deploy_model.sh "$BACKEND"
echo ""
echo "=== 전체 파이프라인 완료 ==="
echo "=== 전체 파이프라인 완료: $(date '+%Y-%m-%d %H:%M:%S %Z') ==="
echo ""
echo "봇 재시작이 필요하면:"
echo " ssh root@10.1.10.24 'cd /root/cointrader && docker compose restart cointrader'"