API Reference

Currently, we only need to query the pool price, and calling the price query method is relatively simple.

It should be noted that the value of "index" must be correctly set.

When index = 1

The "currentPrice" in the return value is the latest price, and this value is independent of the value of index.

The "nextPrice" in the return value is the price of the next NFT, which will change with the index according to the models.

Here is a specific example in JavaScript:

// To read the price from a linear "buy" pool, you only need to call the following code:
const spotPrice = 1;
const delta = 0.1;
const fee = 0.003;
const pfee = 0.003;
const gfee = 0;
const index = 1;
const price = mathLib.Linear.buy(spotPrice, delta, fee, pfee, gfee, index,'read');

// Return value
{
  priceData: {
    delta: 0.1,
    spotPrice: 1,
    userSellPrice: 0.994,   -- the price a user would receive when selling an NFT
    poolBuyPrice: 0.997,      -- the price a user would need to pay to buy an NFT from the pool
    poolBuyPriceFee: 0.003,
    userSellPriceFee: 0.006
  },
  currentPrice: { userSellPrice: 0.994 },   -- the current price
  nextPrice: { userSellPrice: 0.8945999999999998 }  -- the price of the next NFT
}