import json
import sys
def decide(obs):
symbols = obs["symbols"]
weight = 1.0 / max(len(symbols), 1)
orders = [
{"symbol": s["symbol"], "action": "buy", "target_weight": weight,
"confidence": 0.5, "rationale": "equal-weight hold"}
for s in symbols
]
return {"orders": orders, "reasoning": "equal-weight buy-and-hold"}
def main():
for raw in sys.stdin:
line = raw.strip()
if not line:
continue
try:
decision = decide(json.loads(line))
except Exception:
decision = {"orders": [], "reasoning": "parse error -> hold"}
sys.stdout.write(json.dumps(decision) + "\n")
sys.stdout.flush()
if __name__ == "__main__":
main()