← blog  /  bots

Start from the task, not the strategy

2026-10-20  ·  3 min read  ·  bots

A trading bot project begins with what the bot is for, what it may lose and what it must never do. The signal comes last, and it is the smallest part of the work.

Ask a trader what a bot does and you get a strategy: it buys breakouts, it fades extremes. Ask the person who has to keep it running and you get a different list: what happens when the exchange times out, what happens when it fills half an order, what happens at 3am when nobody is looking.

That second list is most of the work. So we start there.

Three questions before any code#

  1. What is the bot for? Collecting a yield, testing an idea, cleaning up an account, watching a feed. Different jobs, different bots.
  2. What is it allowed to lose? In money, in a day, in a row. This becomes numbers in the risk layer before the first order exists.
  3. What must it never do? Hold a position without a stop. Trade something not on a list. Send money out. These become code paths that do not exist.

Bot types we tailor to a task#

TypeWhat it is forMain risk
Trend and breakoutRiding sustained moves once price leaves a rangeWhipsaw: a run of false breakouts bleeds money through stops and fees
Mean reversionFading stretched moves back toward an averageThe stretch turns out to be a new trend, and the signal keeps saying "cheaper, buy more"
Funding rate carryLong spot and an equal short perpetual, collecting funding while it is positiveFunding flips, the basis moves, a thin short leg gets squeezed, rebalancing fees eat the carry
DCA and martingale laddersScaling into a position in rungs as price moves against the entryConcentrated tail risk when the ladder has no ceiling
GridResting orders at fixed steps to harvest back and forth movementPrice leaves the range and inventory piles up on the wrong side
Coin toss control groupA baseline entering on a random signal with the same sizing, stops and feesNone in the logic. The risk is skipping the baseline and fooling yourself
Announcement and listing watcherReacting to exchange announcements on predefined rulesLatency, thin books, misreading an announcement
Treasury collectorSweeping dust and leftovers into the trading currencySelling into a thin book, or converting something meant to be held

Tailoring a ladder#

A classic martingale has no ceiling: each rung doubles the last. For a client who wants ladders, we keep the shape and put one shared stop and one fixed risk budget over the whole thing, so the worst case is known before the first order goes out.

Illustrative: a DCA ladder that splits one fixed risk budget across its rungspython
def dca_ladder(entry: float, stop: float, risk_budget: float, *, rungs: int = 4,
               spacing: float = 0.02, mult: float = 1.6, fee_rate: float = 0.0006):
    """Long ladder: rung k rests spacing*k below entry; every rung shares ONE stop.
    Rung k gets a slice of the risk budget proportional to mult**k * (loss per unit
    from rung k to the stop). Sizes grow geometrically, yet if every rung fills and
    the stop hits, the total loss equals risk_budget, never more."""
    prices = [entry * (1 - spacing * k) for k in range(rungs)]
    if prices[-1] <= stop:
        raise ValueError("the deepest rung must sit above the stop")
    loss_per_unit = [p - stop + (p + stop) * fee_rate for p in prices]
    weights = [mult ** k * d for k, d in enumerate(loss_per_unit)]
    total = sum(weights)
    ladder = []
    for k, (p, d, w) in enumerate(zip(prices, loss_per_unit, weights)):
        risk_k = risk_budget * w / total
        ladder.append({"rung": k, "price": p, "qty": risk_k / d, "risk_at_stop": risk_k})
    return ladder

With mult = 2 this is the familiar martingale shape. The difference is the shared stop and the fixed budget. All parameters in the code on this site are illustrative defaults, not recommendations.

Demo first, always#

Every bot runs on a demo or testnet account before it is trusted with real funds. The rest of the bots page and the posts below are about what makes that step worth anything.

not advice

This is how trading software can be built. It is not investment advice. Trading crypto assets, especially with leverage, carries a risk of losing money, and results from tests or simulations do not guarantee anything in live markets. The studio builds trading software and tooling. It does not manage anyone's money, hold client funds or trade on anyone's behalf.