Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(swarm): expose get_market_data across all market-data presets

Haozhe Wud7d1654f32a7
diff --git a/agent/src/swarm/presets/crypto_research_lab.yaml b/agent/src/swarm/presets/crypto_research_lab.yaml
index 31b38befd..f3c24d460 100644
--- a/agent/src/swarm/presets/crypto_research_lab.yaml
+++ b/agent/src/swarm/presets/crypto_research_lab.yaml
@@ -60,7 +60,7 @@ agents:
4. **Exchange Fund Flow Analysis** — Net inflow / outflow trend; stablecoin minting activity; assess whether fresh capital is entering or leaving
5. **Activity and Adoption Trends** — Recent trends in active addresses / new addresses / on-chain transaction volume; assess whether there is organic growth support
6. **On-Chain Composite Directional Signal** — Explicitly give a "{timeframe} bullish / bearish / neutral" on-chain signal with confidence level
- tools: [bash, read_file, write_file, load_skill]
+ tools: [bash, read_file, write_file, load_skill, get_market_data]
skills: [onchain-analysis, okx-market, stablecoin-flow]
max_iterations: 50
timeout_seconds: 1800
@@ -172,7 +172,7 @@ agents:
4. **Fear & Greed Index vs. Historical Comparison** — Current index value, historical zone positioning, price performance statistics following similar past sentiment readings
5. **Extreme Sentiment Warning** — Whether extreme greed or extreme fear signals are present; historical average returns following similar signals
6. **Sentiment Directional Signal** — Provide {timeframe} timing guidance from a sentiment perspective; explicitly state whether the view is "momentum-following" or "contrarian"
- tools: [bash, read_file, write_file, load_skill, read_url]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, read_url]
skills: [sentiment-analysis, okx-market, perp-funding-basis, liquidation-heatmap]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/crypto_trading_desk.yaml b/agent/src/swarm/presets/crypto_trading_desk.yaml
index 6b7819587..423ef3d3a 100644
--- a/agent/src/swarm/presets/crypto_trading_desk.yaml
+++ b/agent/src/swarm/presets/crypto_trading_desk.yaml
@@ -38,7 +38,7 @@ agents:
- Long/short ratio (retail contrarian indicator)
Use load_skill for funding rate analysis patterns and OKX data interfaces.
- tools: [bash, read_file, write_file, load_skill]
+ tools: [bash, read_file, write_file, load_skill, get_market_data]
skills: [perp-funding-basis, okx-market, crypto-derivatives]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/earnings_research_desk.yaml b/agent/src/swarm/presets/earnings_research_desk.yaml
index 99613ae12..52972ec70 100644
--- a/agent/src/swarm/presets/earnings_research_desk.yaml
+++ b/agent/src/swarm/presets/earnings_research_desk.yaml
@@ -40,7 +40,7 @@ agents:
- Relative valuation: is this name cheap or expensive relative to peers?
Use load_skill for SEC filing analysis, financial statement frameworks, and yfinance data.
- tools: [bash, read_file, write_file, load_skill, read_url]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, read_url]
skills: [edgar-sec-filings, financial-statement, yfinance, fundamental-filter, valuation-model]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/etf_allocation_desk.yaml b/agent/src/swarm/presets/etf_allocation_desk.yaml
index a96c45103..1ad22777d 100644
--- a/agent/src/swarm/presets/etf_allocation_desk.yaml
+++ b/agent/src/swarm/presets/etf_allocation_desk.yaml
@@ -65,7 +65,7 @@ agents:
Use load_skill("etf-analysis") for ETF research methodology; load_skill("fund-analysis") for fund product evaluation; load_skill("tushare") for A-share ETF data.
Use the factor_analysis tool for ETF tracking error and factor exposure analysis.
- tools: [bash, read_file, write_file, load_skill, factor_analysis]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, factor_analysis]
skills: [etf-analysis, fund-analysis, tushare]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/global_allocation_committee.yaml b/agent/src/swarm/presets/global_allocation_committee.yaml
index 17288849e..b9bf7ef4a 100644
--- a/agent/src/swarm/presets/global_allocation_committee.yaml
+++ b/agent/src/swarm/presets/global_allocation_committee.yaml
@@ -23,7 +23,7 @@ agents:
Use load_skill for Tushare data patterns, Northbound flow analysis, and fundamental screening.
Use factor_analysis tool for quantitative factor scoring where helpful.
- tools: [bash, read_file, write_file, load_skill, factor_analysis]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, factor_analysis]
skills: [tushare, technical-basic, fundamental-filter, hk-connect-flow, sector-rotation, multi-factor]
max_iterations: 50
timeout_seconds: 1800
@@ -48,7 +48,7 @@ agents:
6. **Volatility** — realized vs implied, positioning extremes, liquidation risk zones
Use load_skill for OKX market data, funding rate analysis, and stablecoin flow patterns.
- tools: [bash, read_file, write_file, load_skill]
+ tools: [bash, read_file, write_file, load_skill, get_market_data]
skills: [okx-market, perp-funding-basis, stablecoin-flow, crypto-derivatives, volatility, onchain-analysis]
max_iterations: 50
timeout_seconds: 1800
@@ -73,7 +73,7 @@ agents:
6. **FX** — USD/CNY and USD/HKD impact on the portfolio; hedging considerations
Use load_skill for yfinance data, ETF flow analysis, earnings revision patterns, and cross-listing dynamics.
- tools: [bash, read_file, write_file, load_skill, read_url]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, read_url]
skills: [yfinance, us-etf-flow, earnings-revision, adr-hshare, hk-connect-flow, technical-basic]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/global_equities_desk.yaml b/agent/src/swarm/presets/global_equities_desk.yaml
index 54e44e3c8..8b5782ce8 100644
--- a/agent/src/swarm/presets/global_equities_desk.yaml
+++ b/agent/src/swarm/presets/global_equities_desk.yaml
@@ -40,7 +40,7 @@ agents:
Use load_skill for tushare data patterns, fundamental screening, and Northbound flow analysis.
Use factor_analysis tool for quantitative factor scoring.
- tools: [bash, read_file, write_file, load_skill, factor_analysis]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, factor_analysis]
skills: [tushare, fundamental-filter, hk-connect-flow, technical-basic, multi-factor, sector-rotation]
max_iterations: 50
timeout_seconds: 1800
@@ -88,7 +88,7 @@ agents:
- Cross-listing: ADR delisting risk (HFCAA status), VIE structure risk
Use load_skill for yfinance data, SEC filing analysis, earnings revision patterns, ETF flow analysis, and cross-listing dynamics.
- tools: [bash, read_file, write_file, load_skill, read_url]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, read_url]
skills: [yfinance, edgar-sec-filings, earnings-revision, us-etf-flow, adr-hshare, hk-connect-flow, technical-basic]
max_iterations: 50
timeout_seconds: 1800
@@ -126,7 +126,7 @@ agents:
- For each: ticker (BTC-USDT format), direction, timeframe, key risk
Use load_skill for OKX market data, funding rate analysis, and stablecoin flow indicators.
- tools: [bash, read_file, write_file, load_skill]
+ tools: [bash, read_file, write_file, load_skill, get_market_data]
skills: [okx-market, perp-funding-basis, stablecoin-flow, onchain-analysis, crypto-derivatives]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/macro_rates_fx_desk.yaml b/agent/src/swarm/presets/macro_rates_fx_desk.yaml
index 2b955c7e8..e46b0d087 100644
--- a/agent/src/swarm/presets/macro_rates_fx_desk.yaml
+++ b/agent/src/swarm/presets/macro_rates_fx_desk.yaml
@@ -91,7 +91,7 @@ agents:
- EM FX risk assessment: which EM currencies are vulnerable to USD strength?
Use load_skill for global macro and commodity analysis (commodity currencies).
- tools: [bash, read_file, write_file, load_skill, read_url]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, read_url]
skills: [global-macro, macro-analysis, yfinance]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/macro_strategy_forum.yaml b/agent/src/swarm/presets/macro_strategy_forum.yaml
index 7f8acc0bf..ddd8d2882 100644
--- a/agent/src/swarm/presets/macro_strategy_forum.yaml
+++ b/agent/src/swarm/presets/macro_strategy_forum.yaml
@@ -98,7 +98,7 @@ agents:
7. **Policy surprise scenarios** — Upside/downside policy shock and elasticity of {market}
Prefer fresh macro data via Tushare patterns; every judgment needs a data hook.
- tools: [bash, read_file, write_file, load_skill, read_url]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, read_url]
skills: [macro-analysis, tushare]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/quant_strategy_desk.yaml b/agent/src/swarm/presets/quant_strategy_desk.yaml
index 514580182..f9102a5d2 100644
--- a/agent/src/swarm/presets/quant_strategy_desk.yaml
+++ b/agent/src/swarm/presets/quant_strategy_desk.yaml
@@ -21,7 +21,7 @@ agents:
Use factor_analysis for factor-based screening.
Use load_skill for data access patterns.
- tools: [bash, read_file, write_file, load_skill, factor_analysis]
+ tools: [bash, read_file, write_file, load_skill, get_market_data, factor_analysis]
skills: [tushare, fundamental-filter]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/sector_rotation_team.yaml b/agent/src/swarm/presets/sector_rotation_team.yaml
index cc89d2843..9ac97a0ad 100644
--- a/agent/src/swarm/presets/sector_rotation_team.yaml
+++ b/agent/src/swarm/presets/sector_rotation_team.yaml
@@ -158,7 +158,7 @@ agents:
7. **{goal} flow support** — do {goal} sectors align with cycle & prosperity?
Prefer last 20 trading days; emphasize freshness.
- tools: [bash, read_file, write_file, load_skill]
+ tools: [bash, read_file, write_file, load_skill, get_market_data]
skills: [tushare, sentiment-analysis]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/src/swarm/presets/sentiment_intelligence_team.yaml b/agent/src/swarm/presets/sentiment_intelligence_team.yaml
index aa6c5c3f4..28991e371 100644
--- a/agent/src/swarm/presets/sentiment_intelligence_team.yaml
+++ b/agent/src/swarm/presets/sentiment_intelligence_team.yaml
@@ -87,7 +87,7 @@ agents:
6. **Reliability caveats** — lags, data limits, misread risks
Use load_skill("tushare"), load_skill("sentiment-analysis").
- tools: [bash, read_file, write_file, load_skill]
+ tools: [bash, read_file, write_file, load_skill, get_market_data]
skills: [tushare, sentiment-analysis]
max_iterations: 50
timeout_seconds: 1800
diff --git a/agent/tests/test_market_data_tool.py b/agent/tests/test_market_data_tool.py
index 448c2eca8..2da6576d3 100644
--- a/agent/tests/test_market_data_tool.py
+++ b/agent/tests/test_market_data_tool.py
@@ -6,6 +6,7 @@ import pandas as pd
from src.market_data import fetch_market_data_json
from src.swarm.models import SwarmAgentSpec
+from src.swarm.presets import list_presets, load_preset
from src.swarm.worker import build_worker_prompt
from src.tools import build_swarm_registry
@@ -47,6 +48,20 @@ def test_swarm_registry_can_expose_local_get_market_data_tool():
assert "get_market_data" in registry.tool_names
+def test_every_market_data_worker_has_get_market_data_tool():
+ """Workers with OHLCV-capable skills must expose the loader-backed tool (#198)."""
+ market_data_skills = {"tushare", "yfinance", "okx-market"}
+ missing = []
+ for summary in list_presets():
+ preset = load_preset(summary["name"])
+ for agent in preset.get("agents", []):
+ if market_data_skills & set(agent.get("skills", [])):
+ if "get_market_data" not in (agent.get("tools") or []):
+ missing.append(f"{summary['name']}:{agent['id']}")
+
+ assert not missing, f"workers with market-data skills lack get_market_data: {missing}"
+
+
def test_worker_prompt_prioritizes_get_market_data_for_ohlcv():
spec = SwarmAgentSpec(
id="analyst",