Skip to content

Feat/screener liquidity definition - #354

Open
decrypted-dev wants to merge 3 commits into
Divinity-Labs:mainfrom
decrypted-dev:feat/screener-liquidity-definition
Open

decrypted-dev wants to merge 3 commits into
Divinity-Labs:mainfrom
decrypted-dev:feat/screener-liquidity-definition

Conversation

@decrypted-dev

Copy link
Copy Markdown
Contributor

Closes #283

Summary

Defines liquidity in the OpenAPI spec and route documentation, validates that the underlying query calculation matches the definition, and names the unit in the response.

Details & Specification

  • Definition: For each watched pair on the selected network, liquidity represents total AMM reserves denominated in the quote/counter asset (asset_b), computed across all active liquidity pools (source = 'AMM') as:
    $$\sum (\text{reserve_a} \times \text{spot_price} + \text{reserve_b})$$
    evaluated at each pool's latest snapshot spot price.
  • Unit: Denominated in the quote asset (asset_b), exposed explicitly as liquidity_unit on each row (e.g., USDC for XLM/USDC).
  • Network Scoping: Echoes network in the top-level /screener response and documents ?network= in openapi.yaml and openapi.json.
  • Number Changes: No numeric change was required to the stored calculation, as (ps.reserve_a * ps.spot_price + ps.reserve_b) already faithfully evaluates total liquidity in units of asset_b.

Verification

  • npm test src/__tests__/screener.test.ts: Passes all 18 tests, including tests verifying the SQL formula structure and liquidity_unit naming.
  • npm test tests/openapi.test.ts: Passes and verifies OpenAPI parity.
  • npm test: Full test suite passes (631 passed).

@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@decrypted-dev 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! 🚀

Learn more about application limits

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.

liquidity is a column with no definition

1 participant