Skip to main content
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”.
// 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 = buildSetCurveInstruction(
    HADRON_PROGRAM_ID,
    authority.publicKey,
    configPda,
    "ask",
    [
        { xIn: 0n,     priceFactor: 1.0010, interpolation: "step" },          // 10bps
        { xIn: 1000n,  priceFactor: 1.0020, interpolation: "linear" },        // 20bps
        { xIn: 2000n,  priceFactor: 1.0050, interpolation: "linear" },        // 50bps
        { xIn: 5000n,  priceFactor: 1.0100, interpolation: "step" },  		  // 100bps
        { xIn: 10000n, priceFactor: 1.0150, interpolation: "step" },          // 150bps
    ]
);

Curve Visualization:

Mixed Interpolation This is a mixed curve with no inventory skew logic