BasketDailyTurnoverCap

Storage Plain v464 → current

Capacity of each fund swap_basket turnover bucket as a u16-normalized share of NAV.

Explore chain
Queried by: validatorsdevelopersanalytics

The Big Picture

Read together with BasketTradeBucket, which holds each fund current allowance.

Why This Matters

A fund cannot be churned in one block; the most it can move is one capacity, and refilling that takes a day.

Example Scenario

NAV 1,000 TAO and cap 10%: the bucket holds up to 100 TAO of turnover and refills about 0.014 TAO per block.

Use Cases

  • Size a trade to fit the bucket
  • Measure how close funds run to the daily limit

From Chain Metadata

ITEM --> capacity of a fund's `swap_basket` turnover bucket as a u16-normalized share of the fund's NAV (`u16::MAX` = 100%). The bucket refills at `capacity / BASKET_TRADE_REFILL_BLOCKS` per block, so at most one capacity can be pushed through the fund at any instant and about one per day sustained. Each leg is also bounded to [`crate::BASKET_TRADE_MAX_SLIPPAGE_BPS`] of *both* the moving price and the spot price. Set via `AdminUtils::sudo_set_basket_daily_turnover_cap`.

Purpose & Usage

Purpose

Bounds how much of a fund can be turned over per day.

Common Query Patterns

  • Query with BasketTradeBucket to project how much a fund may trade now

Notes

  • First appears at runtime v464. Default u16::MAX / 10, so 10% of NAV (lib.rs DEFAULT_BASKET_DAILY_TURNOVER_CAP at v467).
  • The bucket refills at capacity / 7200 per block (BASKET_TRADE_REFILL_BLOCKS), clamped to one capacity, so at most one capacity moves at any instant and about one per day sustained.
  • Each leg is separately bounded to 200 basis points of the price references; this cap is the volume bound.
  • Set by sudo_set_basket_daily_turnover_cap, which emits BasketDailyTurnoverCapSet.

Stored Value

value (u16)

Default Value

6553 0x9919

Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.

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 BasketDailyTurnoverCap storage (no keys - plain value)
const result = await api.query.SubtensorModule.BasketDailyTurnoverCap.getValue();
console.log("BasketDailyTurnoverCap:", result);

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Plain
First Version
v464
Current Version
v472