rl cob subscription model

This commit is contained in:
Dobromir Popov
2025-06-24 19:07:42 +03:00
parent 6702a490dd
commit 97f7f54c30
6 changed files with 405 additions and 43 deletions

View File

@ -18,7 +18,7 @@ import sys
import json
import os
from datetime import datetime
from typing import Dict, Any
from typing import Dict, Any, Optional
# Local imports
from core.realtime_rl_cob_trader import RealtimeRLCOBTrader
@ -44,9 +44,10 @@ class RealtimeRLCOBTraderLauncher:
def __init__(self, config_path: str = "config.yaml"):
"""Initialize launcher with configuration"""
self.config_path = config_path
self.config = load_config(config_path)
self.trader = None
self.trading_executor = None
self.trader: Optional[RealtimeRLCOBTrader] = None
self.trading_executor: Optional[TradingExecutor] = None
self.running = False
# Setup signal handlers for graceful shutdown
@ -108,10 +109,7 @@ class RealtimeRLCOBTraderLauncher:
simulation_mode = True
# Initialize trading executor
self.trading_executor = TradingExecutor(
simulation_mode=simulation_mode,
mexc_config=mexc_config
)
self.trading_executor = TradingExecutor(self.config_path)
logger.info(f"Trading Executor initialized in {'SIMULATION' if simulation_mode else 'LIVE'} mode")
@ -132,6 +130,9 @@ class RealtimeRLCOBTraderLauncher:
model_checkpoint_dir = rl_config.get('model_checkpoint_dir', 'models/realtime_rl_cob')
# Initialize RL trader
if self.trading_executor is None:
raise RuntimeError("Trading executor not initialized")
self.trader = RealtimeRLCOBTrader(
symbols=symbols,
trading_executor=self.trading_executor,
@ -151,6 +152,8 @@ class RealtimeRLCOBTraderLauncher:
logger.info("Starting Real-time RL COB Trading System...")
# Start RL trader (this will start COB integration internally)
if self.trader is None:
raise RuntimeError("RL trader not initialized")
await self.trader.start()
self.running = True