feat: per-miner success rate in view rates and swap now#367
Open
anderdc wants to merge 2 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
Reliabilitycolumn toalw view rates(the user-shopping table) and thealw swap nowminer picker — per-miner, per-direction swap success rate, shown ascompleted/resolvedand 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/17has 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'ssuccess_rate) from the public swap-history API.None/ renders—if the API is unreachable, soview ratesandswap nowstill work offline of the indexer.ALLWAYS_API_URLenv 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-uiupdatescli.md.Deferred (follow-ups)
--sort reliabilityonview ratesalw view miners--autoreliability-aware