Examples
Mixed Interpolation
Points can be connected with any interpolation method, allowing you to create nearly any quoting function.
In this example, we will look at a mixed interpolation curve. Here, we define a curve with “step” and “linear”.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
// `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
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
],
});