feat(market-data): OANDA v20 realtime FX data provider (EUR_GBP etc.) - #1146
feat(market-data): OANDA v20 realtime FX data provider (EUR_GBP etc.)#1146bishallllllll wants to merge 1 commit into
Conversation
Data-only provider in the opentypebb stack: CurrencyHistorical candles and CurrencyPairs instrument search via the practice host. Registered in the provider registry, realtime capability in bar-service, providerKeys + credential mapping, currency search fan-out (yfinance keeps its XXXUSD filter), UI vendor card + key row + test endpoint.
|
@bishallllllll is attempting to deploy a commit to the luokerenx4's Team Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Adds an embedded OpenTypeBB OANDA v20 provider and wires it through OpenAlice’s market-data search, bar capability labeling, config/credentials surfaces, and UI settings so FX pairs like EUR_GBP can be discovered and fetched as realtime vendor candles.
Changes:
- Introduces
packages/opentypebbOANDA provider withCurrencyPairs(instrument roster search) andCurrencyHistorical(candles) fetchers plus shared request/helpers. - Extends market-data search to fan out currency search across enabled vendors (so OANDA results keep a
sourceIdand route back to OANDA for bars). - Adds OANDA key + vendor entries to the settings UI and config/test-provider plumbing (schema, credential map, test endpoints, and bar capability metadata).
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/pages/MarketDataPage.tsx | Adds OANDA to chart vendors and provider key entry list. |
| ui/src/pages/MarketDataPage.spec.tsx | Extends UI credential-field/name coverage to include OANDA. |
| src/webui/routes/config.ts | Adds an OANDA entry to the provider test endpoints map. |
| src/main.ts | Adds live currencyVendors resolution into marketSearch deps. |
| src/domain/market-data/credential-map.ts | Maps providerKeys.oanda to SDK credential field oanda_api_key. |
| src/domain/market-data/bars/bar-service.ts | Declares OANDA vendor bar capability as realtime. |
| src/domain/market-data/aggregate-search.ts | Fans out currency search over multiple vendors and preserves sourceId per result. |
| src/core/config.ts | Adds marketData.providerKeys.oanda to persisted config schema. |
| packages/opentypebb/src/providers/oanda/utils/helpers.ts | Implements OANDA request plumbing (token/account/instruments/candles, normalization). |
| packages/opentypebb/src/providers/oanda/models/currency-search.ts | Implements CurrencyPairs via /instruments roster filtering. |
| packages/opentypebb/src/providers/oanda/models/currency-historical.ts | Implements CurrencyHistorical candles fetch and normalization. |
| packages/opentypebb/src/providers/oanda/index.ts | Registers provider metadata, credentials, and fetcher dictionary. |
| packages/opentypebb/src/index.ts | Exports oandaProvider. |
| packages/opentypebb/src/core/api/app-loader.ts | Registers oandaProvider in the embedded provider registry. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const url = | ||
| `${OANDA_BASE_URL}/v3/accounts/${account.id}/instruments/${encodeURIComponent(instrument)}/candles` + | ||
| `?granularity=${encodeURIComponent(granularity)}&price=M&count=${Math.min(Math.max(Math.trunc(count), 1), 5000)}` |
| const granularity = query.granularity ?? INTERVAL_GRANULARITY[query.interval] ?? 'D' | ||
| const count = estimateCandleCount(granularity, query.start_date, query.end_date) | ||
| const candles = await getOandaCandles(credentials, query.symbol, granularity, count) | ||
|
|
| /** Which vendor produced this hit — drives the barId's sourceId so getBars | ||
| * routes back to the same vendor. Absent for crypto/currency/commodity | ||
| * (they fall back to the configured per-asset provider). */ | ||
| * routes back to the same vendor. Absent for crypto/commodity and for | ||
| * currency when only the default yfinance ran (falls back to the | ||
| * configured per-asset provider). */ |
|
@copilot Fix the code for all comments in this review thread. When a review comment includes a suggested change, apply the suggestion exactly. Do not make changes beyond what is described in the linked review thread. |
OANDA v20 data provider — realtime FX candles (EUR_GBP etc.)
Data-only market-data provider in the embedded
opentypebbprovider stack. No order placement, no broker state, no UTA changes, no new dependencies. Research use (OANDA practice host):EUR_GBP,EUR_USD, … candles 1m..1M + instrument roster search. Maven is MT5-only and prohibits automation — this is fetch-only.Scope
packages/opentypebb/src/providers/oanda/— Provider (+vendorMeta,credentials: ['api_key']),CurrencyHistorical+CurrencyPairsfetchers on top of the reusableutils/helpers.ts(account resolution, granularity mapping incl. documented approximations, candle normalization); registered inapp-loader.ts+ package exportsbar-service.ts—oanda: 'realtime'capability (only realtime vendor in the pool)config.ts/credential-map.ts—providerKeys.oanda+oanda_api_keymappingaggregate-search.ts+main.ts— currency search fans out over enabled currency vendors;sourceId: vendorper row; yfinance-onlyendsWith('USD')fuzzy-noise filter stays yfinance-scoped so OANDA rows (EUR_GBP) pass throughMarketDataPage— OANDA chart-vendor row + key entry (with spec coverage);TEST_ENDPOINTSentry so the UI Test button worksVerification (all run locally)
pnpm -F @traderalice/opentypebb typecheck, rootnpx tsc --noEmit,cd ui && npx tsc -b— cleanmarket vendors→oanda,keyless=falsesearch-bars --query EURGBP→oanda|EUR_GBP· currency · realtime (top candidate)quants = bars("oanda|EUR_GBP","1d",count=30,asset="currency")→ 30 real bars, close 0.8574,barCapability: realtimesnapshot --query EURGBP→autoPickedSource: oanda|EUR_GBP (realtime)market-data.jsonNotes for reviewers
vendorMetaopt-in → shows inalice market vendors; enabling persists toextraVendorsand is live on the next search (config re-read per request)Dbars anchor 21:00 UTC, so day-anchored reads may report 1 stale trading dayui/src/demohandlers intentionally untouched (out of scope); demo-mode Test key for oanda would 400 until demo surface is updatedSuggested labels (fork author cannot apply):
area:market-data,area:settings,review:deep(persisted config + credential surface),theme:safety