arrow_backRetour aux issues
Wayfare-labs/wayfare
#41
Débutant
Ouvrirarrow_forward
Débutant
Ouvrirarrow_forward
Débutant
Ouvrirarrow_forward
Metric: liquidity concentration
ecoDébutant
help wanted
area:pricing
difficulty:medium
descriptionDescription
Written to the standard set by #33 — read that issue first for the expected level of detail and the acceptance criteria every check shares.
## What
Measure how concentrated a market's liquidity is — how much of the available depth comes from how few offers or accounts.
## Why it matters
Two books with identical total depth are not equally safe. One with a hundred offers from thirty accounts survives any single participant leaving. One where 90% of depth is a single offer from one account is one cancellation away from being the KESC corridor.
Total depth alone cannot distinguish them, and the difference is the whole risk.
## Which layer
**Layer 2 — deterministic calculation.**
## This is a metric
`MetricResult`, `UnitRatio`. **No threshold** — see [docs/checks.md](https://github.com/Wayfare-labs/wayfare/blob/main/docs/checks.md).
## Exactly where the code goes
- **New file:** `checks/metric_concentration.go`
- Tests appended to `checks/checks_test.go`
- Reads `dex.Client.OrderBook`
## Where the data comes from
Horizon `/order_book`. Note the caveat already documented in `dex/health.go`: the meaning of the `amount` field is genuinely ambiguous between base and counter asset, and `BookHealth` deliberately avoids depending on it. **Read that comment before deciding what to measure** — a concentration figure built on a misread amount would be confidently wrong.
Consider measuring concentration over **offer count and price levels** rather than amounts, or state clearly which interpretation you took and why.
## What "unmeasurable" means here
- Empty or one-sided book → `Determined: false`, not zero
- A single offer → concentration is definitionally total; report it as determined with the count, not as an error
- Horizon does not expose the offering account in `/order_book` — if account-level concentration is wanted it needs `/offers`, which is a **separate issue**. Say plainly which you measured
## Acceptance criteria
- [ ] `MetricResult` with `UnitRatio`
- [ ] `decimal.Decimal` throughout; no float64
- [ ] Returns UNABLE-TO-DETERMINE (not zero) for an empty or one-sided book
- [ ] States in the descriptor's `CannotDetermine` whether account-level concentration was measured, and if not, why
- [ ] Does not depend on the ambiguous `amount` field without saying so explicitly
- [ ] Evidence names the levels observed
- [ ] Table tests from `dex/testdata/orderbook-xlm-ngnc.json`
- [ ] Negative test: empty book, and a single-offer book
- [ ] No new third-party dependencies
- [ ] gofmt, vet, test -race, golangci-lint clean
## Out of scope
Nothing in `dex/`. No `/offers` crawling — that is a separate issue if wanted.
## How to verify locally
```bash
make offline-test
go test ./checks/ -run TestConcentration -v
```
Issues similaires
medik8s/fence-agents-remediation
star18
Poids du dépôt moyen
v0.8.0 starts a cluster-scoped Secret informer despite namespace-scoped Secret RBAC
## Description While testing Fence Agents Remediation (FAR) v0.8.0, I observed the manager repeatedly attempting to li…
Go
good first issue
Wayfare-labs/wayfare
star1
Poids du dépôt léger
Check that an issuer's home_domain round-trips to the same stellar.toml
Written to the standard set by #33 — read that issue first for the expected level of detail and the acceptance criteria…
Go
help wanted
area:corridor
Wayfare-labs/wayfare
star1
Poids du dépôt léger
Report auth_immutable: whether an issuer's flags can still change
> **This issue is the reference standard.** Every other check issue links back here for the expected level of detail. I…
Go
help wanted
good first issue