> ## 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.

# Risk Curves

**Example Three:** Mixed curve with inventory curve logic

Let’s take the same curve as before and add an inventory skew curve to this 5 point mixed curve.

Risk curves have three input values:

* **Base/Quote Amount**: Quantum of inventory. This can be expressed in two ways
  * Base/Quote Percentage: This is the relative percentage between Base and Quote amounts, normalized by your mid-price. (basePct + quotePct = 1)
  * Base/Quote Amount: This is an absolute amount of tokens expressed as atoms
* **Price Factor**: Basis points added to the swap based on the value of inventory
* **Interpolation**: Shape of the curve between two base/quote points

```typescript theme={null}
// `pool` is a loaded Hadron instance; `authority` is the pool authority (see SDK ▸ Quickstart)
// 5 point ask curve with a midprice of 1.00
// Points: Input Amount 0 (base), 1000, 2000, 5000, 10000 units
// Spread of 10, 20, 50, 100, 150 Bps from Mid
// Mixed Interpolation across points
// Initialize risk curve below yellow line

// Same curve as previous example
const askCurveIx = pool.setCurve(authority, {
    side: Side.Ask,
    defaultInterpolation: Interpolation.Linear,
    points: [
        { amountIn: 0n,     priceFactor: 1.0010, interpolation: Interpolation.Step },   // 10bps
        { amountIn: 1000n,  priceFactor: 1.0020, interpolation: Interpolation.Linear }, // 20bps
        { amountIn: 2000n,  priceFactor: 1.0050, interpolation: Interpolation.Linear }, // 50bps
        { amountIn: 5000n,  priceFactor: 1.0100, interpolation: Interpolation.Step },   // 100bps
        { amountIn: 10000n, priceFactor: 1.0150, interpolation: Interpolation.Step },   // 150bps
    ],
});
// --------------------------------------------------------------------------- //

// Risk (inventory) curve uses percent-of-vault on the x-axis (pctBase: 0.0–1.0).
// setRiskCurveBoth returns [bidIx, askIx].
const [riskBidIx, riskAskIx] = pool.setRiskCurveBoth(authority, {
  bid: {
    defaultInterpolation: Interpolation.Linear,
    points: [
      { pctBase: 0.0,  priceFactor: 1.0050 },
      { pctBase: 0.25, priceFactor: 1.0025 },
      { pctBase: 0.50, priceFactor: 1.0000 }, // optional
      { pctBase: 0.75, priceFactor: 0.9975 },
      { pctBase: 1.0,  priceFactor: 0.9900 },
    ],
  },
  ask: {
    defaultInterpolation: Interpolation.Linear,
    points: [
      { pctBase: 0.0,  priceFactor: 0.9900 },
      { pctBase: 0.25, priceFactor: 0.9975 },
      { pctBase: 0.50, priceFactor: 1.0000 }, // optional
      { pctBase: 0.75, priceFactor: 1.0025 },
      { pctBase: 1.0,  priceFactor: 1.0050 },
    ],
  },
});
```

Let's now visualize these curves - **try dragging the inventory slider**:

<iframe src="https://hadron.fi/linear-risk-curve-sol-usdc--depth-animation.html" title="Linear risk curve SOL-USDC depth animation" width="100%" height="700" frameborder="0" />
