# 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.

Source: https://github.com/gagarin-cloud/recipes/tree/main/read-and-trade-bot
Costs about $32.16 a month, plus OpenAI tokens. Checked 2026-10-22.

## Paste this into your coding agent

```
Deploy the read-and-trade-bot recipe from https://github.com/gagarin-cloud/recipes to Gagarin Cloud. Follow https://gagarin.cloud/recipes/read-and-trade-bot
```

**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

- `bot` (service, worker, :8080 health, private) → `db`
- `web` (service, Next.js, :3000, public address) → `db`
- `db` (Postgres, 10 GB disk)

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](https://github.com/gagarin-cloud/recipes/blob/main/read-and-trade-bot/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/web
```

## What 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 ship` fails before it builds: Docker is not running. `docker info` says.
- 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 status` names 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 --build
```

## Clean up

```
gg destroy read-and-trade
```

Gagarin emails the project owner a button to approve the deletion.

## The full write-up

The [README](https://github.com/gagarin-cloud/recipes/blob/main/read-and-trade-bot/README.md) goes further: how it works inside, its limits and its tests.
