Compare commits

..

4 Commits

2 changed files with 1431 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ from typing import Dict, List, Optional, Tuple, Any
from enum import Enum
from collections import deque
import random # Added for _simulate_websocket_ticks
from dataclasses import dataclass, field
# Nautilus imports - following test pattern
from nautilus_trader.config import TradingNodeConfig, ImportableActorConfig
@@ -333,7 +334,7 @@ class SILOQYMainActorConfig(ActorConfig):
class DOLPHINRegimeActorConfig(ActorConfig):
max_symbols: int = 5000
ticks_per_analysis: int = 1000
ticks_per_analysis: int = 10
class SILOQYNormalizerConfig(ActorConfig):
pass
@@ -988,6 +989,9 @@ class DOLPHINRegimeActor(Actor):
bullish = 0
bearish = 0
# NEW: Track pattern of bullish/bearish symbols for this calculation
symbol_pattern = []
# PRESERVED: Original analysis with exact thresholds
for idx in range(self.active_symbols):
open_price = self.open_prices[idx]
@@ -998,13 +1002,23 @@ class DOLPHINRegimeActor(Actor):
analyzed += 1
# PRESERVED: EXACT DOLPHIN thresholds
change = (close_price - open_price) / open_price
# NEW: Direct price comparison with epsilon for precision
EPSILON = 1e-10 # Very small tolerance to capture any meaningful price change
if change >= 0.0015: # 0.15% threshold for bullish
# Check if prices are effectively equal
if abs(close_price - open_price) <= EPSILON:
# Prices are effectively equal
symbol_pattern.append(f"S{close_price:.2f}={open_price:.2f}")
elif close_price > open_price:
# Bullish: close > open
bullish += 1
elif change <= -0.0015: # -0.15% threshold for bearish
# Arrow points to close (larger price)
symbol_pattern.append(f"B{open_price:.2f}->{close_price:.2f}")
else:
# Bearish: close < open
bearish += 1
# Arrow points to open (larger price)
symbol_pattern.append(f"X{close_price:.2f}<-{open_price:.2f}")
if analyzed == 0:
return
@@ -1055,10 +1069,17 @@ class DOLPHINRegimeActor(Actor):
self.regime_history.append(regime)
# Periodic regime status (even without changes)
if self.regime_calculations % 10 == 0: # Every 10 calculations
if self.regime_calculations % 1 == 0: # Every calculation
self.log.info(f"REGIME STATUS: {regime.value} | Bull: {bull_ratio:.1%} "
f"Bear: {bear_ratio:.1%} | Processed: {self.processed_ticks} ticks")
# NEW: Log symbol pattern and counts
if symbol_pattern: # Only if we have symbols to show
pattern_str = " ".join(symbol_pattern) + " " # Create pattern with spaces
bull_count = sum(1 for s in symbol_pattern if s.startswith("B"))
bear_count = sum(1 for s in symbol_pattern if s.startswith("X"))
self.log.info(f"{pattern_str} and totals: BULLS:{bull_count}/BEARS:{bear_count}")
def _calculate_confidence(self, bull_ratio: float, bear_ratio: float,
analyzed: int, total: int) -> float:
"""PRESERVED EXACTLY: Original DOLPHIN confidence calculation"""
@@ -1183,7 +1204,7 @@ def test_siloqy_actors_with_nautilus_process_management():
"component_id": "SILOQY-MAIN-ACTOR",
"candle_interval_ms": 15 * 60 * 1000,
"throttle_mode": True, # ENABLED: Reduced tick generation
"enable_real_data": False # CHANGE TO True for real WebSocket data
"enable_real_data": True # CHANGE TO True for real WebSocket data
}
)
@@ -1193,7 +1214,7 @@ def test_siloqy_actors_with_nautilus_process_management():
config={
"component_id": "DOLPHIN-REGIME-ACTOR",
"max_symbols": 5000,
"ticks_per_analysis": 500 # Reduced for throttle mode testing
"ticks_per_analysis": 2 # Reduced for throttle mode testing
}
)
@@ -1220,6 +1241,7 @@ def test_siloqy_actors_with_nautilus_process_management():
node = TradingNode(config=trading_config)
try:
node.build()
print("Node built successfully with Nautilus built-in process management")