72 lines
2.3 KiB
Python
72 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Preview DingTalk message format using saved signal"""
|
|
import json
|
|
import sys
|
|
|
|
# Add current directory to path
|
|
sys.path.insert(0, '/Users/aaron/source_code/tradus-ai/realtime-ingestion')
|
|
|
|
from notifiers.dingtalk import DingTalkNotifier
|
|
|
|
# Load the saved signal
|
|
with open('/Users/aaron/source_code/tradus-ai/realtime-ingestion/output/latest_signal.json', 'r') as f:
|
|
signal = json.load(f)
|
|
|
|
# Create DingTalk notifier (without webhook for preview only)
|
|
notifier = DingTalkNotifier(webhook_url=None, enabled=False)
|
|
|
|
# Debug: Check signal structure
|
|
print("Signal keys:", list(signal.keys()))
|
|
|
|
# Format the message
|
|
aggregated_signal = signal.get('aggregated_signal', {})
|
|
if not aggregated_signal:
|
|
print("ERROR: aggregated_signal is empty!")
|
|
aggregated_signal = signal # Maybe the whole signal is the aggregated_signal
|
|
|
|
print("Aggregated signal keys:", list(aggregated_signal.keys()) if aggregated_signal else "None")
|
|
|
|
try:
|
|
markdown = notifier._format_signal_markdown(aggregated_signal)
|
|
except Exception as e:
|
|
print(f"ERROR formatting markdown: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
markdown = "Error formatting message"
|
|
|
|
print("=" * 80)
|
|
print("📱 DINGTALK MESSAGE PREVIEW")
|
|
print("=" * 80)
|
|
print(markdown)
|
|
print("=" * 80)
|
|
|
|
# Show data structure for debugging
|
|
print("\n\n")
|
|
print("=" * 80)
|
|
print("📊 DATA STRUCTURE DEBUG")
|
|
print("=" * 80)
|
|
|
|
llm_signal = aggregated_signal.get('llm_signal', {})
|
|
opportunities = llm_signal.get('opportunities', {})
|
|
recommendations = llm_signal.get('recommendations_by_timeframe', {})
|
|
|
|
print("\nopportunities keys:")
|
|
for key in opportunities.keys():
|
|
print(f" - {key}")
|
|
|
|
print("\nshort_term_5m_15m_1h:")
|
|
short_term = opportunities.get('short_term_5m_15m_1h', {})
|
|
print(f" exists: {short_term.get('exists')}")
|
|
print(f" direction: {short_term.get('direction')}")
|
|
print(f" reasoning: {short_term.get('reasoning', '')[:100]}...")
|
|
|
|
print("\nmedium_term_4h_1d:")
|
|
medium_term = opportunities.get('medium_term_4h_1d', {})
|
|
print(f" exists: {medium_term.get('exists')}")
|
|
print(f" reasoning: {medium_term.get('reasoning', '')[:100]}...")
|
|
|
|
print("\nrecommendations_by_timeframe:")
|
|
print(f" short_term: {recommendations.get('short_term', '')[:100]}...")
|
|
print(f" medium_term: {recommendations.get('medium_term', '')[:100]}...")
|
|
print(f" long_term: {recommendations.get('long_term', '')[:100]}...")
|