> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rekt.money/llms.txt
> Use this file to discover all available pages before exploring further.

# The venue

> What the Knockout program does: admission and the queue, the pricing path, the limits on loss and payout, settlement, size and fees, and where each one is read on chain.

Everything on this page is a rule or a value of the program on Solana mainnet. It is early,
unaudited software: read [Risk](https://docs.rekt.money/risk.md) before you trade.

## Three bounds, fixed at open

* **Loss is bounded.** The most you can lose is your stake. There is no margin call, no negative
  balance and no clawback.
* **Payout is bounded.** A target cannot exceed a multiple of the stake, `config.params.payoutCapMultiple`.
  How a win is paid is under [admission and the queue](#admission-and-the-queue).
* **Time is fixed at open.** The tenor is read from `config.params.tMaxSeconds` and frozen onto the
  position. It is the indefinite value, so a position has no protocol clock: it ends at its barrier,
  its target, a close, its own timer, or the no-price close. The funding rate is 0, and a position
  keeps the rate it opened with.

## Admission and the queue

Opening a position takes your stake and nothing else. The program decides whether the position fits
when the venue fills the order, against a rule it applies per market and in total. An order that does
not fit is returned: your whole stake comes back and no fee is charged. A hedge, a smaller target and
a close are never refused by this rule.

At a close, your stake comes back at once and the profit is paid from the pool's free cash. **A win is
paid in full. Part of it may be paid later, in order. There is no guaranteed time. The amount queued
ahead of you is shown.** What the pool cannot pay yet joins a queue, first in, first out, and it is
funded by cash that other positions leave in the pool. Anyone may send the instruction that delivers
funded queue money (`pay_queue`); it goes to the wallet recorded on the account. When the line is
nearly full, a second unpaid win of the same account waits behind its first. The settlement events say
how much was paid now and how much was queued. The program has no auto-deleveraging, no socialised
loss and no write-down of an amount owed: it is paid in full or stays owed. A payout that cannot be
delivered is held for its trader, and it is released to the pool if nobody claims it within
`config.params.unclaimedPayoutExpiryS`.

The program has no instruction to deposit into the pool or to redeem from it; see
[the liquidity pool](https://docs.rekt.money/liquidity.md).

## The pricing path

Your entry is the first price of the venue's price feed at or after your order's target slot, a short
delay after the order lands. It is a signed quote, and the program verifies it when the filler writes
it. The function that prices an order takes the market and the quote and never the stake, so every
size fills at the same price.

An order is returned when its price does not clear one of these:

* **Time.** It comes within a governed number of slots after the target, and a filler writes it inside
  the fill window.
* **Signatures.** At least `market.minSignatures` distinct keys that the program recognises.
* **Quality.** It meets the venue's quality rule for an entry.

See [orders and closes](https://docs.rekt.money/sdk/orders.md) for the rules and [Risk](https://docs.rekt.money/risk.md) for what they do not cover.

## The barrier

At 1000x the barrier sits a very small distance from the entry. A move too small to see on a chart
can knock the position out. Barrier and take profit are both distances from the entry, so the 1000x
sets how fast a position ends.

## Settlement

Settlement is permissionless for every outcome that has evidence behind it: the barrier touched, the
target reached, the position's own timer run out, and a finite protocol tenor expired. Any address may send
that transaction, and the money goes to the owner's account whoever sent it. Every priced close carries
a signed quote from the venue's price feed.

If no quote can be obtained for a long time, a no-price close (`lastResort`) applies: it pays a live position its stake back
with the exit fee waived, and a position already stamped at a level is paid that level (a target level pays the exit fee). It is refused while the oracle is frozen. On a market with trading hours, a position that is
not settled before its session's close ends at par.

A voluntary close needs the owner's authority: a signature, or a session key the owner authorised. The
settle that completes it can be sent by anybody, at the first price after a short delay from the
request.

> [!WARNING]
>
> **Two switches can stop closes, and neither can be lifted by the key that sets it.** The guardian can
> freeze the oracle, which refuses opens and leaves every priced close without a price. It can also
> disable settles, which refuses every close. Only the config authority lifts either. Read
> `config.oracleFrozen` and `config.settlesDisabled`.

## What you sign on an open

You sign a total budget, and the venue takes its fee from inside it, so the debit is at most that
number. You also sign `min_collateral_out`, the smallest position you accept for that budget. The
position the budget buys is computed from the live parameters in the slot where the transaction
executes. If a governance change in between would buy a smaller position, the transaction refuses.
A `min_collateral_out` of zero is refused (`MinCollateralOutRequired`).

The terms are fixed when the order lands. The entry is not: it is set by the next price. The barrier and
the target are distances from that entry, so their prices exist once the order is filled. Every number
below is computed from the live parameters for the exact terms you are about to open:

```ts theme={"dark"}
import { openPreview, type ConfigView, type MarketView } from '@rekt-trading/1000x';

export function quote(config: ConfigView, market: MarketView, nowUnix: bigint) {
  // The fourth argument is the optional target in basis points of stake: 20_000 is 2.00x, the floor.
  const preview = openPreview(config, market, 1_000_000n, 20_000, nowUnix);
  return {
    // What you transfer, and what the fee inside it is.
    totalDebit: preview.totalDebit,
    entryFee: preview.entryFee,
    // The gross payout at the target, before the exit fee and the share of the gain the terms withhold.
    maxPayout: preview.maxPayout,
    // What the trader receives at the barrier.
    barrierPayout: preview.barrierPayout,
  };
}
```

An interface shows `barrierPayout` on the same screen as the open button.

## Size, cap and stake

BTC, ETH, SOL, XRP and HYPE are listed at a tier of **1000x**. The protocol's payout cap is
`config.params.payoutCapMultiple`. See [markets](https://docs.rekt.money/markets.md).

* **The 1000x decides the distance** the price has to move, in either direction, before the position
  ends. It sets the time scale of the position.
* **The payout cap decides the ceiling.** A target above it is refused, and a position with no target
  of its own has the cap as its target.

Every market is 1000x. The market's tier (`market.tier`) is a ceiling and the venue's
`config.minTier` is a floor, so every position opens at 1000x. A request above the ceiling or below the
floor is refused. Stakes run between `minCollateral` and `maxCollateral`. Each of these is a governed
field: read it from the chain. [Fees and limits](https://docs.rekt.money/limits.md) has the values, with the date they were read.

## Fees

There is an entry fee (read `config.params.entryFeeBps`; it is 0, so an open is free), a loss tax on
a close at a loss, an exit fee on most closes (not on one paid at the barrier, nor on a
no-price close that returns the stake of a live position), and funding, which is a governed rate
(`borrowRateBpsPerHour`) that is 0. The loss tax is a share of the loss, taken before the exit fee
([how a loss is calculated](https://docs.rekt.money/limits.md#how-a-loss-is-calculated)). The exit fee is a share of the exit
value: a lower rate on a win and a higher rate on a loss. On a gain the terms also withhold part of the gain: the share you keep rises with the size of the
move, so a target pays less than its multiple. [Fees and limits](https://docs.rekt.money/limits.md#how-a-win-is-calculated) has
the values, dated, and a worked example. Every rate is written on chain, and the ones that apply to a position are
frozen onto it at open. A returned order or add returns the whole stake.
[How it works](https://docs.rekt.money/how-it-works.md#the-fees) has each fee, where it is read from and where it goes, and
[Fees and limits](https://docs.rekt.money/limits.md) has the rates.

A wallet linked to a referrer pays a lower exit fee, and the referrer is credited a share of the
protocol's part of that wallet's trades. [Referrals](https://docs.rekt.money/referrals.md) has the rules.

## What the product does not do

* **It is not a hedge.** A knockout ends the position at the moment a hedge would be needed.
* **It does not fill at the price on your screen.** Entry and exit are the venue's next prices after a
  short delay. A close you ask for cannot be withdrawn, and its price is not locked until it settles.
* **It does not roll over.** A position ends by its own rules.
* **Adding to a position does not defend it.** Adding while ahead moves the barrier toward the price.
  See [adding to a position](https://docs.rekt.money/how-it-works.md#adding-to-a-position).

## Read it on chain

| Item | Where it lives on chain |
| - | - |
| What the stakes hold | `vault.totalReserved` and the position's `collateral` on its book |
| The queue: what is owed and what is funded | the pool's capital and queue accounts (`capitalPda()`, `queuePda()`); the `SettlementQueued` and `QueuePaid` events |
| The entry price | the `EntryFilled` event, and the position's `entryPrice` once the order is filled |
| The maximum loss | the position's `collateral` |
| The 1000x tier and payout ceiling | `market.tier` and `config.params.payoutCapMultiple` |
| The funding rate | `config.params.borrowRateBpsPerHour` |
| Whether closes can be stopped | `config.oracleFrozen` and `config.settlesDisabled` |
| Everything a trade must clear | [the gate list](https://docs.rekt.money/sdk/gates.md), each with the error it raises |

```
solana account <CONFIG_PDA> --url "$SOLANA_RPC_URL"        # every fee, bound and cap in force
solana account <VAULT_PDA>  --url "$SOLANA_RPC_URL"        # pool assets, the stakes held
solana program show <PROGRAM_ID> --url "$SOLANA_RPC_URL"   # who can upgrade the program
```

The SDK exports `PROGRAM_ID`, and `configPda()` and `vaultPda()` derive the two addresses. The SDK
decodes the accounts and events, and the package carries the program's IDL. For integration
questions, write to [support@asymmetra.xyz](mailto:support@asymmetra.xyz).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.