{"id":49881294,"url":"https://github.com/aimank2/assessment","last_synced_at":"2026-05-15T14:31:07.630Z","repository":{"id":350728406,"uuid":"1207743581","full_name":"aimank2/assessment","owner":"aimank2","description":null,"archived":false,"fork":false,"pushed_at":"2026-04-11T19:12:52.000Z","size":161,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-11T20:25:46.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://assessment-melanion-capital.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aimank2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-11T10:43:08.000Z","updated_at":"2026-04-11T19:12:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/aimank2/assessment","commit_stats":null,"previous_names":["aimank2/assessment"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/aimank2/assessment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimank2%2Fassessment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimank2%2Fassessment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimank2%2Fassessment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimank2%2Fassessment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aimank2","download_url":"https://codeload.github.com/aimank2/assessment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aimank2%2Fassessment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33069741,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-15T14:31:02.639Z","updated_at":"2026-05-15T14:31:07.624Z","avatar_url":"https://github.com/aimank2.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BTC Price History Assessment\n\nA small Next.js app that renders a BTC/USDT price card with timeframe switching, real historical Binance data, and live WebSocket updates.\n\n## What it does\n\n- Loads real BTC/USDT historical candles from Binance REST\n- Supports 7D, 1M, 3M, 6M, and 1Y chart ranges\n- Applies live trade updates from Binance WebSocket\n- Updates only the latest visible candle instead of rebuilding the whole series\n- Renders the chart with Recharts and UI components styled with shadcn/ui\n\n## Data flow\n\nThe BTC data hook lives in [hooks/use-btc-price.ts](./hooks/use-btc-price.ts).\n\n- Historical data is fetched from Binance `api/v3/klines`\n- Each timeframe maps to a concrete interval and lookback window\n- Klines are transformed into sorted candle data\n- The chart consumes close prices as `{ time, price }`\n- Live trades from the Binance trade stream are bucketed by timeframe\n- If a trade belongs to the current bucket, the last candle is updated\n- If a trade starts a new bucket, a new candle is appended\n- Older out-of-order trades are ignored\n\nThis keeps the historical series intact and avoids the old bug where fake seed data or live points distorted the full chart.\n\n## Project structure\n\n```text\napp/\n  page.tsx                 Entry page\ncomponents/\n  price-chart.tsx          Recharts area chart\n  trade-idea-card.tsx      Main BTC price card UI\nhooks/\n  use-btc-price.ts         Historical fetch + live BTC updates\nlib/\n  utils.ts                 Shared utilities\n```\n\n## Scripts\n\n```bash\nnpm run dev\nnpm run lint\nnpm run typecheck\nnpm run build\nnpm run start\n```\n\n## Run locally\n\n1. Install dependencies:\n\n```bash\nnpm install\n```\n\n2. Start the development server:\n\n```bash\nnpm run dev\n```\n\n3. Open the app in your browser:\n\n```text\nhttp://localhost:3000\n```\n\nIf port `3000` is already in use, Next.js will choose another available port.\n\n## Notes\n\n- The app currently fetches Binance data directly from the client\n- Historical chart ranges are real market data, not generated curves\n- The chart X-axis uses time-based numeric scaling so spacing matches actual timestamps\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimank2%2Fassessment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faimank2%2Fassessment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faimank2%2Fassessment/lists"}