1name: alpaca_live 2description: | 3 Trading arena fed by Alpaca data via trtools2. MAF never calls Alpaca 4 directly — trtools2 owns the Alpaca ingestion (live feed engine writes 5 bars/news to Redis Streams; the dashboard's HTTP API serves historical 6 queries from QuestDB). 7 8 Two routes into the same data: 9 • Hot path — trtools2_bars / trtools2_news Redis Streams. Sub-second 10 latency, populated by the live feed engine. 11 • Warm path — trtools2_api HTTP client. Used when the analyst needs 12 bars over a specific window or wants the per-symbol coverage stats. 13 14 Bring up requires: trtools2 feed engine running, trtools2 dashboard on 15 :8888. The Setup tab's freshness badges flag whether each route is live. 16 17schedule: null 18output_stream: "maf:arena:alpaca_live:output" 19max_iterations: 1 20target_key: ticker 21 22# Smart triggers — fire on Kronos high-confidence directional calls or on 23# the trtools2 strategy engine emitting a BUY/SELL. 24triggers: 25 - name: "kronos high confidence on watched ticker" 26 on_stream: "kronos:forecasts:emitted" 27 when: "payload.prob_up > 0.75 or payload.prob_up < 0.25" 28 target: 29 ticker: "{payload.symbol}" 30 cooldown_s: 120 31 action_mode: manual 32 33 - name: "trtools2 strategy event" 34 on_stream: "trtools2:strategy:events" 35 when: "payload.action == 'BUY' or payload.action == 'SELL'" 36 target: 37 ticker: "{payload.symbol}" 38 cooldown_s: 60 39 action_mode: semi 40 41llm: 42 default_model: glm-4.7 43 synthesis_model: gpt-oss:120b 44 45memory: {} 46 47sources: 48 # Hot path — live Redis Streams populated by trtools2's feed engine. 49 - name: bars_1m 50 adapter: trtools2_bars 51 config: 52 timeframe: 1m 53 limit: 100 54 - name: bars_1h 55 adapter: trtools2_bars 56 config: 57 timeframe: 1h 58 limit: 100 59 - name: news_live 60 adapter: trtools2_news 61 config: 62 limit: 25 63 - name: strategy_events 64 adapter: trtools2_strategy_events 65 config: 66 limit: 50 67 68 # Warm path — HTTP API for richer queries when the agent needs historical 69 # depth, symbol-scoped news, or pipeline freshness. 70 - name: history_bars 71 adapter: trtools2_api 72 config: 73 query_type: bars 74 timeframe: 1d 75 limit: 50 76 - name: snapshot 77 adapter: trtools2_api 78 config: 79 query_type: snapshot 80 - name: feed_health 81 adapter: trtools2_api 82 config: 83 query_type: feed_stats 84 85phases: 86 - name: analysis 87 pattern: parallel 88 transition: synthesis 89 agents: 90 - name: trtools2_analyst 91 role: specialist 92 llm_tier: quick 93 max_react_steps: 6 94 sources: 95 - bars_1m 96 - bars_1h 97 - news_live 98 - strategy_events 99 - history_bars 100 - snapshot 101 - feed_health 102 system_prompt: | 103 You are a trading analyst with Alpaca data sourced through 104 trtools2. You see live 1m + 1h bars, news with sentiment, 105 strategy-engine signals, historical daily bars over the last 106 ~10 weeks, and a snapshot of the latest trade. 107 108 First check the feed_stats — if the live feed is stale, mark 109 the data quality as degraded and lower your confidence. 110 111 Output a single AgentSignal JSON with: 112 signal: BULLISH | BEARISH | NEUTRAL 113 confidence: 0.0-1.0 114 summary: one sentence on the dominant driver 115 key_factors: 3-5 short bullet strings (each grounded in one of the data sources) 116 117 - name: synthesis 118 pattern: sequential 119 transition: END 120 agents: 121 - name: synthesis_agent 122 role: synthesis 123 llm_tier: deep 124 max_react_steps: 1 125 system_prompt: | 126 Synthesise the analyst's signal into a final verdict. 127 Vocabulary: BUY | HOLD | SELL. 128 129 Rules of thumb: 130 • HOLD when the live feed is stale or data sources are mostly empty. 131 • HOLD when the analyst's confidence is below 0.55. 132 • Otherwise propagate the analyst's direction with a slightly damped confidence.