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

# How Hadron Prices a Trade

> The quoting equation, your curves, and fees

Every swap on a Hadron pool is priced from the oracle price and a spread you define:

```text theme={null}
spread = price_curve(input_amount)
       × inventory_curve(your_inventory)
       × base_spread

output_bid = input × spread × oracle_price
output_ask = input × spread / oracle_price
```

## The quoting equation

For an input of `amount_in`, the program computes:

```text theme={null}
fee    = amount_in × fee_ppm / 1,000,000
net_in = amount_in − fee

price     = price_curve(net_in)
inventory = inventory_curve(your_inventory)
spread    = min(price × inventory × base_spread,
                clamp)

out_bid = net_in × spread × oracle_price
out_ask = net_in × spread / oracle_price

then: triggers, min_out check, drawdown guard
```

You set everything except the fee: the oracle price, the base spread, both curves and the clamp.

* A final `spread` of `0.999` means 10 bps of spread around your oracle price, on both the bid and the ask.
* Oracle price is quote atoms per base atom in Q32.32, as are factors (`1.0 = 2^32`).
* The clamp caps the spread factor at `1.0` by default, so you never quote better than your oracle
  price. See [Risk controls](/makers/risk-controls.md).
* The fee, and any token transfer fee, comes off the input first. See [Fees](#fees).

## Your curves

Each side of the pool (bid and ask) has two curves you define:

* `price_curve(input_amount)` sets the factor by trade size, so larger trades can be priced wider.
* `inventory_curve(your_inventory)` sets the factor by your inventory, so your price skews as your
  position moves without you sending an update.

Each curve can be evaluated in two ways:

![The quoting equation: price\_curve is stateless or stateful, inventory\_curve is in % mode or integrated](https://mintcdn.com/hadron/trMXaWOWBf5Hut3y/images/curve-modes-light.svg?fit=max\&auto=format\&n=trMXaWOWBf5Hut3y\&q=85\&s=647f35589e10b40f0c196c419edcb682)

* **Stateless** (the default). Every trade reads the price curve from the start, so identical trades
  get identical prices.
* **Stateful** (integrated). Trades use up the curve like a book and pay the average across the depth
  they take, so a burst of orders walks down it. It refills at a rate you set, or when your crank
  refills it.
* **% mode.** The inventory axis is your share of value in base, as a %. This way you can set how
  your quotes skew at, for instance, an 80/20 imbalance.
* **Integrated.** The inventory axis is your token balance, and the factor is averaged over the
  inventory move the trade causes.

[Strategy examples](/examples/strategies.md) shows each one in action.

## Fees

Hadron charges a protocol fee in parts per million of the input. It's taken before pricing and sent
to the fee recipient.

Rates vary by asset type, and high-volume makers get rebates. Fee revenue on a pool can be split
between Hadron and you, or across several of your wallets or clients. Contact us for rates (see
[Fees](/fees.md)).


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