arrow_backRetour aux issues
Wayfare-labs/wayfare
#40
Débutant
Ouvrirarrow_forward
Débutant
Ouvrirarrow_forward
Débutant
Ouvrirarrow_forward
Metric: price impact as a function of trade size
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 **price impact as a function of size** — how much worse the effective rate gets as the trade grows — and report it as a curve, not a single number.
## Why it matters
The ladder already shows this happening: USDC→NGNC loses 25.02% at 0.1 USDC and 97.68% at 5000. But nothing names the *shape*. A corridor with a flat curve and a bad floor is a different problem from one with a good floor and a cliff — the first is priced badly, the second is thin.
Separating the two is what tells a user whether their size is the problem or the corridor is.
## Which layer
**Layer 2 — deterministic calculation** over the ladder's layer 1 facts.
## This is a metric
Returns `MetricResult` per size, not a verdict. See "Checks and metrics are separate shapes" in [docs/checks.md](https://github.com/Wayfare-labs/wayfare/blob/main/docs/checks.md). **Do not add a threshold** — deciding what impact is unacceptable is maintainer-owned.
## Exactly where the code goes
- **New file:** `checks/metric_price_impact.go`
- Tests appended to `checks/checks_test.go`
- `dex.MeasureSlippage` in `dex/dex.go` already compares a full size against a probe — reuse it rather than reimplementing
## Where the data comes from
`dex.Client.StrictSendPaths` across `route.DefaultSizes`, which the ladder already walks.
## What "unmeasurable" means here
- Fewer than two priced sizes → `Determined: false`. Impact is a comparison; one point is not a curve
- No market at any size → undetermined, **not zero impact**. Zero impact would say "this corridor is perfectly liquid", the opposite of the truth
## Acceptance criteria
- [ ] `MetricResult` per size, with `UnitPercent`
- [ ] `decimal.Decimal` throughout; no float64
- [ ] Returns UNABLE-TO-DETERMINE (not zero) with fewer than two priced sizes
- [ ] Reuses `dex.MeasureSlippage` rather than recomputing
- [ ] Evidence names the sizes compared
- [ ] Table tests from `testdata/snapshots` — NGNC for a real curve, KESC for the no-market case
- [ ] Negative test: a corridor with one or zero priced sizes
- [ ] No new third-party dependencies
- [ ] gofmt, vet, test -race, golangci-lint clean
- [ ] Adds no threshold turning the metric into a verdict
## Out of scope
Nothing in `dex/` may change. Nothing in `route/`, `sep38/`, `runstore/runstore.go`.
## How to verify locally
```bash
make offline-test
go test ./checks/ -run TestPriceImpact -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