frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

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

https://github.com/alexanderwanyoike/the0
11•mercutio93•14h ago
So Im a solo developer who has always had an itch for algorithmic trading. Initially I started off learning how to trade algorithmically with Yves Hilpisch book "Python for Algorithmic Trading" after reading that book I was hooked and started building algorithmic trading bots. Initially these were separate python scripts that I ran on my local machine. That was a bad idea cause local machines are not reliable and I wanted to run my bots 24/7 365. In my actual career im a software engineer with experience in building distributed systems and fault tolerant web applications.

I wasn't interested in deploying my code to managed services like MetaTrader, CTrader or QuantConnect etc because I wanted to have full control over my code and the environment it runs in. I also wanted to be able to run my bots in any programming language I wanted, not just Python. Sometimes I wanted to prototype a bot in Python and then rewrite it in C++ or Rust for performance reasons.

Many at this point would have said why not use a framework like Lean or Freqtrade or Hummingbot. However I found that these frameworks were too opinionated and if you decide to use them then your bot is now part and parcel of their framework. I backtested my bots locally in my own specific way, and now with AI my agents can generate code, backtest and analyze the results all locally, no need to run any of it in the execution platform. I wanted bots I could deploy, version, update and monitor like any other software application. I also wanted to explore building something that creates a standardized way of running bots.

This has been a 4 year journey and I made a lot of mistakes along the way. The application has seen 4 rearchitectures, 3 of which were basically complete rewrites. The first version was a python program and the bots were just modules that were loaded dynamically. The second was my serverless phase when I internally just wanted something that was online cron triggered and only works for me. The third was the first time I was dipping into kubernetes; more cloud native and the idiot in me decided to try make it a SaaS. The final form is a fully self-hosted runtime, api, cli and frontend that let you run bots as containers in a fault tolerant way both locally (through docker `the0 local`) and in a cluster (k8s) and monitor them with a minimalistic frontend.

To support multiple languages there's a thin contract that the bots have to implement: a main(bot_id, config) function and a bot-config.yaml file. The runtime (written in Go) takes care of the rest, it supports C++, Rust, Python, JS/TS, C#, Scala and Haskell for those who are brave enough to try it. More on the architecture here: https://docs.the0.app/runtime

If you want to play with the0 you can run it locally, guide here: https://docs.the0.app/deployment/local-getting-started. The0 is open source and licensed under Apache-2.0: https://github.com/alexanderwanyoike/the0

I currently use the0 to run my own personal algorithmic trading bots on a single node k3s cluster on a $10/month Hetzner VPS. I have 18 bots running on 2 brokers (Alpaca, Bybit) and they have been running for months without issues. Some bots trade crypto, others stocks, some do risk analysis and others invest. Coolest bit is the API provides an MCP server so AI agents can query the state of the bots, look at their logs, monitor them and even update them. Slap an OpenClaw agent and you can effectively setup an autonomous AI quantitative trading system (good luck chasing Alpha).

Now I must admit Lean has all the tools and far more quantitative prowess than the0, but I always felt it does too much. Each Lean engine runs one algorithm, and once you have lots of bots, running and managing all of them in production is left to you. That's the part the0 does, and its the only part it tries to do. If you find hiccups or have ideas for features Im all ears. More on the internals in my first comment.

Comments

mercutio93•14h ago
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.

addaon•33m ago
> 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?

OutOfHere•14m ago
1. One should never ever should run a crypto trading bot on Hetzner. Hetzner historically doesn't formally allow anything to do with crypto, and 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, 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 one over.

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

Show HN: Immersive Gaussian Splat tour of grace cathedral, San Francisco

https://vincentwoo.com/3d/grace_cathedral/
117•akanet•8h ago•25 comments

Show HN: Vertically Works – UI components built on writing-mode: vertical-RL

https://vertically.works
2•jihoons•23m ago•0 comments

Show HN: DroneWorld – Earth with multiplayer drones and Ethereum real estate

https://droneworld.app/
2•mannders•26m ago•0 comments

Show HN: Repolink – Turn any GitHub repo into a tool for any of your projects

https://github.com/imjszhang/js-repolink
2•imjszhang•30m ago•0 comments

Show HN: Fluidic Network Grid – A branchless control plane in Jax

https://github.com/PJHkorea/Fluidic_Network_Grid
2•PJHkorea•38m ago•1 comments

Show HN: Imud – Gpsd, but for IMUs

https://github.com/richcreations/imud
2•richcreations•41m ago•0 comments

Show HN: OTP Inspired actor supervisor based full stack templates

https://shipstacks.tech
10•annrap1d•14h ago•1 comments

Show HN: Envy - A flat-file, frictionless note-taking application for macOS

https://envynote.app
4•widowlark•1h ago•0 comments

Show HN: Shackle – Deterministic runtime governance for AI agents

https://github.com/Fame510/SHACKLE
2•shacklepro•1h ago•0 comments

Show HN: pgwd – PostgreSQL connection alerts with cron exit codes

https://github.com/hrodrig/pgwd
2•hejeroaz•1h ago•0 comments

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

https://github.com/alexanderwanyoike/the0
11•mercutio93•14h ago•3 comments

Show HN: I replaced a $120k bowling center system with $1,600 in ESP32s

2841•section33•1d ago•339 comments

Show HN: Ekko – post-quantum E2EE layer for Instagram, WhatsApp, Telegram Web

https://useekko.app/
6•kvasilev•4h ago•1 comments

Show HN: Hospital Price Watch: Transparent, Shoppable Hospital Prices

https://hospitalpricewatch.com/
3•brad12345•2h ago•1 comments

Show HN: AI meeting notes – no bot, insights and answers from your files (BYOK)

https://getaiassist.app/
2•rfigueror1•2h ago•0 comments

Show HN: UEFI Bootloader for TempleOS

https://codeberg.org/0x2f22d23e/UwUEFI
2•AlecMurphy•9m ago•0 comments

Show HN: Wheesper – Start an anonymous discussion with a link

https://wheesper.com/
33•whatdoyouthink2•13h ago•22 comments

Show HN: How to Get a Fable CoT for the Jacobian Conjecture Refutation

4•SonOfLilit•3h ago•0 comments

Show HN: A Job Board for European Defence Companies

https://www.defencejobseu.com/
3•Collusus96•5h ago•0 comments

Show HN: AI Secretary – Stop checking your phone "just in case"

https://github.com/mathigatti/telegram-ai-secretary
2•mathigatti•3h ago•0 comments

Show HN: Agent Search Engine – an independent index of 247 AI agents

https://agentsearchengine.app
2•ASE-APP•3h ago•0 comments

Show HN: cbxy – A format for creating guided comic book experiences

https://github.com/ngafar/cbxy
9•nawazgafar•9h ago•3 comments

Show HN: Vidmoat – a video editing pipeline any AI agent can operate

https://www.vidmoat.com/
3•fredabila•4h ago•0 comments

Show HN: PounceDomains – Domain discovery and sniping for Namecheap Marketplace

https://pouncedomains.com
2•DotSauce•4h ago•0 comments

Show HN: A Pipeline for Making 10-minute AI Movies with Claude Code and Seedance

https://github.com/dawndrain/movie-gen
17•dawndrain•14h ago•4 comments

Show HN: A chess game you play with Claude as your wing-bot in the CLI

https://github.com/goawaygeek/ground-control
2•goawaygeek•5h ago•0 comments

Show HN: Relay – a self-hosted LLM gateway with eval-gated routing

https://github.com/llmrelay/relay
2•olopadef•5h ago•0 comments

Show HN: Internet Speed Atlas, a browser-measured ranking of 119 countries

https://speedof.me/internet-speed/
3•lastmile•5h ago•3 comments

Show HN: GPU Accelerated Desktop Screen Flash Filter (Photosensitive Epilepsy)

https://flashfilter.app/
6•flashfilter•10h ago•3 comments

Show HN: CheapStack – affordable dev starter kits and boilerplates

https://cheapstack.dev
2•makbar890•6h ago•1 comments