# ADR-001: Stack and OANDA-first broker adapter

**Status:** Accepted  
**Date:** 2026-10-02  
**Version:** 0.1.0

## Context

TradingBite Platform needs a chart-first MVP with legally permitted FX data at $0 recurring cost. Multiple brokers may be supported later; the chart must not depend on one vendor’s SDK shape.

## Decision

1. **Frontend / API host:** Next.js (App Router) + TypeScript (Phase C).
2. **Package manager:** npm (aligned with Node v22 on dev machine).
3. **Chart library:** TradingView Lightweight Charts — MIT license (re-verify license file at install time in Phase D).
4. **Initial data provider:** OANDA v20 REST API with **practice (demo)** account.
5. **Later provider:** FXCM via separate adapter (Phase J); no FXCM in Phase C.
6. **Python:** Deferred until backtest/ingest complexity justifies it (Phase H/E evaluation).
7. **Database:** Deferred to Phase E; SQLite for local warehouse first option.
8. **No Redis/Kafka/K8s** at initialization.

## Consequences

- Phase C proves `OandaAdapter → NormalizedCandle → API route → (later) chart`.
- FXCM users wait until adapter interface is stable.
- Pine indicators remain in `../TradingBite/`; ports live in this repo under `packages/indicators` (Phase F).

## Alternatives considered

| Alternative | Rejected because |
|-------------|------------------|
| Pine runtime in browser | Legal/technical uncertainty; maintenance burden |
| Direct broker calls from browser | Exposes secrets; violates security rules |
| Paid market data API | Violates $0 recurring rule |
| Vite SPA only | Next.js gives server routes for secrets without separate API deploy in MVP |

## Compliance notes

- User must accept OANDA API terms; app stores tokens server-side only.
- Application is a tool; not investment advice.
