{"id":51496763,"url":"https://github.com/jpita/kraken-api-tests","last_synced_at":"2026-07-07T16:01:05.210Z","repository":{"id":369697236,"uuid":"1289974192","full_name":"jpita/kraken-api-tests","owner":"jpita","description":"Test suite for Kraken's public REST + WebSocket v2 APIs — Playwright, TypeScript, Zod contract testing, CRC32 order-book verification","archived":false,"fork":false,"pushed_at":"2026-07-06T12:57:01.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-06T14:16:17.774Z","etag":null,"topics":["api-testing","contract-testing","kraken","playwright","qa-automation","typescript","websocket","zod"],"latest_commit_sha":null,"homepage":null,"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/jpita.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-07-05T12:38:36.000Z","updated_at":"2026-07-06T12:57:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/jpita/kraken-api-tests","commit_stats":null,"previous_names":["jpita/kraken-api-tests"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jpita/kraken-api-tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpita%2Fkraken-api-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpita%2Fkraken-api-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpita%2Fkraken-api-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpita%2Fkraken-api-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpita","download_url":"https://codeload.github.com/jpita/kraken-api-tests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpita%2Fkraken-api-tests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35234127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-07T02:00:07.222Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["api-testing","contract-testing","kraken","playwright","qa-automation","typescript","websocket","zod"],"created_at":"2026-07-07T16:01:03.874Z","updated_at":"2026-07-07T16:01:05.187Z","avatar_url":"https://github.com/jpita.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kraken-api-tests\n\n[![tests](https://github.com/jpita/kraken-api-tests/actions/workflows/tests.yml/badge.svg)](https://github.com/jpita/kraken-api-tests/actions/workflows/tests.yml)\n\nAutomated test suite for Kraken's **public REST** (`/0/public/*`) and **WebSocket v2**\n(`wss://ws.kraken.com/v2`) market-data APIs. I built this as preparation for Kraken's\n**Sr. QA Automation Engineer — Pro** role: it's a working demonstration of how I approach\ntesting a trading platform — risk analysis before code ([TEST_PLAN.md](TEST_PLAN.md) was\ncommitted first, check the history), invariants a trader actually cares about instead of\nsnapshot assertions, contract pinning against live-captured payloads, and a flake policy\nthat treats retries as signal rather than noise.\n\n## What each test class proves\n\n| Project    | Proves                                                                                                                                                                                                                                                                                                                                    |\n| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `rest`     | The market data is _internally coherent_: books ordered and uncrossed, last trade inside the day's range, candles that don't lie about their range, time never runs backwards, precision conforms to the pair's own metadata.                                                                                                             |\n| `contract` | Every REST response and every WS v2 message type still has the pinned shape (zod). Drift fails with the exact field path — including _new_ WS channels appearing, which the session sweep flags by design.                                                                                                                                |\n| `ws`       | The stream is _alive and correct_: subscribe acks, ≥3 ticker updates in 30s, heartbeat cadence, clean unsubscribe that actually stops data. Flagship: the client-side order book replicated from snapshot+deltas reproduces Kraken's own CRC32 checksum after **every** update — the strongest possible proof against silent book desync. |\n| `cross`    | REST and WS describe _the same market_ (top-of-book and ticker within a documented, reasoned tolerance) — a trader charting off one and executing off the other isn't being lied to.                                                                                                                                                      |\n\nNo API keys, no secrets, no order placement — public endpoints only, rate-limited\nclient-side to stay a polite API citizen (~1 req/s with a 10% margin).\n\n## Run it\n\n```bash\nnpm ci\nnpx playwright test            # full suite against the live API\nnpx playwright test --project=ws     # just the WebSocket tests\nnpx playwright show-report     # HTML report\n```\n\nRequires Node ≥ 20. No browsers, no `.env`, nothing to configure — a fresh clone runs.\n\nCI runs the suite on every PR/push and on demand (`workflow_dispatch` — in a team setting\nthis would be a nightly cron, since drift ships on Kraken's schedule, not ours), uploading\nthe HTML report and — if any test needed a retry — a `flake-report.json` artifact, per the\nflake policy in [TEST_PLAN.md §6](TEST_PLAN.md).\n\n## What I'd test next with private-endpoint access\n\nThe natural v2 is the **order lifecycle on Kraken Futures demo** (demo-futures.kraken.com),\nwhere placing real orders is free and safe:\n\n- **Place / cancel / amend** for limit, market, stop-loss, and take-profit orders —\n  state transitions (`pending → open → filled/canceled`) asserted via both the REST\n  response and the private WS execution feed, never assumed.\n- **Post-only**: must reject (not cross) when it would take liquidity.\n- **Reduce-only**: must never increase a position, including the partial-fill edge cases.\n- **Self-trade prevention**: two own orders that would match must trigger the configured\n  STP behaviour, not a wash trade.\n- **Idempotency \u0026 error contracts**: duplicate `cliOrdId`, insufficient margin, precision\n  violations (an order priced off `tick_size` must be rejected with the documented error,\n  not silently rounded).\n- Cross-checking the private execution feed against the public trade tape — my own fill\n  must appear on the public tape with matching price/qty/timestamp.\n\n## Repo map\n\n```\nTEST_PLAN.md          scope, risk analysis, rate-limit + flake policy, API observations\nSKILL.md              Claude Code skill: how to extend this suite (my AI-augmented QA workflow)\nplaywright.config.ts  projects: rest | contract | ws | cross\nsrc/clients/          REST client (rate-limit queue, typed errors) + WS v2 helper (event-driven)\nsrc/schemas/          zod schemas — the contract layer, pinned against live captures\nsrc/domain/           order book replication + CRC32 checksum (verified against live data)\nsrc/fixtures/         pair name mapping across Kraken's three naming schemes\ntests/                the four projects\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpita%2Fkraken-api-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpita%2Fkraken-api-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpita%2Fkraken-api-tests/lists"}