22 lines
932 B
Python
22 lines
932 B
Python
#!/usr/bin/env python3
|
|
"""Extract summary from altcoin_confirm.py output (skip non-JSON lines)."""
|
|
import json, sys
|
|
|
|
lines = sys.stdin.read()
|
|
# Find the JSON object start
|
|
start = lines.find('{')
|
|
if start == -1:
|
|
print("No JSON found in output")
|
|
sys.exit(1)
|
|
|
|
# Try to parse from the first { onwards
|
|
d = json.loads(lines[start:])
|
|
print(f"confirmed_count: {d['confirmed_count']}")
|
|
print(f"unconfirmed_count: {d['unconfirmed_count']}")
|
|
print(f"check_time: {d['check_time']}")
|
|
for u in d['unconfirmed']:
|
|
sigs = "|".join(u['signals'])
|
|
print(f"UNCONFIRMED: {u['symbol']} | price={u['price']} | score={u['score']} | action={u['entry_action']} | reason={u['state_update']['reason']} | signals={sigs}")
|
|
for c in d['confirmed']:
|
|
sigs = "|".join(c['signals'])
|
|
print(f"CONFIRMED: {c['symbol']} | price={c['price']} | score={c['score']} | action={c['entry_action']} | reason={c['state_update']['reason']} | signals={sigs}") |