§ 00 / products / apigtbot

apigtbot. A trading bot that shows its work.

Two strategies — a buy-low-sell-high grid and a breakout trend follower — running as always-on daemons against live market data, with every fill, refit and kill written to a journal you can read. Paper mode by default: real prices, simulated fills, no exchange keys. Risk caps are enforced on the server, not in the strategy, and an AI agent can tune the grid every hour — but never touch the caps.

what it is
self-hosted crypto trading bot platform
licence
MIT · open source
strategies
grid · trend, switchable per run
default mode
paper — real prices, no keys
exchange
Binance
AI
MCP server · hourly agent routine
§ 01 / strategies

Two engines, one run.

Markets range and markets trend; a bot that only knows one of them is wrong half the time. Both engines sit behind the same seam, so a run can change its mind without changing its wallet.

01/grid

Grid — mean reversion

A ladder of buy and sell levels across a price range: geometric or arithmetic spacing, configurable levels and per-level allocation. Buys the dips, sells the bounces, re-anchors itself when the geometry changes and never abandons inventory on a refit.

02/trend

Trend — breakout follower

Long-only entries when price closes above the recent high with the fast average over the slow one; exits on a ratcheting trailing stop sized by volatility; a cooldown before re-entry. Each entry tranche is sized and risk-reviewed on its own.

03/switch

One switch per run

Flip a live run between grid and trend from the dashboard. The daemon restarts and hands over cleanly: open entries cancelled with partial fills booked, working exits carried as legacy orders, unguarded positions taken over at cost.

§ 02 / trading modes

Paper first. Real money is opt-in, twice.

01/paper

Paper — the default

Live market data, fills simulated locally, balances in a simulated wallet. No exchange account, no keys. Every strategy, chart, alert and risk rail behaves exactly as it would with money on the line.

  • no keys
  • real prices
02/testnet

Real — testnet

Orders go to the exchange's sandbox with testnet keys. Same code path as live, so what you see here is what you will get there.

  • sandbox keys
03/live

Real — live

Mainnet orders with your own keys. Gated on purpose: the run's own switch and the server's environment flags must all agree; a mismatch is refused at boot, and the daemon fast-fails without credentials.

  • your keys
  • gated
§ 03 / risk rails

The strategy proposes. The rails decide.

A bot is only as safe as the thing that can say no to it. Every rail below applies identically in paper, testnet and live mode.

risk profiles
One dropdown — NoLoss, Cautious, Balanced, Aggressive, Max — drives every cap as a live ratio of the run's budget: daily-loss limit, unrealised-loss stop, position and order caps, breakout policy, trailing-stop multipliers. NoLoss structurally refuses every loss-realising path.
shared wallet
All runs draw slices from one budget pool. Over-commitment is refused when you save, and halts entries at the daemon if it slips through. A wallet-level max-drawdown stop kills every run when equity breaches the floor.
sell at loss
A per-run switch, off by default. Until you turn it on, the bot will hold inventory rather than realise a loss — a deliberate choice, not a forgotten one.
server-side
The caps live outside the strategy and outside the agent. A strategy bug or an over-eager AI proposal cannot raise a limit, clear a kill switch or liquidate a position.
evidence
Walk-forward sweeps over collected candle history — spacing, width, deployment policy, trend parameters — validate a setting before it is trusted with a live run. Guardrails derived from them are computed into every refit proposal.
alerts
Kills, breakout halts, drawdown stops and stranded inventory go to your phone immediately; closed cycles the moment they book, with realised P/L; routine fills coalesced into per-tick digests so a burst is one message, not ten.
§ 04 / an agent in the loop

Tuned by an AI. Bounded by the server.

Grid geometry is tedious to tune by hand and markets move. So an assistant like Claude does it on a schedule — inside limits it cannot change, with a scoreboard it cannot hide from.

01/mcp

MCP server

The whole system is drivable by an AI agent over the Model Context Protocol, as a logged-in user: status, market signal, grid preview and set, start, stop, kill, P/L report, backtest, decision journal.

  • gtbot_status
  • gtbot_set_grid
  • gtbot_pnl_report
  • +11
02/routine

Hourly refit routine

Once an hour an agent takes one compact brief of every run — signal digest, regime and gates, a candidate grid, track record, a "material change" bit — and re-fits the flagged runs' range, levels and deployment, reallocating budget slices where it helps.

  • gtbot_routine_brief
  • 1 read / hour
03/scored

Decisions that get graded

Every agent decision is journaled with its reasoning, then scored by the server against what the market actually did. The agent reads its own track record in the next brief and learns from it.

  • gtbot_decisions
  • scored
04/rails

Advisory, with guardrails

The agent may re-fit geometry and move slices. It cannot raise a risk cap, clear a kill switch or liquidate inventory — those stay human. A dead-man's-switch cron takes over with quantile refits if the routine goes quiet for two hours.

  • caps untouchable
  • dead-man switch
§ 05 / in the box

Built to be operated, not just started.

01

Dashboard

Per-run charts — trades, price history, trend line, grid band, lifecycle markers — holdings, the shared-wallet tile, start / pause / reload per run.

02

Always-on daemons

One process per active run, kept alive by a watchdog; market data collected every ten minutes; a nightly backup. No root, no service manager required.

03

Decision journal

Every fill, refit, switch, halt and kill is an event with an id. Alerts carry the id, so a genuine repeat is distinguishable from a double-send.

04

Backtests & sweeps

Backtest a candidate grid or trend setting from the dashboard or the agent; walk-forward sweep scripts for the parameters that matter.

05

REST API

Runs, orders, events, market data and wallet as documented endpoints with role checks and an audit log — the same surface the dashboard and the MCP server use.

06

Runbook

Going live, incident recovery, alerts, the agent routine's prompt and design, the evidence behind the guardrails — written down, in the repo.

Built on GoatCheese: the admin, API and MCP server are generated from the data model; the strategy engines and daemons are the custom part.

Run it yourself, or have one built.

Clone it, run the installer, create a paper run and watch it work. Want a strategy of your own, another exchange, or an agent routine tuned to your rules? Send a brief.

Experimental software for research and paper trading. Nothing here is financial advice; if you connect real funds, you do so at your own risk.