Repository navigation
Feat/peg deviation alerts - #322
p70436464-prog wants to merge 3 commits into
Conversation
…s venues
- Calculate proportions per venue for a given size that minimise total slippage
- Return split proportions only when splitting beats the single-venue route
- Include single-venue alternative comparison in response
- Add GET /price/:assetA/:assetB/split route filtering on and echoing network
- Fully declare /price/{assetA}/{assetB}/split and schemas in openapi.yaml and openapi.json
- Add vitest tests covering size where splitting wins and where it does not
|
@p70436464-prog Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
CI is red, and both of your open PRs fail on the same file for the same reason —
const { mockThing } = vi.hoisted(() => ({ mockThing: vi.fn() }))
vi.mock('../network/clients', () => ({ getHorizonServer: mockThing }))
There is a second trap behind this one, specific to mocking Separately: #320 and #322 both carry |
tsc --noEmit clean vitest 97 files, 1135 passing dropped-tests none #311 adaptive slippage impact endpoint #323 trade size and volume concentration metrics #320 and #322 screened clean individually but conflict once #311 and #323 are in -- all four touch the same routing and pricing surface. They need a rebase rather than a fix; noted on both. Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
Miracle656
left a comment
There was a problem hiding this comment.
Needs a rebase. This screened clean on its own — tsc --noEmit passes against main as it was — but conflicts once #311 (adaptive slippage) and #323 (trade size and volume concentration) are in, and those landed as b906b47.
All four touch the same routing and pricing surface, which is why they collided rather than merged. Nothing is wrong with the code.
Rebase on current main and re-run npx vitest run before re-requesting. Two things worth checking while you are there, because both have caught PRs in this repo today:
- the logging-hygiene test forbids
console.*in non-test source — usecreateLogger(three PRs tripped this in two batches) tests/openapi.test.tsfails if you document a route without registering it insrc/app.ts, or the reverse
Happy to take it as soon as it is green.
Closes #288
Summary
Implements a peg-deviation alert in
src/alerts/through the existing alerts path to monitor stablecoins and pegged assets leaving and returning to their peg.What was built
PegDeviationTracker,checkPegDeviation): Evaluates price ticks against a configurable target price and deviation band (band,bandBps,bandPct).sustainedDurationMsacross multiple samples before raising an alert, ensuring a single bad tick does not fire.recoveryevent when price recovers within the peg band, detailingrecoveredAt,deviationStartedAt, and totaldurationMs.venues: string[]) and full provenance ({ venues, sampleCount, freshnessMs }).deliverJsonWithRetriesfor HMAC-signed webhook delivery.Testing
tests/pegDeviation.test.ts: Added test suite proving that: