InitialEmaPriceHalvingPeriod

Constant v252 → current u64

Controls price smoothing decay.

Current Value

201600
Relevant for: stakersanalyticsdevelopers

The Big Picture

Price feeds use exponential moving averages (EMA) to smooth volatility. This constant sets the halving period - how long it takes for a price change to decay to half its impact. Longer periods = smoother, slower-updating prices; shorter periods = responsive but volatile.

Why This Matters

EMA price affects any operation using reference prices (burns, swaps, etc.). Know that prices you see are smoothed, not instantaneous. Large price moves take time to fully reflect.

Example

With EmaPriceHalvingPeriod of 7200 blocks (~24 hours), a sudden 10% price spike takes 24 hours to be 50% reflected in EMA, 48 hours to be 75% reflected. This prevents flash crash exploitation but means prices lag reality.

Common Questions

Which operations use EMA price?
Burn calculations, some swap pricing, and reference rate feeds. Check specific operation documentation.
Can I see both spot and EMA prices?
Query relevant storage for current EMA. Spot prices require external data sources. Compare both for trading decisions.

From Chain Metadata

Initial EMA price halving period

Use Cases

  • Price calculations
  • EMA

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query InitialEmaPriceHalvingPeriod constant
const value = api.consts[stringCamelCase("SubtensorModule")][stringCamelCase("InitialEmaPriceHalvingPeriod")];
console.log("InitialEmaPriceHalvingPeriod:", value.toHuman());

// Convert RAO to TAO if this is a balance value
const taoValue = value.toBigInt() / BigInt(1e9);
console.log("TAO:", taoValue.toString());

Type Information

Type
u64
Byte Size
8 bytes
Encoding
fixed
Raw Hex
0x8013030000000000

Runtime Info

Pallet
SubtensorModule
First Version
v252
Latest Version
v252
Current Runtime
v393