Add WebSocket streaming and deterministic CI tests for crypto data API#6
Draft
Add WebSocket streaming and deterministic CI tests for crypto data API#6
Conversation
Co-authored-by: Nfectious <19631929+Nfectious@users.noreply.github.com>
Co-authored-by: Nfectious <19631929+Nfectious@users.noreply.github.com>
Co-authored-by: Nfectious <19631929+Nfectious@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add complete FastAPI service for OHLCV candles and indicators
Add WebSocket streaming and deterministic CI tests for crypto data API
Feb 19, 2026
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.
Completes the FastAPI service for cryptocurrency OHLCV data with technical indicators (EMA/RSI/ATR). Adds WebSocket streaming endpoint and deterministic mocked tests for CI reliability.
WebSocket Endpoint
New endpoint
/api/v1/live_data/wsstreams market data at configurable intervals:Accepts same query parameters as REST endpoint plus
interval(seconds). Handles network/exchange errors gracefully by sending error objects instead of closing connection.Mocked Tests
Added
test_live_data_mocked.pywith synthetic OHLCV data generator. PatchesExchangeClientto eliminate network dependencies and rate limiting issues in CI:7 deterministic test cases cover: default/custom parameters, indicator calculation, edge cases (insufficient data, minimal limits), parameter validation, numeric precision.
Technical Details
Generator[MagicMock, None, None])All quality checks pass: ruff, mypy (strict mode), pytest, CodeQL (0 vulnerabilities).
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.binance.com/usr/bin/python python -m pytest tests/ -v(dns block)/home/REDACTED/.local/bin/pytest pytest(dns block)/home/REDACTED/.local/bin/uvicorn uvicorn app.main:app --host 0.0.0.0 --port 8000(dns block)https://api.github.com/graphql/usr/bin/gh gh pr list --head copilot/add-fastapi-live-data-another-one .pid; cd /home/REDACTED/work/crypto-trade-analysis/crypto-trade-analysis && uvicor_(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Create a new branch
add/fastapi-live-dataand open a pull request againstmainthat adds a complete, production-ready FastAPI service to fetch OHLCV candles and compute technical indicators (EMA/RSI/ATR) with Docker, CI, typing, and tests.Please add the following files and behavior to the repository
Nfectious/crypto-trade-analysis:Behavioral requirements and notes
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.