fix pred candles viz

This commit is contained in:
Dobromir Popov
2025-11-22 16:22:13 +02:00
parent 539bd68110
commit 423132dc8f
5 changed files with 140 additions and 25 deletions

View File

@@ -46,7 +46,7 @@ class TradeAnnotation:
def __post_init__(self):
if self.created_at is None:
self.created_at = datetime.now().isoformat()
self.created_at = datetime.now(pytz.UTC).isoformat()
if self.market_context is None:
self.market_context = {}
@@ -96,7 +96,7 @@ class AnnotationManager:
# Update metadata
self.annotations_db["metadata"] = {
"total_annotations": len(self.annotations_db["annotations"]),
"last_updated": datetime.now().isoformat()
"last_updated": datetime.now(pytz.UTC).isoformat()
}
with open(self.annotations_file, 'w') as f:
@@ -451,7 +451,7 @@ class AnnotationManager:
export_data = [asdict(ann) for ann in annotations]
# Create export file
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
timestamp = datetime.now(pytz.UTC).strftime('%Y%m%d_%H%M%S')
export_file = self.storage_path / f"export_{timestamp}.{format_type}"
if format_type == 'json':

View File

@@ -2143,7 +2143,7 @@ class RealTrainingAdapter:
checkpoint_dir = "models/checkpoints/transformer"
os.makedirs(checkpoint_dir, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
timestamp = datetime.now(timezone.utc).strftime("%Y%m%d_%H%M%S")
checkpoint_path = os.path.join(checkpoint_dir, f"transformer_epoch{epoch+1}_{timestamp}.pt")
torch.save({
@@ -2872,7 +2872,7 @@ class RealTrainingAdapter:
checkpoint_dir = "models/checkpoints/transformer/realtime"
os.makedirs(checkpoint_dir, exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
timestamp = datetime.now(timezone.utc).strftime("%Y%m%d_%H%M%S")
checkpoint_type = "BEST" if improved else "periodic"
checkpoint_path = os.path.join(checkpoint_dir, f"realtime_{checkpoint_type}_step{step}_{timestamp}.pt")
@@ -3137,7 +3137,7 @@ class RealTrainingAdapter:
if prediction:
# Store signal
signal = {
'timestamp': datetime.now().isoformat(),
'timestamp': datetime.now(timezone.utc).isoformat(),
'symbol': symbol,
'model': model_name,
'action': prediction['action'],
@@ -3158,7 +3158,7 @@ class RealTrainingAdapter:
# Store prediction for visualization
if self.orchestrator and hasattr(self.orchestrator, 'store_transformer_prediction'):
self.orchestrator.store_transformer_prediction(symbol, {
'timestamp': datetime.now(),
'timestamp': datetime.now(timezone.utc).isoformat(),
'current_price': current_price,
'predicted_price': current_price * (1.01 if prediction['action'] == 'BUY' else 0.99),
'price_change': 1.0 if prediction['action'] == 'BUY' else -1.0,