alt.hn

7/20/2026 at 1:49:53 PM

Show HN: The0 – self-hosted runtime for trading bots, bring your own language

https://github.com/alexanderwanyoike/the0

by mercutio93

7/20/2026 at 1:50:14 PM

Some more detail on the internals for those interested:

The toughest part was getting the Go-written runtime to be able to run arbitrary code in multiple languages. The other tough part was getting the logs and state of the bots to be queryable and streamable in real time. One fun feature is that you can create custom dashboards in React for each bot and stream the logs into them, there is a React sdk that helps you do this. It was a challenge getting this to work and involved treating each bot as a two phased bundle deployment and hydrating the frontend with the state of the bot and metrics from logs (I was inspired by the way Datadog does this).

The way bots send information such as logs and state is done through a daemon process that runs alongside the bot in its container (again inspired by Datadog). The daemon handles what I call the dirty work, persistence of logs and state to the Object Store (MinIO), behind the scenes; the bot just sends information via standard logging and persistence calls from the SDK. Its decoupled, the bot can run without the daemon, but then you lose the ability to query the state of the bot and stream logs.

Stack: the runtime is written in Go and uses NATS for messaging, PostgreSQL, MongoDB and MinIO for persistence. The frontend is React and the CLI is Go. It runs locally through docker or in k8s via helm charts. The0 can theoretically be scaled to run thousands of bots on a k8s cluster (this is based on your own code and the resources you have available).

In terms of whats next... honestly most of the major work is done, the0 is stable and I use it to run my own bots. I think most of the work is in extending the MCP server to support more features and making it easier for AI agents to interact with the bots. The next step is to get some honest feedback on what people want to see in the0 and how they would use it.

by mercutio93

7/21/2026 at 4:12:12 AM

> The toughest part was getting the Go-written runtime to be able to run arbitrary code in multiple languages.

Why not just supply a Wasm VM? Are there interesting languages that don't compile to Wasm?

by addaon

7/21/2026 at 11:38:14 AM

Intresting question truth be told I went for tried and tested docker since its something industry uses without "issues" (I say that lightly cause they are).

I have to say that you can definately get further with a WASM VM today. pyodide can run libraries like numpy/pandas and WASIX (WebAssembly System Interface Extended that adds missing syscalls, dynamic linking, threads, sockets, libffi) can get a full cpython with native libs running but those are specific curated packages. The idea behind the0 was to bring the exact environment, whatever pip wheel or C binding you used backtesting locally runs unchanged in the container. With WASM anything outside the curated package list needs a wasm-specific build to exist at all as wasm is a different architecture straying from x86/ARM.

On language support I actually went through my 7 runtimes for this. Rust is the only one where wasm is a first-class target today. C/C++ has been clang-only for a decade, GCC's own wasm backend literally got approved by the steering committee last month and its still missing exceptions and debug info. Python as above runs as curated interpreter builds. Node is the funny one, wasm VMs dont run JS at all, you embed a JS engine compiled to wasm (Javy, StarlingMonkey) and lose all the Node APIs and native addons. The .NET 8 WASI workload is labelled experimental by Microsoft. GHC's wasm backend arrived in 9.6 and is still young. And for scala 3 the closest thing is Scala.js's new WasmGC backend, but thats Scala.js semantics, you lose the JVM library ecosystem which is the whole reason to write a bot in Scala. So 1 out of 7.

I did have a look at what would close the gap here. container2wasm is a possible hopeful solution but it does this by embedding a CPU emulator (Bochs) and booting linux inside the module so theres a emulation tax here I think I havent tested it. Theres also runwasi that solves the opposite problem, it would let docker/k8s schedule wasm modules as if they were containers. A glimmer of hope, however it wouldn't change the fact that we would have to compile to wasm first (back to fiddling with pyodide and WASIX). So we could either recompile the ecosystem or emulate the CPU.

That said for simple pure-logic bots a wasm runtime alongside the containers could be nice someday, the isolation and cold starts are genuinely better. Worth doing an expiriment and protoype of this. But for running whatever code in whatever language today, docker gets 7 out of 7 cause containers are the ISA everything was already built for, its the industry standard for production workloads for a reason.

by mercutio93

7/21/2026 at 4:31:04 AM

Over 900 commits from one person is significant effort!

Here is my feedback, more for users:

1. One should never run a crypto trading bot on Hetzner. Hetzner historically hasn't formally allowed anything to do with crypto. If it sees the words bitcoin or crypto anywhere on disk in a filename or in incoming packets, they can terminate your instance and account without warning, perhaps when you're in a middle of a high-priority trade that needs close attention. It happened to me, and is very dangerous with money on the line.

2. A second reason for not using Hetzner is that its datacenter is geographically probably pretty far from your broker, needlessly adding to much avoidable latency.

3. A third reason for not using Hetzner is that they recently raised the prices unpredictably and dramatically relative to other cloud providers. One needs a provider that won't screw oneself over.

4. If daytrading, it is critical to be able to redeploy and restart the trading bot within seconds. Until the bot's code is stabilized, identified bugs and strategy changes need to be addressed immediately when in the middle of trades. There is no time to rebuild and deploy a container. In contrast, it takes just a few seconds to do `git pull` and restart the Python/Go/TS service. As such, I would never use any container tooling for it. If one is making only long-term trades, then this matters less.

by OutOfHere

7/21/2026 at 12:04:46 PM

[dead]

by mercutio93

7/21/2026 at 9:36:11 AM

[flagged]

by femyli

7/21/2026 at 3:26:51 PM

[flagged]

by hereme888

7/21/2026 at 3:37:08 PM

[dead]

by hpj675