Trade
POST https://rh-lightspeed.shrine.trade/api/lightspeed, with the API key from your account.
- JavaScript
- Python
- curl
const res = await fetch("https://rh-lightspeed.shrine.trade/api/lightspeed", {
method: "POST",
headers: { "content-type": "application/json", "x-api-key": process.env.LS_KEY },
body: JSON.stringify({
action: "buy", // "buy" or "sell"
token: "0xTHE_TOKEN",
amount: 0.01, // ETH on a buy; tokens or "100%" on a sell
slippage: 10, // percent; a fresh launch wants room
}),
});
const r = await res.json();
console.log(r.success, r.hash, r.quote?.expectedOutFormatted, r.sendMs);
import os, requests
r = requests.post(
"https://rh-lightspeed.shrine.trade/api/lightspeed",
headers={"x-api-key": os.environ["LS_KEY"]},
json={"action": "buy", "token": "0xTHE_TOKEN", "amount": 0.01, "slippage": 10},
).json()
print(r["success"], r["hash"], r.get("quote", {}).get("expectedOutFormatted"), r["sendMs"])
curl -X POST https://rh-lightspeed.shrine.trade/api/lightspeed \
-H "content-type: application/json" -H "x-api-key: ls_…" \
-d '{ "action": "buy", "token": "0xTHE_TOKEN", "amount": 0.01, "slippage": 10 }'
Request
| Field | ||
|---|---|---|
apiKey | string | Or the x-api-key header. |
action | "buy" | "sell" | |
token | string | Token address. |
amount | number | string | ETH on a buy, whatever the token is priced in. Tokens, or "100%" / "50%" of the balance, on a sell. |
slippage | number | Percent. Default 5. |
toEth | boolean | Sells of a token priced in an asset (USDG, NVDA, ORBIO …): take the proceeds in ETH (default true) or keep the asset (false). |
wait | boolean | Default false: the answer comes as soon as Robinhood accepted. true waits up to 20 s for the receipt and adds status, blockNumber and gasUsed. |
Response
{
"success": true,
"hash": "0x…",
"explorer": "https://robinscan.io/tx/0x…",
"wallet": "0x9985…a92f",
"engine": "local",
"buildMs": 0.9,
"sendMs": 11.4,
"txs": [
{ "description": "buy", "hash": "0x…", "nonce": 7, "signUs": 180,
"submissions": [ { "address": "203.0.113.7", "accepted": true, "ms": 11.2 } ] }
],
"protocol": "PONS_V2", "venue": "pons_curve", "phase": "NotGraduated",
"token": "0x…", "name": "…", "symbol": "…", "curve": "0x…",
"quoteAsset": { "address": "ETH", "symbol": "ETH", "decimals": 18, "isNative": true },
"action": "buy",
"ethIn": "10000000000000000", "ethInFormatted": "0.01",
"amountIn": "9925000000000000", "amountInFormatted": "0.009925",
"quote": {
"expectedOut": "…", "expectedOutFormatted": "1250000.0", "minOut": "…",
"curveFeeBps": 100, "creatorTaxBps": 0, "snipeTaxBps": 0,
"lightspeedFeeBps": 75, "slippagePct": 10
}
}
success means Robinhood accepted every transaction of the trade; hash is the last one (a sell may be preceded by an approval, listed in txs). sendMs is from the request's arrival on our box to Robinhood's acceptance; signUs is the signing time in microseconds. amountIn is what reaches the venue after the Lightspeed fee, in the token's quote asset; on an asset-priced token route lists the hops the ETH took to get there. The quote is computed here from the curve's or pool's own math, and minOut is what the transaction enforces.
An accepted transaction can still revert on chain: the curve sold out in the same block, or the price moved past your slippage. Pass wait: true to learn that in the same request, or watch hash.
Venues
venue | Fee | |
|---|---|---|
pons_curve | the bonding curve, through the Lightspeed router | 0.75% in the quote asset |
uniswap_v4 | the Pons pool after graduation, through the Universal Router | 0.75% in the asset the trade settles in |
An asset-priced curve token (quoteAsset not ETH) is bought with ETH in one transaction: the router swaps the ETH into the asset over Uniswap and buys the curve with it. A sell goes the other way and comes back as ETH unless toEth is false. A token outside Pons v2 is built by the Buy & Sell API and sent from here ("engine": "builder", with builderReason); it may take more than one transaction.
Errors
| Status | error | |
|---|---|---|
| 401 | unauthorized | Missing or unknown API key. |
| 400 | invalid_action, invalid_token, invalid_amount, invalid_slippage | |
| 400 | insufficient_balance | The wallet holds fewer tokens than the sell asks for. |
| 400 | insufficient_funds | Robinhood refused: not enough ETH for the value plus gas. |
| 400 | unquotable | The amount is outside what the curve or pool can fill. |
| 409 | curve_closed | The curve sold out and is graduating; buys reopen in the pool. |
| 503 | warming_up, rpc | The box has no gas price yet, or a cold read failed. |
| 502 | other | Robinhood refused with message; txs shows each attempt. |
Fees
0.75% of the trade, taken inside the transaction, in the asset the trade settles in. Gas on Robinhood Chain is a few millionths of an ETH. See Fees.
Speed checklist
- Keep the wallet funded so no request waits on a deposit.
- Take
tokenfrom the stream: a launch event carries the predicted token address before the block exists, and the curve is quotable from its launch config. - Run your bot near our box (Chicago) or accept the network hop; our side adds about a millisecond.
- Give a fresh launch slippage room: the dev buy and the first snipes land in the same blocks as yours.