Skip to main content

CloberPriceBook

CloberPriceBook​

maxPriceIndex​

function maxPriceIndex() external view returns (uint16)

Returns the biggest price book index supported.

Return Values​

NameTypeDescription
[0]uint16The biggest price book index supported.

priceUpperBound​

function priceUpperBound() external view returns (uint256)

Returns the upper bound of prices supported.

The price upper bound can be greater than indexToPrice(maxPriceIndex()).

Return Values​

NameTypeDescription
[0]uint256The the upper bound of prices supported.

indexToPrice​

function indexToPrice(uint16 priceIndex) external view returns (uint256)

Converts the price index into the actual price.

Parameters​

NameTypeDescription
priceIndexuint16The price book index.

Return Values​

NameTypeDescription
[0]uint256price The actual price.

priceToIndex​

function priceToIndex(uint256 price, bool roundingUp) external view returns (uint16 index, uint256 correctedPrice)

Returns the price book index closest to the provided price.

Parameters​

NameTypeDescription
priceuint256Provided price.
roundingUpboolDetermines whether to round up or down.

Return Values​

NameTypeDescription
indexuint16The price book index.
correctedPriceuint256The actual price for the price book index.