Bittensor taostats

From jiayaoqijia/cryptoskill · View interactive version

Bittensor taostats is an AI agent skill from the GitHub repository jiayaoqijia/cryptoskill. **Purpose**: Interact with TaoStats API for Bittensor blockchain data - subnets, validators, miners, staking, emissions, and more.

How to use this skill

Skill file

TaoStats Skill

Purpose: Interact with TaoStats API for Bittensor blockchain data - subnets, validators, miners, staking, emissions, and more.

API Documentation: https://docs.taostats.io/

Base URL: https://api.taostats.io

Rate Limit: 5 calls/minute (free tier)


Setup

1. Set API Key

Get a free API key from taostats.io and export it as an environment variable:

export TAOSTATS_API_KEY="tao-xxxxx:yyyyy"

2. Source Helper Functions

source ~/.openclaw/workspace/skills/taostats/taostats.sh

Complete Endpoint Reference

dTAO Pool Endpoints

`GET /api/dtao/pool/latest/v1?netuid={N}`

CRITICAL: This endpoint has EVERYTHING for trading decisions.

Key Fields:

Example:

curl -s "https://api.taostats.io/api/dtao/pool/latest/v1?netuid=33" \
  -H "Authorization: $TAOSTATS_API_KEY" | jq '.data[0].root_prop'
# Returns: "0.2104087259347016725" (21% - GOOD entry)
`GET /api/dtao/pool/history/v1?netuid={N}&limit={L}`

Historical pool snapshots for backtesting.

`GET /api/dtao/validator/yield/latest/v1?netuid={N}`

Validator APYs with multiple timeframes.

Key Fields:

Example:

curl -s "https://api.taostats.io/api/dtao/validator/yield/latest/v1?netuid=33" \
  -H "Authorization: $TAOSTATS_API_KEY" | \
  jq -r '.data | sort_by(-.seven_day_apy) | .[0] | 
  "\(.name // .hotkey.ss58): \(.seven_day_apy * 100)% APY"'
`GET /api/dtao/stake_balance/latest/v1?coldkey={COLDKEY}`

All stake positions across all subnets.

Key Fields:

Subnet Endpoints

`GET /api/subnet/latest/v1` or `?netuid={N}`

Complete subnet parameters and economics.

Key Fields:

`GET /api/subnet/registration/v1?netuid={N}`

Subnet registration details.

Key Fields:

Validator Endpoints

`GET /api/validator/latest/v1?netuid={N}`

Current validator state.

Key Fields:

`GET /api/validator/history/v1?netuid={N}&hotkey={H}&limit={L}`

Historical validator performance.

Key Fields:

Transaction Endpoints

`GET /api/delegation/v1?nominator={COLDKEY}&action={all|stake|unstake}&limit={L}`

Complete transaction history (stakes, unstakes, transfers).

Key Fields:

`GET /api/transfer/v1?from={COLDKEY}&limit={L}`

TAO transfer history (not staking).

Key Fields:

Metagraph Endpoints

`GET /api/metagraph/latest/v1?netuid={N}&limit={L}`

Complete subnet state for every neuron.

Key Fields:

`GET /api/neuron/latest/v1?netuid={N}&limit={L}`

Simplified neuron view with pruning risk.

Key Fields:


Quick Reference

Get Subnet Pool Data

taostats_pool 33
# Returns: price, root_prop, fear_and_greed_index, 7-day price history, volume

Get Validator APYs

taostats_validator_yield 33
# Returns: All validators with 1h/1d/7d/30d APYs

Get Stake Balances

taostats_stake_balance "YOUR_COLDKEY_HERE"
# Returns: All positions with root_prop per subnet

Get Transaction History

taostats_delegation_history "YOUR_COLDKEY_HERE"
# Returns: All stake/unstake transactions with slippage

Get Subnet Parameters

taostats_subnet_info 33
# Returns: Emissions, net flows, registration cost, immunity params

Get Metagraph

taostats_metagraph 33
# Returns: All neurons with stakes, ranks, emissions

Common Patterns

Check Entry Quality (root_prop < 0.30)

NETUID=33
ROOT_PROP=$(curl -s "https://api.taostats.io/api/dtao/pool/latest/v1?netuid=$NETUID" \
  -H "Authorization: $TAOSTATS_API_KEY" | jq -r '.data[0].root_prop')

if (( $(echo "$ROOT_PROP < 0.30" | bc -l) )); then
  echo "SN$NETUID: GOOD entry (root_prop: $ROOT_PROP)"
else
  echo "SN$NETUID: AVOID (root_prop: $ROOT_PROP - artificial price)"
fi

Find Best Validator for Subnet

NETUID=33
curl -s "https://api.taostats.io/api/dtao/validator/yield/latest/v1?netuid=$NETUID" \
  -H "Authorization: $TAOSTATS_API_KEY" | \
  jq -r '.data | sort_by(-.seven_day_apy) | .[0] | 
  "\(.name // .hotkey.ss58) | APY: \(.seven_day_apy * 100)% | Commission: \(.take * 100)%"'

Check Portfolio with root_prop per Position

COLDKEY="YOUR_COLDKEY_HERE"
curl -s "https://api.taostats.io/api/dtao/stake_balance/latest/v1?coldkey=$COLDKEY" \
  -H "Authorization: $TAOSTATS_API_KEY" | \
  jq -r '.data[] | 
  "SN\(.netuid): \((.balance_as_tao | tonumber) / 1000000000) TAO | root_prop: \(.root_prop)"'

Scan for High APY Opportunities (S-tier only)

for NETUID in 33 64 51 13 3 1 100; do
  MAX_APY=$(curl -s "https://api.taostats.io/api/dtao/validator/yield/latest/v1?netuid=$NETUID" \
    -H "Authorization: $TAOSTATS_API_KEY" | jq -r '.data | max_by(.seven_day_apy) | .seven_day_apy')
  echo "$NETUID|$MAX_APY"
  sleep 0.3
done | sort -t'|' -k2 -rn | while IFS='|' read netuid apy; do
  printf "SN%-3s: %6.1f%%\n" "$netuid" "$(echo "$apy * 100" | bc -l)"
done

Monitor Capital Flows (net_flow indicates momentum)

curl -s "https://api.taostats.io/api/subnet/latest/v1" \
  -H "Authorization: $TAOSTATS_API_KEY" | \
  jq -r '.data[] | select(.netuid != 0) | 
  "SN\(.netuid): net_flow_7d=\(.net_flow_7_days) | emission=\(.emission)"' | \
  sort -t'=' -k2 -rn | head -10

Python Tools

`taostats_client.py`

Robust API client with automatic retry logic.

from taostats_client import TaostatsAPI

api = TaostatsAPI("your-api-key")

# Single call with retry
result = api.get_json("dtao/pool/latest/v1?netuid=33")

# Paginated (handles all pages automatically)
all_data = api.get_paginated("dtao/stake_balance/latest/v1?coldkey=XYZ")

# Balance history
history = api.get_balance_history(coldkey, start_timestamp, end_timestamp)

`balance_history.py`

Track daily portfolio changes over time.

# View last 30 days
python3 skills/taostats/balance_history.py --days 30

# Export to CSV
python3 skills/taostats/balance_history.py --days 90 --export

Output:

📊 Portfolio History (30 records):
--------------------------------------------------------------------------------
Date         Free τ    Staked τ    Total τ    Daily Δ
--------------------------------------------------------------------------------
2026-01-07   0.0234    1.9567    1.9801            
2026-01-08   0.0256    1.9789    2.0045   +0.0244
...
Overall Change: +0.5399 τ (+27.27%)

Bash Functions (taostats.sh)

Core Trading Functions

`taostats_pool <netuid>`

Get full pool data including root_prop and fear & greed.

`taostats_pool_history <netuid> [limit]`

Historical pool snapshots.

`taostats_validator_yield <netuid>`

All validators with APYs.

`taostats_stake_balance <coldkey>`

All positions with per-subnet root_prop.

`taostats_delegation_history <coldkey> [limit]`

Transaction history with slippage.

Subnet Analysis Functions

`taostats_subnet_info [netuid]`

Subnet parameters and economics.

`taostats_subnet_registration <netuid>`

Subnet ownership and registration details.

Validator Analysis Functions

`taostats_validator_info <netuid>`

Current validator state.

`taostats_validator_history <netuid> <hotkey> [limit]`

Historical validator performance.

Metagraph Functions

`taostats_metagraph <netuid>`

Complete subnet state.

`taostats_neurons <netuid>`

Simplified neuron view.


Rate Limit Handling

Free tier: 5 calls per minute

Best practices:

  1. Cache pool data (changes slowly)
  2. Use sleep 0.3 between calls (20 calls/min safe)
  3. Batch where possible
  4. Monitor for 429 errors

Example rate-limited loop:

for NETUID in {1..50}; do
  taostats_pool $NETUID | jq -r '.data[0] | "SN\(.netuid): root_prop=\(.root_prop)"'
  sleep 0.3
done

Error Handling

| Code | Cause | Fix |

|------|-------|-----|

| 401 | Invalid API key | Check .taostats format, no "Bearer" prefix |

| 404 | Wallet not indexed | Wait 1-2 hours for new wallets |

| 429 | Rate limit | Add sleep delays between calls |

| Empty | Inactive subnet | Check if subnet exists first |


Critical Fields for Trading

Entry Validation

Momentum Signals

Risk Metrics

Sentiment


Known Issues

`balance_as_tao` Field Bug

Issue: Returns value in rao (raw units), not TAO.

Workaround: Always divide by 1,000,000,000

balance_tao=$(echo "$balance_as_tao / 1000000000" | bc -l)

Affected endpoints:


Integration Examples

Entry Scanner (root_prop + APY + flow)

#!/bin/bash
source ~/.openclaw/workspace/skills/taostats/taostats.sh

echo "=== High-Quality Entry Opportunities ==="
for NETUID in 33 64 51 13 3 1 100 117 12 120; do
  POOL=$(taostats_pool $NETUID)
  ROOT_PROP=$(echo "$POOL" | jq -r '.data[0].root_prop')
  PRICE=$(echo "$POOL" | jq -r '.data[0].price')
  FEAR_GREED=$(echo "$POOL" | jq -r '.data[0].fear_and_greed_sentiment')
  
  MAX_APY=$(taostats_validator_yield $NETUID | jq -r '.data | max_by(.seven_day_apy) | .seven_day_apy')
  
  if (( $(echo "$ROOT_PROP < 0.30" | bc -l) )); then
    printf "SN%-3s | root_prop: %.2f | APY: %5.1f%% | Sentiment: %s\n" \
      "$NETUID" "$ROOT_PROP" "$(echo "$MAX_APY * 100" | bc -l)" "$FEAR_GREED"
  fi
  sleep 0.3
done

Portfolio Risk Monitor

#!/bin/bash
source ~/.openclaw/workspace/skills/taostats/taostats.sh

COLDKEY="YOUR_COLDKEY"
echo "=== Portfolio Risk Assessment ==="

taostats_stake_balance $COLDKEY | jq -r '.data[] | 
  "\(.netuid)|\(.balance_as_tao)|\(.root_prop)"' | while IFS='|' read netuid balance root_prop; do
  BALANCE_TAO=$(echo "$balance / 1000000000" | bc -l)
  if (( $(echo "$root_prop > 0.50" | bc -l) )); then
    printf "⚠️ SN%-3s: %6.3f TAO | HIGH root_prop: %.2f - Consider exit\n" "$netuid" "$BALANCE_TAO" "$root_prop"
  else
    printf "✅ SN%-3s: %6.3f TAO | OK root_prop: %.2f\n" "$netuid" "$BALANCE_TAO" "$root_prop"
  fi
done

Python Wrapper

import requests
import os

class TaoStatsAPI:
    def __init__(self):
        self.base_url = "https://api.taostats.io"
        self.api_key = os.getenv("TAOSTATS_API_KEY")
        
    def _get(self, endpoint):
        headers = {"Authorization": self.api_key, "accept": "application/json"}
        r = requests.get(f"{self.base_url}{endpoint}", headers=headers)
        return r.json()
    
    def pool(self, netuid):
        """Get pool data with root_prop and fear & greed"""
        return self._get(f"/api/dtao/pool/latest/v1?netuid={netuid}")
    
    def validator_yield(self, netuid):
        """Get all validators with APYs"""
        return self._get(f"/api/dtao/validator/yield/latest/v1?netuid={netuid}")
    
    def stake_balance(self, coldkey):
        """Get all positions with root_prop per subnet"""
        return self._get(f"/api/dtao/stake_balance/latest/v1?coldkey={coldkey}")
    
    def subnet_info(self, netuid=None):
        """Get subnet parameters and net flows"""
        if netuid:
            return self._get(f"/api/subnet/latest/v1?netuid={netuid}")
        return self._get("/api/subnet/latest/v1")

# Usage
api = TaoStatsAPI()
pool = api.pool(33)
print(f"SN33 root_prop: {pool['data'][0]['root_prop']}")

Skill Maintenance

Last Updated: 2026-02-06

Author: vanlabs-dev

Dependencies: curl, jq, bc

Changelog:

TODO:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.