Skip to content

feat: add brapi.dev vendor for B3 stock data and fundamentals - #1366

Closed
jccl2 wants to merge 3 commits into
TauricResearch:mainfrom
jccl2:feat/brapi-b3-vendor
Closed

jccl2 wants to merge 3 commits into
TauricResearch:mainfrom
jccl2:feat/brapi-b3-vendor

Conversation

@jccl2

@jccl2 jccl2 commented Sep 18, 2026 •

Copy link
Copy Markdown

Description:

Summary

  • Adds the "brapi" vendor (brapi.dev) for OHLCV prices and fundamentals of B3 tickers (e.g., PETR4.SA), alongside yfinance and alpha_vantage.
  • Registers the vendor in VENDOR_LIST and VENDOR_METHODS (get_stock_data, get_fundamentals), adds .SA -> ^BVSP to benchmark_map, and BRAPI_TOKEN to .env.example.
  • Fixes validated against the real API: debtToEquity comes from financialData; the range bucket is chosen by the age from start_date to today, not by the start/end span.

Known limitations

  • get_verified_market_snapshot and get_indicators read yfinance directly (load_ohlcv) and do not go through the vendor router; brapi only powers get_stock_data and get_fundamentals.
  • yfinance OHLC comes adjusted for dividends; brapi comes raw (only Adj Close is adjusted).
  • dividendsData is fetched but not yet used in the fundamentals output.

Test plan

  • py_compile and import smoke (brapi in VENDOR_LIST / VENDOR_METHODS)
  • 130 config/vendor/fundamentals tests
  • get_stock_data and get_fundamentals against the real API (PETR4.SA)
  • Complete TradingAgentsGraph with PETR4.SA on 2026-08-15 (Hold decision)

jccl2 and others added 3 commits September 18, 2026 12:08
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Add market_vendor_affinity config (brapi -> ".SA") and filter the vendor
chain in route_to_vendor by the ticker's suffix, so "brapi,yfinance" skips
brapi for non-B3 tickers without per-run configuration. If filtering would
empty the chain, the configured chain is kept unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Yijia-Xiao added a commit that referenced this pull request Sep 23, 2026
@Yijia-Xiao

Copy link
Copy Markdown
Member

Thanks @jccl2. The benchmark mapping is in 5c2dded: B3 tickers now measure alpha against the Ibovespa. We are not adding the vendor: yfinance already serves B3 prices and statements without a token.

@Yijia-Xiao Yijia-Xiao closed this Sep 23, 2026
@Yijia-Xiao Yijia-Xiao mentioned this pull request Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants