Compare commits
4 Commits
9f1dbffc2a
...
c9cffb4b53
| Author | SHA1 | Date | |
|---|---|---|---|
| c9cffb4b53 | |||
| 0f9a4a6f9c | |||
| 8b59e0ed4e | |||
| b5cd68263c |
1399
SILOQY_DOLPHIN_Integration_Engineering_Spect_1.0.md
Normal file
1399
SILOQY_DOLPHIN_Integration_Engineering_Spect_1.0.md
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ from typing import Dict, List, Optional, Tuple, Any
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from collections import deque
|
from collections import deque
|
||||||
import random # Added for _simulate_websocket_ticks
|
import random # Added for _simulate_websocket_ticks
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
# Nautilus imports - following test pattern
|
# Nautilus imports - following test pattern
|
||||||
from nautilus_trader.config import TradingNodeConfig, ImportableActorConfig
|
from nautilus_trader.config import TradingNodeConfig, ImportableActorConfig
|
||||||
@@ -333,7 +334,7 @@ class SILOQYMainActorConfig(ActorConfig):
|
|||||||
|
|
||||||
class DOLPHINRegimeActorConfig(ActorConfig):
|
class DOLPHINRegimeActorConfig(ActorConfig):
|
||||||
max_symbols: int = 5000
|
max_symbols: int = 5000
|
||||||
ticks_per_analysis: int = 1000
|
ticks_per_analysis: int = 10
|
||||||
|
|
||||||
class SILOQYNormalizerConfig(ActorConfig):
|
class SILOQYNormalizerConfig(ActorConfig):
|
||||||
pass
|
pass
|
||||||
@@ -988,6 +989,9 @@ class DOLPHINRegimeActor(Actor):
|
|||||||
bullish = 0
|
bullish = 0
|
||||||
bearish = 0
|
bearish = 0
|
||||||
|
|
||||||
|
# NEW: Track pattern of bullish/bearish symbols for this calculation
|
||||||
|
symbol_pattern = []
|
||||||
|
|
||||||
# PRESERVED: Original analysis with exact thresholds
|
# PRESERVED: Original analysis with exact thresholds
|
||||||
for idx in range(self.active_symbols):
|
for idx in range(self.active_symbols):
|
||||||
open_price = self.open_prices[idx]
|
open_price = self.open_prices[idx]
|
||||||
@@ -998,13 +1002,23 @@ class DOLPHINRegimeActor(Actor):
|
|||||||
|
|
||||||
analyzed += 1
|
analyzed += 1
|
||||||
|
|
||||||
# PRESERVED: EXACT DOLPHIN thresholds
|
# NEW: Direct price comparison with epsilon for precision
|
||||||
change = (close_price - open_price) / open_price
|
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
|
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
|
bearish += 1
|
||||||
|
# Arrow points to open (larger price)
|
||||||
|
symbol_pattern.append(f"X{close_price:.2f}<-{open_price:.2f}")
|
||||||
|
|
||||||
if analyzed == 0:
|
if analyzed == 0:
|
||||||
return
|
return
|
||||||
@@ -1055,9 +1069,16 @@ class DOLPHINRegimeActor(Actor):
|
|||||||
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 % 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%} "
|
self.log.info(f"REGIME STATUS: {regime.value} | Bull: {bull_ratio:.1%} "
|
||||||
f"Bear: {bear_ratio:.1%} | Processed: {self.processed_ticks} ticks")
|
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,
|
def _calculate_confidence(self, bull_ratio: float, bear_ratio: float,
|
||||||
analyzed: int, total: int) -> float:
|
analyzed: int, total: int) -> float:
|
||||||
@@ -1183,7 +1204,7 @@ def test_siloqy_actors_with_nautilus_process_management():
|
|||||||
"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": 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={
|
config={
|
||||||
"component_id": "DOLPHIN-REGIME-ACTOR",
|
"component_id": "DOLPHIN-REGIME-ACTOR",
|
||||||
"max_symbols": 5000,
|
"max_symbols": 5000,
|
||||||
"ticks_per_analysis": 500 # Reduced for throttle mode testing
|
"ticks_per_analysis": 2 # Reduced for throttle mode testing
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1218,8 +1239,9 @@ def test_siloqy_actors_with_nautilus_process_management():
|
|||||||
exec_clients={} # No execution clients for this test
|
exec_clients={} # No execution clients for this test
|
||||||
)
|
)
|
||||||
|
|
||||||
node = TradingNode(config=trading_config)
|
node = TradingNode(config=trading_config)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
node.build()
|
node.build()
|
||||||
print("Node built successfully with Nautilus built-in process management")
|
print("Node built successfully with Nautilus built-in process management")
|
||||||
|
|||||||
Reference in New Issue
Block a user