1name: trading_intelligence 2description: "MarketMind — 5-agent parallel analysis with confidence-weighted synthesis. Covers stocks and crypto." 3schedule: "1h" 4output_stream: "maf:arena:trading_intelligence:output" 5selected_analysts: null # null = all; or ["price_analyst", "macro_analyst"] 6 7# Trigger rules — fire when a fresh crowd-sim lands or kronos flips direction 8# on the 1h horizon. Long cooldown (5 min) reflects the heavier per-run cost 9# of TI vs market_pulse. 10triggers: 11 - name: "fresh crowd-sim landed" 12 on_stream: "mirofish:sims:emitted" 13 # tickers is a list; check non-empty via "in" against an empty list literal. 14 when: "payload.tickers != [] and payload.tickers != None" 15 target: 16 ticker: "{payload.tickers[0]}" 17 cooldown_s: 300 18 action_mode: manual 19 20 - name: "kronos 1h direction flip" 21 on_stream: "kronos:forecasts:emitted" 22 when: "payload.timeframe == '1h' and payload.direction_flipped" 23 target: 24 ticker: "{payload.symbol}" 25 cooldown_s: 600 26 action_mode: manual 27 28llm: 29 default_provider: ollama 30 quick_provider: ollama 31 quick_model: "auto" # picker → gpt-oss:20b-cloud per-specialist 32 deep_provider: ollama 33 deep_model: "auto" # picker → gpt-oss:120b-cloud for synthesis 34 providers: 35 ollama: 36 api_key: "${OLLAMA_API_KEY}" 37 model: "auto" 38 base_url: "https://ollama.com/v1" 39 max_output_tokens: 8192 40 temperature: 0.3 41 42# ───────────────────────────────────────────────────────────────────────────── 43# Data Sources 44# 45# ALL source calls are automatically monitored (timing, success/failure, bytes). 46# Source metrics appear in the trail under state["source_metrics"]. 47# 48# Module: fomo2 — pre-analyzed intelligence (news, sentiment, knowledge, NLP) 49# Module: trtools2 — market bars, quotes, technical indicators 50# Module: web — Yahoo Finance, FRED, CoinGecko, NewsAPI, SEC, web search 51# ───────────────────────────────────────────────────────────────────────────── 52 53sources: 54 # ── Macro / External ───────────────────────────────────────────────────── 55 - name: fred_macro 56 adapter: fred_api 57 config: 58 query_type: macro 59 api_key: "${FRED_API_KEY}" 60 61 - name: fred_fear_greed 62 adapter: fred_api 63 config: 64 query_type: fear_greed 65 66 - name: coingecko_market 67 adapter: coingecko 68 config: 69 query_type: market 70 vs_currency: usd 71 72 - name: coingecko_global 73 adapter: coingecko 74 config: 75 query_type: global 76 77 - name: newsapi_headlines 78 adapter: newsapi 79 config: 80 days_back: 3 81 count: 10 82 api_key: "${NEWS_API_KEY}" 83 84 # ── Yahoo Finance ───────────────────────────────────────────────────────── 85 - name: yahoo_quote 86 adapter: yahoo_finance 87 config: 88 query_type: quote 89 symbols: 90 - SPY 91 - QQQ 92 - DIA 93 - IWM 94 - AAPL 95 - MSFT 96 - GOOGL 97 - AMZN 98 - NVDA 99 - META 100 - TSLA 101 102 - name: yahoo_news 103 adapter: yahoo_finance 104 config: 105 query_type: news 106 news_count: 15 107 symbols: 108 - SPY 109 - QQQ 110 - AAPL 111 - NVDA 112 - TSLA 113 114 - name: market_overview 115 adapter: yahoo_finance 116 config: 117 query_type: overview 118 news_count: 20 119 120 # ── Fomo2 Module ────────────────────────────────────────────────────────── 121 - name: investing_analysis 122 adapter: fomo2_analysis 123 config: 124 goal: investing_ideas 125 count: 5 126 127 - name: news_digest 128 adapter: fomo2_analysis 129 config: 130 goal: news_digest 131 count: 5 132 133 - name: news_items 134 adapter: fomo2_items 135 config: 136 count: 30 137 138 - name: social_sentiment 139 adapter: fomo2_stream 140 config: 141 stream: "fomo2:enriched" 142 count: 30 143 144 - name: knowledge_base 145 adapter: fomo2_knowledge 146 config: 147 max_results: 10 148 days_back: 60 149 chromadb_path: "./data/chromadb" 150 151 - name: nlp_enrichment 152 adapter: fomo2_enrichment 153 154 # ── Trtools2 Module ─────────────────────────────────────────────────────── 155 - name: market_bars 156 adapter: questdb 157 config: 158 query_type: bars 159 timeframe: "1d" 160 161 - name: market_quotes 162 adapter: questdb 163 config: 164 query_type: quotes 165 166 - name: fundamentals_data 167 adapter: questdb 168 config: 169 query_type: fundamentals 170 statement_type: income 171 172 - name: indicators 173 adapter: technical 174 config: 175 default_timeframe: "1d" 176 177 - name: live_bars 178 adapter: trtools2_live 179 config: 180 timeframe: "1m" 181 182 - name: strategy_signals 183 adapter: trtools2_signals 184 config: 185 count: 20 186 187 # ── Web / Research ──────────────────────────────────────────────────────── 188 - name: web_search 189 adapter: web_search 190 config: 191 num_results: 10 192 193 - name: insider_transactions 194 adapter: sec_filings 195 config: 196 days_back: 90 197 198 # ── TradingAgents Committee ────────────────────────────────────────────── 199 # Per-ticker BUY/OVERWEIGHT/HOLD/UNDERWEIGHT/SELL verdict from the upstream 200 # TradingAgents committee (4 analysts → bull/bear debate → trader → 3-style 201 # risk debate → portfolio manager). Runs in an isolated subprocess so 202 # LangGraph stays out of MAF's import graph. 203 # 204 # Available to MarketMind specialists (or a future committee_analyst agent) 205 # as one more opinion. Returns a typed payload — see 206 # maf.sources.adapters.tradingagents for the full shape. 207 # ── Kronos foundation-model forecast (cached, written by sidecar) ──────── 208 - name: kronos_forecast_1h 209 adapter: kronos_forecast 210 config: 211 timeframe: "1h" 212 include_forecast: false 213 214 # ── MiroFish synthetic-crowd simulation (cached, written by refresher) ─── 215 - name: crowd_sim 216 adapter: mirofish_sim 217 config: 218 stale_after_seconds: 21600 # 6 h 219 220 - name: committee 221 adapter: tradingagents 222 config: 223 # TradingAgents → use Ollama Cloud via OpenAI-compatible shim so MAF's 224 # LLM budget is single-provider. ``llm_provider: openai`` causes the 225 # subprocess to wire its langchain LLMs through the openai client with 226 # our base_url / api_key. Hard-pin specific models here because the 227 # subprocess doesn't share MAF's smart-picker. 228 llm_provider: openai 229 backend_url: "https://ollama.com/v1" 230 deep_think_llm: "gpt-oss:120b-cloud" 231 quick_think_llm: "gpt-oss:20b-cloud" 232 api_key_env: "OLLAMA_API_KEY" 233 selected_analysts: ["market", "news", "fundamentals"] 234 max_debate_rounds: 1 235 max_risk_discuss_rounds: 1 236 timeout_seconds: 600 237 238memory: 239 instances: 240 - { name: synthesis_bm25, type: bm25 } 241 242# ───────────────────────────────────────────────────────────────────────────── 243# Phase 1: 5 parallel specialist analysts 244# 245# Each fires simultaneously (fan-out). Each produces: 246# - AgentSignal (BULLISH/BEARISH/NEUTRAL + confidence + key_factors) 247# - Full narrative report (stored in state["reports"]) 248# - Source metrics (logged automatically) 249# 250# Message isolation: each agent sees only its own system prompt + data. 251# ───────────────────────────────────────────────────────────────────────────── 252phases: 253 - name: analysis 254 pattern: parallel 255 agents: 256 - name: price_analyst 257 role: specialist 258 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/price_analyst.txt 259 sources: 260 - yahoo_quote # real-time quote + fundamentals 261 - market_overview # index snapshot + VIX 262 - market_bars # historical OHLCV (trtools2) 263 - indicators # pre-computed RSI/MACD/Bollinger (trtools2) 264 - live_bars # intraday context 265 - strategy_signals # existing pipeline signals 266 llm_tier: quick 267 max_react_steps: 4 268 269 - name: sentiment_analyst 270 role: specialist 271 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/sentiment_analyst.txt 272 sources: 273 - newsapi_headlines # fresh headlines (NewsAPI) 274 - yahoo_news # Yahoo Finance headlines 275 - news_digest # fomo2 pre-built digest 276 - news_items # fomo2 raw enriched news 277 - social_sentiment # fomo2 social stream 278 - nlp_enrichment # on-demand NLP scoring 279 - knowledge_base # RAG historical context 280 llm_tier: quick 281 max_react_steps: 3 282 283 - name: onchain_analyst 284 role: specialist 285 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/onchain_analyst.txt 286 sources: 287 - coingecko_market # crypto: price, volume, market cap, ATH 288 - coingecko_global # crypto: BTC dominance, total market cap 289 - yahoo_quote # stocks: microstructure (volume ratio, beta, short) 290 - market_bars # volume context 291 - social_sentiment # attention/volume signals from social 292 llm_tier: quick 293 max_react_steps: 3 294 295 - name: macro_analyst 296 role: specialist 297 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/macro_analyst.txt 298 sources: 299 - fred_macro # DXY, fed funds rate, yield curve 300 - fred_fear_greed # Crypto Fear & Greed index 301 - market_overview # major indices snapshot + news 302 - news_digest # macro-relevant news via fomo2 303 - investing_analysis # fomo2 macro investment theses 304 llm_tier: quick 305 max_react_steps: 3 306 307 - name: risk_analyst 308 role: specialist 309 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/risk_analyst.txt 310 sources: 311 - yahoo_quote # current price, 52w range, volume 312 - market_bars # historical OHLCV for volatility/drawdown 313 - market_overview # VIX level 314 - indicators # pre-computed volatility indicators 315 - insider_transactions # SEC Form 4 insider activity 316 llm_tier: quick 317 max_react_steps: 3 318 319 # 6th specialist — translates the TradingAgents committee verdict 320 # (BUY/OVERWEIGHT/HOLD/UNDERWEIGHT/SELL) into an AgentSignal so the 321 # synthesis agent can weigh it alongside the 5 native MAF specialists. 322 # The committee runs a 20-40 LLM-call pipeline in an isolated subprocess 323 # (langgraph + langchain), so we cap react steps at 2: the agent fetches 324 # once and translates. The synthesis weight defaults to 0.20 (unknown 325 # domain in BASE_WEIGHTS — see maf/agents/synthesis.py). 326 - name: committee_analyst 327 role: specialist 328 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/committee_analyst.txt 329 sources: 330 - committee # TradingAgents sidecar (per-ticker verdict) 331 llm_tier: quick 332 max_react_steps: 2 333 334 # 7th specialist — translates the Kronos foundation-model 1h forecast 335 # (cached by the kronos-svc sidecar via maf.scheduler.kronos_refresher) 336 # into an AgentSignal so synthesis can weigh the TSFM prior alongside 337 # the LLM specialists. Single tool call, no exploration. 338 - name: kronos_specialist 339 role: specialist 340 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/kronos_specialist.txt 341 sources: 342 - kronos_forecast_1h 343 llm_tier: quick 344 max_react_steps: 2 345 346 # 8th specialist — translates the MiroFish synthetic-crowd consensus 347 # (cached by the mirofish-refresher worker after a high-impact 348 # fomo2 report lands) into an AgentSignal. Reads only the cache, so 349 # cold path costs nothing. 350 - name: crowd_proxy 351 role: specialist 352 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/crowd_proxy.txt 353 sources: 354 - crowd_sim 355 llm_tier: quick 356 max_react_steps: 2 357 transition: synthesis 358 359 # ───────────────────────────────────────────────────────────────────────── 360 # Phase 2: Synthesis 361 # 362 # The SynthesisAgent reads all 5 AgentSignals, computes the 363 # confidence-weighted ensemble score, and makes one LLM call 364 # for the final BUY / HOLD / SELL + reasoning. 365 # 366 # Full evidence chain stored in state["decisions"]["synthesis"] for 367 # complete reviewability in the trail dashboard. 368 # ───────────────────────────────────────────────────────────────────────── 369 - name: synthesis 370 pattern: sequential 371 signal_extract: false # synthesis agent writes signal directly 372 agents: 373 - name: synthesis_agent 374 role: synthesis 375 system_prompt_file: src/maf/arenas/trading_intelligence/prompts/synthesis_agent.txt 376 memory: synthesis_bm25 377 llm_tier: deep 378 transition: END