Read-and-trade bot: news in, trade ideas out
A worker that reads company news every three hours and posts trade ideas to Telegram, with a website showing the open calls. No validated edge, not financial advice. About $32.16 a month plus OpenAI tokens.
It has no validated edge and it is not financial advice. It is an example of a worker, a website and a database running together, with real API costs.
What you build
The worker calls OpenAI, SEC EDGAR, Finnhub, Marketaux and Telegram. The website reads the same database and writes nothing.
Before you start
You need an OpenAI key with credit, a Telegram bot and channel, and free Finnhub and Marketaux keys. DEPLOY.md lists each one and where to get it.
What Gagarin creates
| Name | Kind | Size | Holds |
|---|---|---|---|
db | postgres | s, 10 GB disk | seen events and scored calls |
bot | service | s | the worker, private |
web | service | s | the website, at a public HTTPS address |
The commands
./deploy.sh runs these for you, with .env filled in:
gg init read-and-trade
gg resource add read-and-trade/db postgres --size s --storage 10
gg ship read-and-trade/bot:8080 --size s --env-file .env
gg deps add read-and-trade/bot db
gg ship read-and-trade/web:3000 --context ./web --size s
gg deps add read-and-trade/web db
gg domain add read-and-trade/webWhat it costs
About $32.16 a month on Gagarin: three size-s containers at $10.22 each and 10 GB of disk at $1.50. OpenAI tokens come on top; DEPLOY.md measures them. Traffic is free. Rates: https://gagarin.cloud/pricing
What can go wrong
gg shipfails before it builds: Docker is not running.docker infosays.- The worker logs a database error at first boot: the dependency lands just after the service. It retries with backoff.
- The website is killed for memory: move it to size m with
WEB_SIZE=m ./deploy.sh.gg statusnames the kill. - A forgotten variable: a deploy replaces the whole environment. Deploy with the script, which restates all of it.
Run it locally
cp .env.example .env # fill in the keys DEPLOY.md lists
docker compose up --buildClean up
gg destroy read-and-tradeGagarin emails the project owner a button to approve the deletion.
The full write-up
The README goes further: how it works inside, its limits and its tests.