---
name: rekt-knockout
description: Trade and build on Rekt Knockout, a leveraged barrier product on Solana. Use when asked to quote, open, add to, close or settle a Knockout position, to read positions or queued claims, to handle a refusal, or to write a bot, keeper or interface with the @rekt/1000x SDK.
metadata:
  version: "1.0"
---

# Rekt Knockout

Rekt Knockout is a leveraged product on Solana with two hard limits: a **barrier** that ends a position
if the price reaches it, and a **target** (rung) that sets a gross gain of a multiple of the stake, before the exit fee and the
share of the gain the terms withhold. The most a trader can lose is the stake. There is no margin call, no funding and no partial liquidation.

Docs: https://rekt.mintlify.app. This file is the short version for an agent. The page for each topic
is linked under "Where to read more".

Values below are as of 2026-10-18; they can change. Read the live value from the chain.

## Rules that hold for every action

1. **Ask before you spend.** State the stake and the barrier line to the person: at the barrier they
   receive nothing.
2. **Simulate first.** A dry run costs nothing. Send only when the person says so.
3. **Never cache governed state.** Read the config, vault and market from the chain on every request.
4. **Money is `bigint` in USDC base units** (six decimals). `1_000_000n` is one dollar. Parse text with
   `parseUsdc`, never through a float.
5. **A position is named by `seq`.** A slot index is not a handle, because slots are reused.
6. **Keep keys and RPC endpoints out of prompts, logs and commits.** Use environment variable names.
7. **State facts, not forecasts.** Report what a trade costs and what it paid. Do not state or imply
   a chance of winning.

## Limits and hours (as of 2026-10-18; they can change)

| | |
| --- | --- |
| Stake | $0.20 to $1,000 for one position |
| Leverage | 1000x on every market |
| Target (rung) | at least 2.00x the stake (`rung_bps` 20_000), up to the payout cap |
| Open fee | none |
| Close fee | on the exit value: 5 % on a win, 10 % on a loss, a rate between the two within 1 bp of the entry price. A knockout has no fee |
| Share of a gain kept | the terms withhold part of a gain: the trader keeps 63 % at a move of 1 bp or less, rising to 87 % at 10 bp or more. A $1.00 stake that reaches a 2.00x target is paid $1.7765: $1.00 gross gain, $0.87 kept, $1.87 exit value, $0.0935 exit fee |
| Timer | optional; 26 seconds or more |
| Minimum hold | no close request in the first 6 slots after the entry |
| Tenor | none. A position ends at its barrier, its target, a close, or its own timer. Gold positions end before the session closes |
| No price for 24 hours | anyone can close any position on that market; each gets its stake back (`provePrice` posts a signed price and resets the clock) |
| Markets | BTC, ETH, SOL, XRP: always open. Gold (XAU/USD): Sunday 23:00 to Friday 21:00 UTC, closed 21:00 to 23:00 each day |

A market is in one of four states: open, closing soon, closed or halted. Branch on the state
(`availability()`), never on one boolean.

## Quote

An `open`, an `add_collateral` and a `request_close` carry **no price**. The price comes later, from the
venue. So "quote" means "price the terms before you send":

```ts
const size = sizeForTotal(budget, config.params);              // budget -> stake
const preview = openPreview(config, market, size.collateral, 20_000, nowUnix);
// preview.totalDebit, preview.barrierPayout (always show it)
// preview.maxPayout is the gross figure, before the exit fee and the share of the gain the terms withhold
```

A **signed price quote** is needed only by instructions that read a price: `settle`, `stamp_book` and
`set_take_profit`. Get one from the price service, from a server (it sends no CORS headers):

```sh
curl -s https://prices.rekt.trading/v1/quote \
  -H 'content-type: application/json' \
  -d '{"feed":"BTC/USD","idempotency_key":"'"$(openssl rand -hex 16)"'"}'
```

Use a new `idempotency_key` for each attempt. A quote ages out in slots, so fetch it just before you
sign. `GET /v1/feeds` lists the feeds. On a refusal: `409` and `429` retry after `retry_after_ms`;
`400` and `422` mean fix the request. Read [Getting prices](https://rekt.mintlify.app/sdk/prices).

## Open

An open is an **order**. The stake is taken when it lands and the venue's next price after a short
delay fills it. If no price comes in time, the order is returned and the whole stake comes back.

1. Read the protocol, then `sizeForTotal` and `openPreview`.
2. Build: `ix.open(accounts, args, priceAccountsFor(market, config, 'open'))`. Set `min_collateral_out`
   to `size.collateral`, never to `1n`. A first trade also needs `ix.initTraderAccount` in the same
   transaction.
3. Simulate, then send. Read the `seq` from the landed transaction with `landedOpenedSeq`.
4. Wait for the fill: the position's `entryPrice` is 0 until a filler writes it. The events are
   `EntryFilled` and `OpenVoided`.

The entry is the next price, not the price on the screen at the tap.

## Add

`addCollateralForMode` adds stake to a live position. It is an order too, priced at the next price, and
it is returned in full if the position is already at its barrier or target.

Adding while the position is **ahead** moves the barrier toward the price. It is not a defence. Say so
before you offer it. Events: `CollateralCommitted`, then `CollateralAdded` or `AddReversed`.

## Close

A close is a request that carries no price: `ix.requestClose({ authority, config, market, positions,
delegate: null }, seq)`. It cannot be withdrawn. Ask only from `closableFromSlotOf(position, config,
market)`. The exit price is the first price after a short delay, and **the close price is not locked**
until `SettlementPriced` lands.

## Settle

Anyone may settle a close, and the venue's keepers do. You need to settle only if you run a keeper.
The settle carries a window quote: ask for the first quote at or after the window's start with
`min_slot` and `payload_version: 2`, then send with `submitBenchmarkQuoted`. Nobody is paid for
settling. Read [Settling](https://rekt.mintlify.app/sdk/settling).

## Read positions and queued claims

```ts
const book = decodeTraderAccount(bytes);        // bytes of traderPda(owner)
const held = heldPositions(ownerHex, book);     // { ref: { trader, slot, seq }, position }
phase(position, nowSlot);                       // PendingOpen, a live phase, ExitRequested, ...
```

History: `readTradeHistory`, or `https://data.rekt.trading/v0/trades?owner=<address>` for the last 48
hours.

**A win is paid in full, and part of it may be paid later.** Your stake comes back at once and the
profit is paid from the pool's free cash. What the pool cannot pay yet joins a first-in, first-out
queue, with no guaranteed time. `SettlementPriced.trader` is only what was paid now. Read the queue:

```ts
const cap = decodeCapitalState(capitalBytes);   // account at capitalPda()
const queue = decodeQueue(queueBytes);          // account at queuePda()
queuePosition(toHex(bookAddress), cap, queue);  // amount ahead, funded, delivered, age. No forecast
```

Show the amount paid now, the amount queued, the amount ahead and the age. Never show an estimate of
the wait. Anyone can deliver funded queue money with `payQueue`.

## Handle a refusal

```ts
const refusal = errorForCode(programErrorCode(err) ?? -1);   // name, code, cause, fix, retryable
```

| `retryable` | Do |
| --- | --- |
| `never` | Fix the request. A retry is a loop. |
| `after-state-changes` | Wait for the world to move, then ask again. Back off. |
| `after-governance` | Stop. Only a change by the venue's authority clears it. Tell the person. |
| `immediately` | Retry on the next slot. These are almost all price freshness. |

For the order-and-close codes (6203 to 6238) use `retryClassOf(code)`. It says "done", "send the other
instruction" or "retry with the right quote".

- A **returned order** or **returned add** is not an error. The stake came back.
- `OracleFrozen` and `SettlesDisabled` stop closes. Read `config.oracleFrozen` and
  `config.settlesDisabled`. Do not retry in a loop.
- `MarketClosed`, `SessionEndsBeforeTenor` and `InsideEventWindow` are the market's calendar.
- `SideStakeCapReached` means a market's limit on one side's stake is set and that side is full. It clears
  as other positions close. Back off.
- After a timeout, never sign a second order for the same intent inside one blockhash life. Send the
  same signed bytes again.

## Never

- Never present a price from the screen as the entry or the exit.
- Never tell a trader they keep part of the stake at the barrier.
- Never present `SettlementPriced.trader` as the amount won. A part may be queued.
- Never hand-compute the barrier, the fees or the payout. Use `openPreview`, `settlePreview` and
  `closePreview`, and pass `settlePreview` the market's fee-terms account for a position with a
  fee-terms slot.
- Never route around a refusal.

## Where to read more

- Quickstart, a working bot: https://rekt.mintlify.app/sdk/quickstart
- Fees and limits: https://rekt.mintlify.app/limits
- Orders and closes: https://rekt.mintlify.app/sdk/orders
- Error handling: https://rekt.mintlify.app/sdk/errors
- Building an agent: https://rekt.mintlify.app/sdk/agents
- The docs as an MCP server: https://rekt.mintlify.app/mcp
- Questions: support@asymmetra.xyz
