spin docs
Strategies

Buying

What a buy buys, where it trades, how much it spends, and how slippage and prices work.

The Buy block is the outcome of an entry check. Open it to set what the bot buys, how much ETH it spends, and the slippage it accepts.

In Outcome, choose Buy a token or Launch a token (Pons or Torch). This page is about buying. Read launching for launches.

What the bot buys

A buy buys one of these:

  • The token that started it. With a launch or trade trigger, the bot buys the token that launched or was traded. This is the default.
  • A chosen token. Turn on Buy a chosen token, then pick it in Token to buy. Every buy then buys this token, whatever started the check.
  • A token an AI step names. An AI step can answer with a token's address. The bot then buys that token.
  • A token your service sends. With a webhook trigger, a token field of the call can be the token the bot buys.

A timer or a webhook trigger has no token of its own. So these strategies always need a chosen token, a named token, or a launch.

The token that started it

The bot buys the token where it trades on its launchpad. A Pons token trades on its bonding curve, then in its pool once it has graduated. A Torch token trades in its own pool. If a Pons curve has sold out and the token has not reached its pool yet, the bot does not buy.

A chosen token

Token to buy lists the tokens on Spin's token list, deepest first. Search by symbol, name or address. You can also paste the whole address of a token that is not on the list. The bot then finds its pools when it trades. A backtest cannot price such a token, and the editor does not know its decimals.

Then choose Where it trades:

OptionThe bot trades in
The best pool at trade timeThe pool with the best quote, on UP or Uniswap.
The best UP pool at trade timeThe UP pool with the best quote.
The best Uniswap pool at trade timeThe Uniswap pool with the best quote.
Only a poolOne pool that you pin. The bot checks it on chain before it trades.

The bot compares the pools' quotes on every trade, buys and sells alike. A pool whose hook the bots do not support is skipped.

In JSON, the chosen token is entry.target:

{
  "schema": 1,
  "name": "DCA",
  "entry": {
    "trigger": { "on": "timer", "every_s": 21600 },
    "target": { "token": "0x117cc2133c37b721f49de2a7a74833232b3b4c0c" },
    "buy_eth": 0.01
  },
  "exits": [],
  "limits": { "once_per_token": false, "max_open": 1, "add_to_position": true }
}

target.venue is "up" or "uniswap", to keep to one venue. target.pool pins one pool: a pool's address, or a Uniswap V4 pool id. A pinned pool needs its venue.

When every buy buys the same token, Once per token must be off ("once_per_token": false). The editor turns it off for you.

A token an AI step names

Give an AI step a field that holds A token's address, to buy (or none found). Then choose it in The token to buy, for example "The token the step "news" names". In JSON, the target is the step's answer by name:

{ "token": "{{news.token}}" }

The bot buys the token where it trades, once it is named: on its launchpad for a Pons or Torch token, else in the best pool on UP or Uniswap. If no token is named, or no market is found within a minute, nothing is bought. Rules can check the token's own values (its liquidity, its buy tax, its buyers) before it buys. With Once per token on, a token is bought at most once. A named token cannot pin a pool.

AI steps outside a token launch need an Epic Spinner. Read AI steps.

A token your service sends

With a webhook trigger, declare a field of the token type. Then choose "The token your service sends" in The token to buy. In JSON, the target is {"token": "{{hook.<field>}}"}. As with a named token, if no market is found within a minute, nothing is bought. Read webhooks.

How much the bot buys

Set the amount in Buy, in ETH. In JSON, it is entry.buy_eth: more than 0, and at most 100.

The 0.5% bot fee is taken from each trade, each way. The live trading limits on the Wallet tab include the fee. Read live trading.

Slippage

Set Slippage in percent. The buy reverts if it would get this much less than the quoted amount. In JSON, it is entry.max_slippage_pct: from 0.1 to 50, and 10 by default.

Sells have their own slippage, Exit slippage, in the limits. Read limits.

Prices per whole token

token.price in a rule is a price in wei per the token's smallest unit. For a token with 18 decimals, such as every Pons token, that is ETH per whole token.

The editor shows prices in ETH per whole token when it knows the token's decimals. For a chosen token, it says so under the token: "Prices in rules are ETH per whole" and the token's symbol. For a token with other decimals, the JSON keeps wei per its smallest unit. That number is ETH per whole token times 10 to the power of (18 minus the token's decimals). For a token that is not on the list, the editor does not know its decimals, so prices in the workflow are wei per its smallest unit too.

On this page