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
| # | Name | Type | Description |
|---|---|---|---|
| 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 bigintRelationships
Modified By
Related Events
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
1M–10M estimated writes
#23 most written storage item
Modified via user-submitted extrinsics
As of block 7,429,232
Version History
Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v233
- Current Version
- v411