Strategies
Patterns that come up again and again, each as a small piece you can bolt onto the sniper or the copy trader. All of them trade through Lightspeed in the examples; the Local Trade API builds the same trades for your own key.
Exits
Every position needs three exits before it is opened: a target, a stop and a clock. Price comes from the pool's live trades:
socket.emit("subscribe_trades", { pool });
socket.on("trade", (t) => {
const x = t.price / entry;
if (x >= 2.0) sell("take profit");
if (x <= 0.6) sell("stop loss");
if (Date.now() - since > 120_000) sell("timer");
});
Two refinements that pay: a trailing stop that sells when price falls 25% from the high since entry, instead of a fixed stop; and scaling out, amount: "50%" at 2x and the rest at the trailing stop, so a runner is not sold whole at the first target.
Position sizing
Size by what you can lose, not by what you hope to win. A simple rule: risk 1% of the wallet per position, so with a 40% stop the size is 2.5% of the wallet. Cap the number of open positions, and halve the size after three stops in a row. Read the wallet with GET /api/lightspeed/account at startup and after every landed trade rather than keeping your own ledger.
Launch filters
The launch event tells you more than a name. Skip when mintAuthority or freezeAuthority is set, when tokenExtensions is not empty on a pump.fun coin, when initialBuy is missing or tiny, when the creator launched something in the last hour (keep a map of creators). Require that the uri answers and has an image. None of this is foolproof; together they remove most of the launches that go nowhere.
DCA into a position
Instead of one buy, several small ones a few seconds apart, so one bad fill does not set the entry:
for (let i = 0; i < 4; i++) {
await lightspeed({ action: "buy", mint, amount: 0.025, slippage: 10 });
await new Promise((r) => setTimeout(r, 3000));
}
The same loop with sell and a percentage scales out of a position over time.
Dip buying on candles
subscribe_ohlcv gives 1-second candles. A coin that is up a lot and prints a red candle of more than 15% while volume stays high is a dip in an uptrend; one whose volume collapses is a top. Keep the last 60 candles, compute the high, buy when the close is more than 20% off the high and the last three candles' volume is above the average, sell at the previous high.
Migration plays
A pump.fun coin that completes its curve moves to PumpSwap; the stream's migrate and createPool actions and subscribe_migrations tell you when. The first minutes on the new pool are volatile: one approach buys on the migration event and sells into the first spike; another waits for the first 20% pullback on the pool. Pass pool: "pumpswap" on the buy if the cache is a moment behind.
Following size, not names
The stream's breakdown shows every trader in a transaction. A buy above 5 SOL on a coin under a minute old is a signal on its own, whoever sent it. Count them per mint over a 10-second window; three large buys from different wallets is a stronger signal than one.
What not to do
- Do not chase with slippage. A buy that needs 40% slippage to land is a buy you should not make.
- Do not keep positions without exits because "it will come back".
- Do not run from a region 100 ms away and expect to be first; pick the nearest one, see Regions.
- Do not poll REST for prices; the streams exist so you never have to.