checking system…
Docs / back / config/arenas/market_pulse.yaml · line 1
YAML · 236 lines
  1name: market_pulse
  2description: |
  3  1-minute market-pulse arena. Pulls live OHLC + indicators + news from
  4  trtools2 streams, fans the question across three specialists (price action,
  5  news, volatility regime), synthesises a verdict, and — crucially — a
  6  ReplanAgent decides whether confidence is high enough to commit, or
  7  whether to enable additional sources (macro context, knowledge graph, deep
  8  data request to fomo2) and re-run. The committed verdict is published as
  9  a structured TradingAction on ``maf:actions:out``; trtools2 picks it up and
 10  executes / queues / logs per the action's ``mode`` field.
 11
 12  Trigger via control plane:
 13    XADD maf:control:in '*' data '{
 14      "command": "run_arena",
 15      "args": {
 16        "arena": "market_pulse",
 17        "target": {"ticker": "SPY", "context_tickers": ["VIX"]},
 18        "action_mode": "semi"
 19      }
 20    }'
 21
 22schedule: null
 23output_stream: "maf:arena:market_pulse:output"
 24max_iterations: 3  # ReplanAgent may loop back to analysis up to twice
 25selected_analysts: null
 26
 27# ─────────────────────────────────────────────────────────────────────────
 28# Triggers — declarative reactivity over Redis Streams. The dispatcher
 29# evaluates ``when`` per event, applies a per-(arena, target) cooldown,
 30# and XADDs to ``maf:control:in`` so the existing control plane runs the
 31# arena. Cold symbols cost nothing.
 32# ─────────────────────────────────────────────────────────────────────────
 33triggers:
 34  - name: "kronos prob_up shift"
 35    on_stream: "kronos:forecasts:emitted"
 36    when: "abs(payload.prob_up_delta) > 0.15 or payload.direction_flipped"
 37    target:
 38      ticker: "{payload.symbol}"
 39    cooldown_s: 60
 40    action_mode: semi
 41
 42  - name: "trtools2 strategy fired"
 43    on_stream: "trtools2:strategy:events"
 44    when: "payload.action == 'BUY' or payload.action == 'SELL'"
 45    target:
 46      ticker: "{payload.symbol}"
 47    cooldown_s: 300
 48    action_mode: semi
 49
 50llm:
 51  default_provider: ollama
 52  quick_provider: ollama
 53  quick_model: "auto"   # picker → gpt-oss:20b-cloud per specialist
 54  deep_provider: ollama
 55  deep_model: "auto"    # picker → gpt-oss:120b-cloud for synthesis / replan
 56  providers:
 57    ollama:
 58      api_key: "${OLLAMA_API_KEY}"
 59      model: "auto"
 60      base_url: "https://ollama.com/v1"
 61      max_output_tokens: 4096
 62      temperature: 0.2
 63
 64# ─────────────────────────────────────────────────────────────────────────
 65# Sources — primary set (always active) + replan pool (enabled on demand)
 66#
 67# The primary set is what runs on iteration 0. ReplanAgent can enable any of
 68# the replan-pool names below by writing them into state["replan_enabled_sources"].
 69# Specialists in the next iteration read both pools through their ``sources:``
 70# list and the registry — no rebinding required because all are declared
 71# up front.
 72# ─────────────────────────────────────────────────────────────────────────
 73sources:
 74  # ── primary (always consulted) ─────────────────────────────────────────
 75  - name: bars_1m_target
 76    adapter: trtools2_bars
 77    config:
 78      stream: "trtools2:bars:1m"
 79      timeframe: "1m"
 80      count: 60        # last hour of 1m bars
 81
 82  - name: bars_1m_vix
 83    adapter: trtools2_bars
 84    config:
 85      stream: "trtools2:bars:1m"
 86      timeframe: "1m"
 87      symbol: "VIX"
 88      count: 60
 89
 90  - name: indicators_target
 91    adapter: trtools2_indicators
 92    config:
 93      stream: "trtools2:indicators"
 94      count: 30
 95
 96  - name: news_recent
 97    adapter: trtools2_news
 98    config:
 99      stream: "trtools2:news"
100      count: 30
101
102  - name: strategy_events
103    adapter: trtools2_strategy_events
104    config:
105      stream: "trtools2:strategy:events"
106      count: 20
107
108  - name: kronos_forecast_1m
109    adapter: kronos_forecast
110    config:
111      timeframe: "1m"
112      include_forecast: false   # summary only — keeps prompt small
113
114  # ── replan pool (enabled by ReplanAgent on confidence-low iterations) ──
115  - name: fomo2_deep_news
116    adapter: fomo2_request
117    config:
118      request: "fetch_news"
119      wait: true
120      wait_seconds: 15
121      count: 30
122      days_back: 2
123
124  - name: fomo2_knowledge
125    adapter: fomo2_knowledge
126    config:
127      max_results: 10
128      days_back: 30
129      chromadb_path: "./data/chromadb"
130
131  - name: macro_context
132    adapter: fred_api
133    config:
134      query_type: macro
135      api_key: "${FRED_API_KEY}"
136
137  - name: enriched_items
138    adapter: fomo2_items
139    config:
140      count: 30
141
142memory:
143  instances:
144    - { name: synthesis_bm25, type: bm25 }
145
146# ─────────────────────────────────────────────────────────────────────────
147# Phases:
148#   analysis     (parallel)   → 3 specialists
149#   synthesis    (sequential) → confidence-weighted ensemble
150#   replan_check (sequential) → ReplanAgent; loops back to analysis if needed
151#   emit         (sequential) → terminal phase (action publish happens in
152#                                the post-run hook on MAFApp)
153# ─────────────────────────────────────────────────────────────────────────
154phases:
155  - name: analysis
156    pattern: parallel
157    agents:
158      - name: price_analyst
159        role: specialist
160        system_prompt_file: src/maf/arenas/trading_intelligence/prompts/price_analyst.txt
161        sources:
162          - bars_1m_target
163          - indicators_target
164          - strategy_events
165        llm_tier: quick
166        max_react_steps: 5
167
168      - name: news_analyst
169        role: specialist
170        system_prompt_file: src/maf/arenas/trading_intelligence/prompts/news_analyst.txt
171        sources:
172          - news_recent
173          # Additional sources (fomo2_deep_news, enriched_items) are
174          # only exposed when ReplanAgent enables them — SpecialistAgent
175          # reads state["replan_enabled_sources"] at tool-build time.
176        llm_tier: quick
177        max_react_steps: 5
178
179      - name: vol_regime_analyst
180        role: specialist
181        system_prompt_file: src/maf/arenas/trading_intelligence/prompts/vol_regime_analyst.txt
182        sources:
183          - bars_1m_vix
184          - indicators_target
185          # macro_context is replan-only: enabled when VIX data is sparse
186          # and the agent reports low confidence on the regime call.
187        llm_tier: quick
188        max_react_steps: 5
189
190      - name: kronos_specialist
191        role: specialist
192        system_prompt_file: src/maf/arenas/trading_intelligence/prompts/kronos_specialist.txt
193        sources:
194          - kronos_forecast_1m
195        llm_tier: quick
196        max_react_steps: 2     # single tool call → JSON; no exploration
197    transition: synthesis
198
199  - name: synthesis
200    pattern: sequential
201    signal_extract: false
202    agents:
203      - name: synthesis_agent
204        role: synthesis
205        system_prompt_file: src/maf/arenas/trading_intelligence/prompts/synthesis_agent.txt
206        memory: synthesis_bm25
207        llm_tier: deep
208    transition: replan_check
209
210  - name: replan_check
211    pattern: sequential
212    agents:
213      - name: replan_controller
214        role: replan
215        llm_tier: deep   # high-stakes JSON output — picker → 120b model
216        extra:
217          # Confidence floor for committing the verdict. Below this, the
218          # replan controller asks "is the gap missing data, or genuine
219          # disagreement?" via an LLM call and either loops back with
220          # additional sources or commits anyway. 0.70 keeps the demo's
221          # AMBIGUOUS path (missing VIX) inside the replan branch.
222          confidence_floor: 0.70
223          loopback_phase: "analysis"
224          available_sources:
225            - fomo2_deep_news
226            - fomo2_knowledge
227            - macro_context
228            - enriched_items
229            - kronos_forecast_1m   # if the cached forecast is stale → replan
230    transition: emit
231
232  - name: emit
233    pattern: sequential
234    agents: []
235    transition: END