Skip to content

feat(market-data): OANDA v20 realtime FX data provider (EUR_GBP etc.) - #1146

Open
bishallllllll wants to merge 1 commit into
TraderAlice:devfrom
bishallllllll:feat/oanda-v20-provider
Open

feat(market-data): OANDA v20 realtime FX data provider (EUR_GBP etc.)#1146
bishallllllll wants to merge 1 commit into
TraderAlice:devfrom
bishallllllll:feat/oanda-v20-provider

Conversation

@bishallllllll

@bishallllllll bishallllllll commented Aug 21, 2026

Copy link
Copy Markdown

OANDA v20 data provider — realtime FX candles (EUR_GBP etc.)

Data-only market-data provider in the embedded opentypebb provider 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 + CurrencyPairs fetchers on top of the reusable utils/helpers.ts (account resolution, granularity mapping incl. documented approximations, candle normalization); registered in app-loader.ts + package exports
  • bar-service.tsoanda: 'realtime' capability (only realtime vendor in the pool)
  • config.ts / credential-map.tsproviderKeys.oanda + oanda_api_key mapping
  • aggregate-search.ts + main.ts — currency search fans out over enabled currency vendors; sourceId: vendor per row; yfinance-only endsWith('USD') fuzzy-noise filter stays yfinance-scoped so OANDA rows (EUR_GBP) pass through
  • MarketDataPage — OANDA chart-vendor row + key entry (with spec coverage); TEST_ENDPOINTS entry so the UI Test button works

Verification (all run locally)

  • pnpm -F @traderalice/opentypebb typecheck, root npx tsc --noEmit, cd ui && npx tsc -b — clean
  • Vitest: bar-service 25, credential-map 11, twse 10, yfinance 9, providers 6, vendors 5, MarketDataPage 3, aggregate-search 1, crypto-historical 4 — 74 passed / 0 failed (6 live-only skipped)
  • Live acceptance (practice token, runtime CLI gateway):
    • market vendorsoanda, keyless=false
    • search-bars --query EURGBPoanda|EUR_GBP · currency · realtime (top candidate)
    • quant s = bars("oanda|EUR_GBP","1d",count=30,asset="currency") → 30 real bars, close 0.8574, barCapability: realtime
    • snapshot --query EURGBPautoPickedSource: oanda|EUR_GBP (realtime)
  • No secrets in the diff; the practice token lives outside the repo in the user's market-data.json

Notes for reviewers

  • vendorMeta opt-in → shows in alice market vendors; enabling persists to extraVendors and is live on the next search (config re-read per request)
  • Freshness is honest: OANDA D bars anchor 21:00 UTC, so day-anchored reads may report 1 stale trading day
  • ui/src/demo handlers intentionally untouched (out of scope); demo-mode Test key for oanda would 400 until demo surface is updated

Suggested labels (fork author cannot apply): area:market-data, area:settings, review:deep (persisted config + credential surface), theme:safety

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.
Copilot AI lite review requested due to automatic review settings August 21, 2026 10:01
@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

@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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/opentypebb OANDA provider with CurrencyPairs (instrument roster search) and CurrencyHistorical (candles) fetchers plus shared request/helpers.
  • Extends market-data search to fan out currency search across enabled vendors (so OANDA results keep a sourceId and 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.

Comment on lines +115 to +117
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)}`
Comment on lines +55 to +58
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)

Comment on lines 48 to +51
/** 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). */
@bishallllllll

Copy link
Copy Markdown
Author

@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.

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