Skip to content

feat: per-miner success rate in view rates and swap now#367

Open
anderdc wants to merge 2 commits into
testfrom
feat/miner-success-rate-display
Open

feat: per-miner success rate in view rates and swap now#367
anderdc wants to merge 2 commits into
testfrom
feat/miner-success-rate-display

Conversation

@anderdc
Copy link
Copy Markdown
Collaborator

@anderdc anderdc commented May 22, 2026

What

Adds a Reliability column to alw view rates (the user-shopping table) and the alw swap now miner picker — per-miner, per-direction swap success rate, shown as completed/resolved and color-coded (green ≥90%, yellow ≥50%, red below).

Why

Today a user picks a miner by posted rate alone. A miner can quote the best rate and still fail most of its swaps, with no signal in the CLI to catch it before reserving. The column surfaces it — e.g. a miner showing T→B 1/17 has timed out 16 of its last 17 tao→btc swaps.

How

  • fetch_miner_reliability() (helpers.py) aggregates resolved swaps (COMPLETED + TIMED_OUT — the same basis as the subnet's success_rate) from the public swap-history API.
  • 30-day window, matching the subnet's credibility window.
  • Cached 10 min, keyed by API host + window; paging stops once swaps predate the window.
  • Degrades gracefully — returns None / renders if the API is unreachable, so view rates and swap now still work offline of the indexer.
  • ALLWAYS_API_URL env override.

Tests

tests/test_miner_reliability.py — aggregation, 30-day windowing, unresolved-status exclusion, API-unreachable, and a JSON-error-body guard.

Docs

Companion docs PR in allways-docs-ui updates cli.md.

Deferred (follow-ups)

  • --sort reliability on view rates
  • the same column on alw view miners
  • making --auto reliability-aware

anderdc and others added 2 commits May 22, 2026 11:21
Users pick a miner by posted rate alone, so a miner can quote the best rate and still fail most of its swaps. Add a Reliability column (completed vs resolved swaps, per direction) to the 'alw view rates' shopping table and the 'alw swap now' miner picker.

Stats aggregate resolved swaps from the public swap-history API over a 30-day window (matching the subnet credibility window), cached 10 min and keyed by API host. The column degrades to a dim dash when the API is unreachable, so both commands still work offline of the indexer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant