WIP: feat(nautilus): initial integration #1

Draft
hjnormey wants to merge 14 commits from feat/nautilus-dolphin-integration into main
Showing only changes of commit 4748a7ba62 - Show all commits

View File

@@ -1126,25 +1126,37 @@ class DOLPHINRegimeActor(Actor):
except Exception as e: except Exception as e:
self.log.error(f"Nautilus ActorExecutor: Failed to publish regime result: {e}") self.log.error(f"Nautilus ActorExecutor: Failed to publish regime result: {e}")
# Log regime changes # Log regime changes
if not self.regime_history or regime != self.regime_history[-1]: if not self.regime_history or regime != self.regime_history[-1]:
self.log.info(f"REGIME CHANGE: {regime.value} | Bull: {bull_ratio:.1%} " self.log.info(f"REGIME CHANGE: {regime.value} | Bull: {bull_ratio:.2%} "
f"Bear: {bear_ratio:.1%} Sideways: {sideways_ratio:.1%} | " f"Bear: {bear_ratio:.2%} Sideways: {sideways_ratio:.2%} ({bullish}/{bearish}) | "
f"Confidence: {confidence:.1%} | Analyzed: {analyzed}/{total_symbols}") f"Confidence: {confidence:.2%} | Analyzed: {analyzed}/{total_symbols}")
self.regime_history.append(regime) self.regime_history.append(regime)
# Periodic regime status (even without changes) # Periodic regime status (even without changes)
if self.regime_calculations % 1 == 0: # Every calculation if self.regime_calculations % 50 == 0: # Every second, approx, given avg. tick rate
self.log.info(f"REGIME STATUS: {regime.value} | Bull: {bull_ratio:.1%} " # Determine color based on regime
f"Bear: {bear_ratio:.1%} | Processed: {self.processed_ticks} ticks") if regime == MarketRegime.BULL:
color_code = "\033[92m" # Green
elif regime == MarketRegime.BEAR:
color_code = "\033[91m" # Red
else: # SIDEWAYS
color_code = "\033[93m" # Yellow
# Reset color code
reset_code = "\033[0m"
self.log.info(f"{color_code}REGIME STATUS: {regime.value} | Bull: {bull_ratio:.2%} "
f"Bear: {bear_ratio:.2%} ({bullish}/{bearish}) | Processed: {self.processed_ticks} ticks{reset_code}")
# NEW: Log symbol pattern and counts # NEW: Log symbol pattern and counts
if symbol_pattern: # Only if we have symbols to show if symbol_pattern: # Only if we have symbols to show
pattern_str = " ".join(symbol_pattern) + " " # Create pattern with spaces pattern_str = " ".join(symbol_pattern) + " " # Create pattern with spaces
bull_count = sum(1 for s in symbol_pattern if s.startswith("B")) 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")) 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}")
self.log.debug(f"{pattern_str} and totals: BULLS:{bull_count}/BEARS:{bear_count}")
def _calculate_confidence(self, bull_ratio: float, bear_ratio: float, def _calculate_confidence(self, bull_ratio: float, bear_ratio: float,
analyzed: int, total: int) -> float: analyzed: int, total: int) -> float:
@@ -1259,7 +1271,7 @@ def test_siloqy_actors_with_nautilus_process_management():
"candle_interval_ms": 15 * 60 * 1000, "candle_interval_ms": 15 * 60 * 1000,
"throttle_mode": True, # ENABLED: Safe for dual instance testing "throttle_mode": True, # ENABLED: Safe for dual instance testing
"throttle_rate_limit_seconds": 10.0, # 10s between batches (vs 2.5s) "throttle_rate_limit_seconds": 10.0, # 10s between batches (vs 2.5s)
"max_symbols_throttled": 100 # Only 100 symbols (vs 2000+) "max_symbols_throttled": 414 # Only 100 symbols (vs 2000+)
} }
) )
@@ -1269,7 +1281,7 @@ def test_siloqy_actors_with_nautilus_process_management():
config={ config={
"component_id": "SILOQY-MAIN-ACTOR", "component_id": "SILOQY-MAIN-ACTOR",
"candle_interval_ms": 15 * 60 * 1000, "candle_interval_ms": 15 * 60 * 1000,
"throttle_mode": True, # ENABLED: Reduced tick generation "throttle_mode": False, # ENABLED: Reduced tick generation
"enable_real_data": True # CHANGE TO True for real WebSocket data "enable_real_data": True # CHANGE TO True for real WebSocket data
} }
) )