SubnetMovingPrice

Storage Map v233 → v411

Moving average price for subnet alpha .

Explore chain
Queried by: stakersvalidatorsanalyticsdeveloperswallets

The Big Picture

Spot prices (SubnetTAO/SubnetAlphaIn) can be volatile - a single large trade moves them significantly. SubnetMovingPrice provides a smoothed average that's less susceptible to manipulation or temporary fluctuations. This is used for more stable economic calculations throughout the protocol.

Why This Matters

Want a stable price reference for alpha? The spot rate changes with every trade. SubnetMovingPrice gives you a smoothed value that's better for valuations and less gameable.

Example Scenario

Query SubnetMovingPrice(netuid=1) returns the exponential moving average of alpha price in TAO. If spot rate is 0.001 TAO/alpha but moving price is 0.00095, there's recent upward pressure.

Common Questions

How is the moving average calculated?
Exponential moving average (EMA) - recent prices have more weight but historical prices still influence the value. The smoothing factor is a protocol parameter.
Which price should I use?
For immediate trades: spot price (SubnetTAO/SubnetAlphaIn). For valuations and analytics: moving price. For slippage-adjusted estimates: both.
Can this be manipulated?
Much harder than spot price. An attacker would need sustained trades over time to move the EMA significantly. Single trades have minimal impact.

Use Cases

  • Calculate stable alpha valuations for portfolios
  • Reduce noise from temporary price spikes
  • Build price charts showing smoothed trends
  • Anchor economic calculations to stable values
  • Compare moving price to spot price for trading signals

From Chain Metadata

MAP ( netuid ) --> moving_price | The subnet moving price.

Purpose & Usage

Purpose

Track smoothed alpha price over time - reduces volatility for economic calculations.

Common Query Patterns

  • Query by netuid for pricing
  • Compare with spot rate for volatility assessment
  • Use for smoothed valuation calculations

Query Keys

#NameTypeDescription
1
netuid
u16 netuid (u16, hashed key component)

Stored Value

moving_price (FixedI128)

Decoding the value

FixedI128 (Q64.64 signed fixed-point)

Signed Q64.64. Same divisor as FixedU128 but bits can be negative.

const fraction = Number(value as bigint) / 2 ** 64; // signed bigint

Relationships

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query SubnetMovingPrice storage
const netuid = 1;

const result = await api.query.SubtensorModule.SubnetMovingPrice.getValue(netuid);
console.log("SubnetMovingPrice:", result);

On-Chain Activity

Write Frequency
●●●●●○ High 1M–10M est. writes

1M–10M estimated writes

#23 most written storage item

Write Source User Extrinsics

Modified via user-submitted extrinsics

As of block 7,429,232

Version History

v233 block 4,920,350 Added
v235–v237 · runtime versions skipped on chain (never deployed)
v238 block 4,936,550 Internal re-bind
v266–v272 · runtime versions skipped on chain (never deployed)
v273 block 5,659,032 Internal re-bind
v278–v289 · runtime versions skipped on chain (never deployed)
v290 block 5,947,548 Internal re-bind
v307–v314 · runtime versions skipped on chain (never deployed)
v315 block 6,414,634 Internal re-bind
v316–v319 · runtime versions skipped on chain (never deployed)
v320 block 6,523,566 Internal re-bind
v327–v333 · runtime versions skipped on chain (never deployed)
v334 block 6,811,690 Internal re-bind
v353–v360 · runtime versions skipped on chain (never deployed)
v361 block 7,063,679 Internal re-bind
v386–v390 · runtime versions skipped on chain (never deployed)
v391 block 7,782,857 Internal re-bind
v394–v400 · runtime versions skipped on chain (never deployed)
v401 block 8,036,576 Internal re-bind Current

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v233
Current Version
v411