AlcorDocs

Expanding Price Availability with RAM Purchase

Pay for RAM to make a pool keep more oracle observations.

A pool keeps only as many observations as its maxObservationNum (in the pool's row of the pools table, under currSlot). A new pool keeps one. Anyone can raise this number by paying for the RAM the extra observations need.

How many observations you need

Each observation takes 160 bytes of RAM. At most one observation is written per second, and only when the price tick or the in-range liquidity changes. So N observations always cover at least the last N seconds of trading, and usually much more in quiet pools.

To be sure of a full window regardless of activity, buy one observation per second of the window:

RAM (bytes) = window in seconds × 160

30 minutes: 1,800 × 160 = 288,000 bytes ≈ 288 KB
3 hours:   10,800 × 160 = 1,728,000 bytes ≈ 1.7 MB

Multiply by the current RAM price of the chain to get the cost. RAM prices change, so check them before you send.

Buying observations

Transfer the chain's core token (for example WAX on WAX) to swap.alcor with the memo:

addoraclerow#<poolId>

The pool must be active. The contract buys RAM with the whole amount, divides the bytes it received by 160, adds that many observations to the pool's maxObservationNum and logs the result with a logaddoracle action (poolId, payer, rows). The RAM purchase includes the chain's RAM fee.

Check the pool's maxObservationNum, or the logaddoracle action in your transaction, to see how many observations you added. New slots fill up as trading continues. Until they do, the history covers only the time since you bought them.

On this page