Skip to content

lukemacauley/kraken-ai

Repository files navigation

Kraken meet AI - Try it

Place trades on Kraken with AI. Make trade orders in natural language (e.g. “Buy 1 ETH if a 10+ ETH sell prints”).

Evaluate live data against your condition and execute the order when matched.

View walk-through here: External link to Loom

Technical details

  • Batch pipeline:
    • Parse incoming websocket messages, sort newest-first, then filter against the LRU in bufferTrades(parsed).
    • Accumulate accepted trades until the next rAF tick, then flush once to the store with scheduleFlush.
  • Store flush:
    • Merge batch with existing trades and cap to MAX_TRADES_HISTORY.
    • Compute filteredTrades within filterRange and update only if IDs changed.
  • Minimal re-render strategy:
    • Avoid notifying subscribers when visible data is unchanged, reducing React work under bursty traffic.
  • Uses zustand:
    • Great for WebSocket-driven stores as there's no provider and minimal overhead.
    • Module-level refs buffer and coalesce updates between renders (e.g., pendingTrades, seenIds).
    • Stable subscriptions via use-sync-external-store under the hood.
  • Deterministic natural language:
    • generateObject + zod makes outputs predictable. If there's no schema match, then no trade.

About

Place trades on Kraken with AI. Use natural language but make it deterministic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published