Claude/analyze us exchange g6 b kg#8
Conversation
Adds a new `yahoo` exchange providing free US-market data (OHLCV + tickers) via Yahoo Finance's public v8 chart and v7 quote endpoints. Hand-rolled (no extra dependency) so requests use banexg's existing HTTP plumbing — proxy, retries, caching, debug, rate limit — instead of the global state used by piquette/finance-go. Scope: read-only. FetchOHLCV (1m/5m/15m/30m/1h/1d/1wk/1mo etc.), FetchTicker(s)/FetchTickerPrice, lazy LoadMarkets/MapMarket. Trading methods inherit base NotImplement stubs.
Adds the missing 4h timeframe by fetching 1h from Yahoo and bucketing into 4h windows aligned to UTC. Also accepts the uppercase aliases 1H/1D/1W/1M that users commonly pass through from UI layers. Adds an offline aggregator unit test and a parameterised AAPL live test (TestFetchOHLCV_AAPL_AllTimeframes) covering 1m/5m/1h/4h/1D/1W/1M; gated by BANEXG_YAHOO_LIVE=1 so it skips in offline CI.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR adds a complete Yahoo Finance exchange client to banexg, enabling OHLCV candle and ticker quote fetching. The implementation includes lazy market loading, timeframe validation, JSON parsing, 4-hour interval aggregation, and parametrized range selection, with comprehensive unit and integration tests. ChangesYahoo Finance Exchange Client
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@yahoo/biz.go`:
- Around line 64-66: The current direct assertion v.([]string) for
params[banexg.ParamSymbols] is too strict and drops valid inputs; update the
decoding in both places where you read params[banexg.ParamSymbols] to handle
three cases: if v is []string use it directly, if v is []interface{} iterate and
convert each element to string (using fmt.Sprint or type switches) to build
symbols []string, and if v is a string treat it as a comma-separated list and
split into []string (trimming whitespace). Ensure the result is assigned to the
existing symbols variable and handle nil/empty inputs gracefully.
In `@yahoo/entry.go`:
- Around line 9-14: The constructor New currently mutates the caller-provided
Options map; instead, create a local copy and mutate that: in New, allocate a
new map (e.g., opts := make(map[string]interface{}, len(Options)+1)), if Options
!= nil copy each key/value from Options into opts, otherwise start with an empty
map, then set the default value for banexg.OptUserAgent to defaultUserAgent on
opts if missing, and use opts for subsequent operations so the original Options
argument is not modified.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: fa29b3c5-942e-44d8-9e37-3fdf016e1470
📒 Files selected for processing (8)
bex/entrys.goyahoo/biz.goyahoo/biz_test.goyahoo/common.goyahoo/common_test.goyahoo/data.goyahoo/entry.goyahoo/types.go
* coerceSymbols(): accept []string, []interface{}, and comma-separated
strings for the ParamSymbols param. Direct v.([]string) was silently
dropping JSON-decoded payloads and human-typed config strings.
Used in LoadMarkets and FetchTickerPrice.
* New(): copy the caller's Options map via utils.SafeParams before
injecting the default User-Agent, so callers sharing one Options map
across multiple exchanges aren't affected.
Adds TestCoerceSymbols (9 subcases) and TestNew_DoesNotMutateOptions
as regression guards.
An assessment of how yahoo works to download data from the USA using OHLCV.
Summary by CodeRabbit