Repository navigation
Data sources: Yahoo Finance, Binance, OANDA, Alpaca, CSV files, and paper trading on live prices - #19
Merged
Merged
Conversation
…, and paper trading on live prices Prices can now come from seven sources, switched while the terminal runs (Settings → DATA SOURCES: SETTINGS / TEST / USE) or chosen at start-up with `launcher.py --provider <type>`: - Yahoo Finance (free, no account): forex; metals, energy, grain, soft and livestock futures; indices, stocks, ETFs, crypto. - Binance (free): crypto in real time. - OANDA: forex, metals, energy, grains and index CFDs, with order execution. - Alpaca: US stocks and ETFs, including commodity ETFs, and crypto. - CSV files: bars exported from MT5, TradingView, NinjaTrader…, offline. Sources that only deliver prices trade on a paper account that fills at their live bid/ask; SL/TP trigger on wicks from the source's 1-minute bars, never on a price from before the order. RESET starts the account over. - providers/feed_base.py: shared quote/bar caching, bar-close detection, UTC or New York-close day boundaries, coarser timeframes by aggregation. Quote requests run outside the provider lock. - Secrets (tokens, passwords) never reach the browser, including inside saved profiles; profiles no longer store them, and loading one keeps the ones in use. - The LIVE TRADING switch is enforced by the server too: POST /api/orders is refused while it is off. - Switching sources rebuilds the cones and bands at once from the new source; a ticker the new source doesn't carry loses the files built from another source's prices. - The header names the active source (FEED ● YAHOO …); the PROVIDERS badge and the trading switch name the paper account. - Learning Center article and README sections (English and Arabic) on setting up every source and mapping ticker names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01649i4SjUGvhXrPV3AiNhHN
wJubran
added a commit
that referenced
this pull request
Oct 18, 2026
…aper trading on live prices (#19) Data sources: Yahoo Finance, Binance, OANDA, Alpaca, CSV files, and paper trading on live prices
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.
What and why
The terminal is meant for live analysis and trading on many markets, commodities above all, but it could only get prices from MetaTrader 5 (Windows only) or the simulator. This PR adds five data sources and a paper account that trades on any of them. Each source can be switched while the terminal runs.
Sources (Settings → DATA SOURCES: SETTINGS / TEST / USE; or
python launcher.py --provider <type>)Backend
providers/feed_base.pyholds what the HTTP feeds share:symbols→ built-in table → guess).Quote requests run outside the provider lock, so loading a chart never waits on them. Each feed is about 100–400 lines on top of it.
providers/paper_provider.pyis the simulator's paper engine running on another source's live bid/ask. SL/TP trigger on wicks from the quotes seen and the source's M1 bars, never on a price from before the order existed. RESET starts the account over.provider_routes.pyadds the API:GET /api/providers;PATCH /api/providers/{id};POST /api/providers/{id}/test(a throw-away instance and one quote);POST /api/providers/activate(re-creates the providers, no restart);POST /api/providers/{id}/reset.Secrets: tokens and passwords are never sent to the browser. They show as
••••••, and a PATCH that echoes the mask keeps the stored value.GET /api/configmasks them inside profiles too. Before this, it returned profile snapshots and the MT5passwordunmasked.Orders: the LIVE TRADING switch is now enforced by the server as well.
POST /api/ordersreturns 403 while it is off, as the order ticket already did. Closing positions and editing SL/TP still work.Local analysis: the data source is part of every file's signature.
UI
FEED ● YAHOO,● BINANCE,● CSV…).Docs
README.md,README.ar.mdand the main README's Arabic part. It covers step-by-step setup for each source, ticker-name mapping (including commodities), environment variables, the paper account and troubleshooting.How it was tested
python -m pytestpasses inbackend/: 187 tests on Python 3.13 and on 3.10, with 23 new data-source tests. The new tests cover:httpx.MockTransport(OANDA orders, units and precision, rejects, closes, SL/TP edits; Binance pagination; the Alpaca quote fallback);yfinance;/api/configand profiles;The tests make no network calls.
UI changes: ran
npm run buildinfrontend/and committed the rebuiltfrontend_build/. A second build was identical.Tried it with
python launcher.py --simin Chromium (Playwright):FEED ● CSV, orders go to the paper account, and the PROVIDERS badge reads "PAPER ACCOUNT ● LIVE PRICES".Not done: Yahoo Finance, Binance, OANDA and Alpaca were not tried live, because this environment blocks those hosts. They are tested against recorded API formats only. MetaTrader 5 order handling was not tried on a demo account (no Windows here); its code path is unchanged apart from the new LIVE TRADING check.
Screenshots
Taken locally, not attached:
Generated by Claude Code