Add real market-data vendors behind a multi-vendor provider chain#15
Merged
Conversation
Replace the HTTP provider stub with a pluggable vendor architecture for the finance planner: - Vendor registry with two real adapters: FMP (quotes, latest-only fundamentals, EOD bars; requires DDE_MARKETDATA_API_KEY) and keyless Stooq (EOD bars via CSV). alphavantage/tiingo stay as selectable placeholders, so existing configs keep working. - Ordered fallback chain (DDE_MARKETDATA_VENDOR=fmp,stooq): capability gaps, missing tickers, rate limits and outages fall through to the next vendor; the composed name lands in provenance. - TTL cache as the outermost layer. Bar ranges are fetched at day granularity and split at the start of yesterday: older bars are immutable and cached without expiry, only the recent stub refreshes on TTL, so a year-long window refetches two days instead of a year. A TTL of 0 disables the respective cache. - Per-vendor rate limiting (min interval + daily budget). Budget is only spent on requests actually sent: hopeless waits fail fast and cancelled waits are refunded. - Point-in-time honesty: past-asOf quotes are derived from daily bars, never the live endpoint; free-tier fundamentals are tagged latest_only and refused for past asOf instead of faking history. Backtests stay on offline fixtures. - Secrets: vendor errors carry path + status only, never the API key. Vendors that need a key fail at startup with a clear message rather than degrading silently. A shared conformance suite runs the point-in-time contract against every provider implementation, including the chain and the cache.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the
marketdata.HTTPProviderstub with a production multi-vendor architecture for the finance planner.What's in here
DDE_MARKETDATA_API_KEY) and keyless Stooq (EOD bars via CSV).alphavantage/tiingoremain selectable placeholders, so existing configs keep today's behavior. Adding a vendor is one adapter file plus one registry line.DDE_MARKETDATA_VENDOR=fmp,stooqis tried in order per read; capability gaps, missing tickers, rate limits and outages fall through. The composed name (fmp+stooq) flows into provenance.PlanCacheTTLconvention.latest_onlyand refused for past asOf. Backtests stay on offline fixtures.Notes
ErrUnavailable) rather than attempting to bypass it.Testing
-race; golangci-lint clean.DDE_MARKETDATA_LIVE_TEST=1).