Skip to content

pool ​

The subnet's AMM pool at the current block: price, reserves and what a trade of a given size would do.

NameDescription
pool.price()Pool price, TAO per alpha: the current block's in precise and live runs; the bar's close inside event.onCandle in quick backtests.
pool.movingPrice()The protocol's moving (smoothed) price at the current block or bar.
pool.reserves()Pool reserves at the current block or bar.
pool.impact()fraction of price impact for buying tao TAO at current reserves
pool.quoteBuy()What buying with tao TAO (fee included) would return at the current reserves.
pool.quoteSell()What selling alpha would return at the current reserves, after the fee.
pool.capacity()largest TAO size whose impact stays within maxImpact (fraction)

pool.price() ​

ts
pool.price(): Price

Pool price, TAO per alpha: the current block's in precise and live runs; the bar's close inside event.onCandle in quick backtests.

Types: Price

pool.movingPrice() ​

ts
pool.movingPrice(): Price

The protocol's moving (smoothed) price at the current block or bar.

Types: Price

pool.reserves() ​

ts
pool.reserves(): Reserves

Pool reserves at the current block or bar.

Types: Reserves

pool.impact() ​

ts
pool.impact(tao: number): number

fraction of price impact for buying tao TAO at current reserves

pool.quoteBuy() ​

ts
pool.quoteBuy(tao: number): Quote

What buying with tao TAO (fee included) would return at the current reserves.

Types: Quote

pool.quoteSell() ​

ts
pool.quoteSell(alpha: number): Quote

What selling alpha would return at the current reserves, after the fee.

Types: Quote

pool.capacity() ​

ts
pool.capacity(maxImpact: number): number

largest TAO size whose impact stays within maxImpact (fraction)

Types ​

Reserves ​

Pool reserves.

FieldTypeDescription
taoInnumberTAO in the pool
alphaInnumberalpha in the pool
alphaOutnumberalpha outstanding (staked outside the pool)

Quote ​

What a trade would do at the current reserves (pool.quoteBuy() / pool.quoteSell()).

FieldTypeDescription
alpha?numberamount received: alpha for a buy, tao (after the fee) for a sell
tao?number
pricePriceaverage price of the trade, fee excluded
impactnumberfraction, e.g. 0.005 = 0.5 %
feenumberfee in TAO

AlphaScript language v0.1 · runtime 0.2.0