Hoox Docs

⚡ Edge-First Architecture

In algorithmic trading, latency is leverage. A delay of just 150 milliseconds between a signal firing and an order arriving at the exchange can mean the difference between a highly profitable fill and severe price slippage.

Hoox solves the latency problem by abandoning traditional server-centric architectures (like AWS, DigitalOcean, or standard VPS instances) and executing order logic natively on Cloudflare® Edge Workers.


🏎️ The Physics of Latency: Why Traditional VPS Bots Fail

Traditional trading bots are deployed on a single virtual private server (VPS) in a fixed geographical data center (e.g., Virginia, USA).

The VPS Bottleneck (200ms+ slippage)

  1. Signal Generation: A TradingView alert fires in London.
  2. Network Transit: The alert travels across the Atlantic to your Virginia VPS (~85ms).
  3. Execution Delay: The VPS boots a heavy Node/Docker runtime to process the signal (~10ms).
  4. Exchange Transit: The order travels from Virginia to Bybit’s API servers in Tokyo or Frankfurt (~110ms).
  5. Total Transit Latency: 205ms before the exchange matches your order.
[London Alert] ── (85ms) ──> [Virginia VPS] ── (110ms) ──> [Frankfurt Bybit] = 205ms Latency

The Hoox Edge Path (Under 15ms latency)

  1. Signal Generation: A TradingView alert fires in London.
  2. Edge Ingestion: The alert hits Cloudflare’s nearest London Point of Presence (PoP) in 1.8ms.
  3. V8 Isolate Processing: A sandboxed V8 isolate processes and validates the order instantly (<3ms).
  4. Smart Placement Routing: The internal service binding transfers compute to the edge node geographically closest to Bybit’s servers (Frankfurt) within 8ms.
  5. Total Edge Latency: Under 15ms total network transit time.
[London Alert] ── (1.8ms) ──> [London PoP] ── (8ms Service Binding) ──> [Frankfurt Node] ── (1ms) ──> [Bybit] = 10.8ms Latency

🧅 V8 Isolates vs. Traditional VMs / Containers

Traditional architectures run on Virtual Machines or Docker containers. These runtimes carry significant memory overhead and introduce cold starts—the time required to spin up a container after inactivity.

Architectural DimensionTraditional VM / Container (VPS)Cloudflare Edge Worker (V8 Isolate)
Boot ArchitectureHeavy guest OS, Node runtime, npm modulesSandboxed JavaScript V8 Engine runtime
Cold-Start Delay1,000ms – 15,000ms (system stalls)< 3ms (virtually non-existent)
Memory Footprint256MB – 2GB per instance128MB max (highly lightweight)
Global FailoverRequires complex DNS/Load Balancer setupNatively distributed across 330+ locations
Geographic LocationFixed data centerAutomatically routes to nearest user node

🎯 Smart Placement: Zero-Config Latency Optimizer

To achieve sub-millisecond edge execution, Hoox enables Cloudflare’s Smart Placement engine natively on all critical workers:

"placement": {
  "mode": "smart"
}

How Smart Placement Works

  1. When you deploy trade-worker, Cloudflare monitors its network dependencies. It notices that trade-worker makes outbound signed HTTPS REST requests to Bybit’s Frankfurt server (api.bybit.com) and writes transaction rows to the d1-worker SQLite database.
  2. Instead of running the worker’s CPU compute at the location where the user’s browser or alert hits (e.g. California), Smart Placement automatically shifts the compute isolate to the Cloudflare node physically closest to the Bybit servers (Frankfurt).
  3. The V8 engine performs all signature calculations and database writes at the edge gateway node, reducing the final API transit time to under 2 milliseconds.

⚙️ Hardware-Level Security

Because V8 isolates run in strictly isolated memory contexts managed directly by Google’s Chromium V8 engine, your code is secure:

  • Isolate Protection: Memory leaks, side-channel attacks, and adjacent tenant exploits are prevented at the V8 compiler level.
  • Microsecond Service Bindings: Communication between workers is processed entirely inside the local V8 runtime, meaning sensitive exchange payloads and API calls never travel over the public internet.

Tip: By removing VPS management, you do not just save latency—you also save operational overhead. Cloudflare natively manages automatic scaling, load balancing, SSL negotiation, and route failovers for free.

🔗 Next Steps