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
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 | key1 | u16 | key1 (u16) |
Stored Value
value (FixedI128)
Relationships
Modified By
Related Events
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 SubnetMovingPrice storage
const key1 = 0;
const result = await api.query
[stringCamelCase("SubtensorModule")]
[stringCamelCase("SubnetMovingPrice")](
key1
);
console.log("SubnetMovingPrice:", result.toHuman());On-Chain Activity
1M–10M estimated writes
#23 most written storage item
Modified via user-submitted extrinsics
As of block 7,429,232
Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v233
- Current Version
- v393