πΉW Swap LP Price API
This document describes the W Swap LP Value API endpoint that returns the latest token price and LP (Liquidity Provider) token price in USD for a specific trading pair.
Endpoint
Method:
GETPath:
/api/w-swap/lp-value/:id
Purpose
Returns the latest price of the pair.
Returns the estimated USD value of one LP token for the pair.
Also returns the pair name for convenience.
Request
Path parameter
id(number): Thetrade_pairs.idof the pair.
Example
GET /api/w-swap/lp-value/2Success Response
Status:
200 OKBody:
Field Details
latestPrice(number): The latest exchange rate of the pair (token1 per token0 or vice versa depending on pair configuration).lpPriceInUsd(number): The estimated value of 1 LP token in USD.pair(string): The human-readable pair name fromtrade_pairs.name.
Error Responses
400 Bad Request: Missingidpath parameter.
404 Not Found: Price or pair not found (no matchingtrade_pairs.idor missing price data).
Supported Trade Pairs
The following trade pairs are supported by this API. Use the corresponding ID in the request URL.
1
WAVE/WCO
2
USDT/WCO
3
USDC/WCO
4
SOL/WCO
5
DOGE/WCO
6
XRP/WCO
Implementation Notes
The endpoint fetches the latest price and pair name in a single query for efficiency.
Results are cached for 60 seconds (
maxAge: 60,swr: true) to reduce database load and improve response times.Authentication is not required for this public endpoint.
Related Endpoints
GET /api/w-swap/volume/:idβ returns the last 24 hours of traded volume (in USD).
Last updated