Swap
AMM pools, positions, swaps and candles.
Deprecated. This page is part of the legacy API, which will be switched off. Use /<chain>/pools, /<chain>/positions and /<chain>/charts/amm/<poolId> of the current API instead. The swap route is not deprecated and has its own page: Swap route.
Alcor Swap is a concentrated-liquidity AMM on the swap.alcor contract. These endpoints read its pools and positions
and find swap routes.
How the AMM works: Alcor Swap and the AMM swap contract API. To compute prices, positions and routes locally, without the API, use the Alcor Swap SDK.
Pools
All AMM pools, including inactive ones.
GET https://wax.alcor.exchange/api/v2/swap/pools
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| tokenA | string | no | Only pools with this token as token A. With tokenB, the pools of that pair in either order |
| tokenB | string | no | Only pools with this token as token B |
| hide_scam | boolean | no | true leaves out pools with a token on the scam lists |
Example
curl "https://wax.alcor.exchange/api/v2/swap/pools?tokenA=wax-eosio.token&tokenB=usdt-usdt.alcor"Answers an array of pools, as in Pool.
Pool
One pool by id. An unknown id answers null.
GET https://wax.alcor.exchange/api/v2/swap/pools/<pool_id>
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pool_id | number | yes | Pool id, in the path |
Example
curl https://wax.alcor.exchange/api/v2/swap/pools/1095{
"id": 1095,
"chain": "wax",
"active": true,
"fee": 3000,
"feeProtocol": 0,
"tickSpacing": 60,
"tokenA": {
"contract": "eosio.token",
"decimals": 8,
"symbol": "WAX",
"id": "wax-eosio.token",
"quantity": 222783.8554093
},
"tokenB": {
"contract": "usdt.alcor",
"decimals": 4,
"symbol": "USDT",
"id": "usdt-usdt.alcor",
"quantity": 790.0321
},
"sqrtPriceX64": "12931342024590619",
"tick": -145268,
"liquidity": "9024147348",
"maxLiquidityPerTick": "1247497401346422",
"feeGrowthGlobalAX64": "2905065159736797300513",
"feeGrowthGlobalBX64": "6373171825477389",
"protocolFeeA": 0,
"protocolFeeB": 0,
"priceA": 0.00491414,
"priceB": 203.494,
"tvlUSD": 1891.74,
"volumeA24": 17221.18436066,
"volumeB24": 86.1053,
"volumeUSD24": 85.59,
"volumeAWeek": 67484.19683699,
"volumeBWeek": 359.4608,
"volumeUSDWeek": 361.04,
"volumeAMonth": 519984.02878347,
"volumeBMonth": 2951.5294,
"volumeUSDMonth": 2981.59,
"volumeA90": 2443181.00916112,
"volumeB90": 11536.0987,
"volumeUSD90": 11562.55,
"change24": -3.47,
"changeWeek": -6.76,
"firstSeenAt": "2023-05-06T08:05:51.500Z"
}Response fields
| Name | Type | Description |
|---|---|---|
| id | number | Pool id |
| active | boolean | Whether the pool is active |
| fee | number | Swap fee in hundredths of a basis point: 3000 is 0.3% |
| feeProtocol | number | Protocol fee setting of the pool |
| tickSpacing | number | Tick spacing |
| tokenA, tokenB | object | The tokens: id, contract, symbol, decimals, and quantity held by the pool |
| sqrtPriceX64 | string | Current price as a Q64.64 square root |
| tick | number | Current tick |
| liquidity | string | In-range liquidity |
| maxLiquidityPerTick | string | Most liquidity a tick can hold |
| feeGrowthGlobalAX64, feeGrowthGlobalBX64 | string | Accumulated fees per unit of liquidity, Q64.64 |
| protocolFeeA, protocolFeeB | number | Protocol fees accrued and not yet collected |
| priceA | number | Price of token A in token B |
| priceB | number | Price of token B in token A |
| tvlUSD | number | Total value locked, USD |
| volumeA24, volumeB24, volumeUSD24 | number | 24-hour volume in token A, token B and USD |
| volumeAWeek, volumeBWeek, volumeUSDWeek | number | 7-day volume |
| volumeAMonth, volumeBMonth, volumeUSDMonth | number | 30-day volume |
| volumeA90, volumeB90, volumeUSD90 | number | 90-day volume |
| change24, changeWeek | number | Price change over 24 hours and 7 days, percent |
| firstSeenAt | string | When the pool was created |
Pool positions
Open liquidity positions of a pool, with their value and fees.
GET https://wax.alcor.exchange/api/v2/swap/pools/<pool_id>/positions
Example
curl https://wax.alcor.exchange/api/v2/swap/pools/12397/positions[
{
"id": 152287,
"owner": "alcordexfund",
"pool": 12397,
"tickLower": -100,
"tickUpper": 100,
"liquidity": "800386663698",
"feeGrowthInsideALastX64": "160181032180210",
"feeGrowthInsideBLastX64": "125798765051241",
"inRange": true,
"amountA": "3763.075641 USDC",
"amountB": "4220.481815 USDT",
"feesA": "0.220932 USDC",
"feesB": "0.369956 USDT",
"totalValue": 7984.15,
"totalFeesUSD": 0.59,
"depositedUSDTotal": 7983.4609,
"collectedFees": { "tokenA": 0, "tokenB": 0, "inUSD": 0, "lastCollectTime": null },
"pNl": 0.59,
"closed": false,
"lockedUntil": null,
"isLocked": false
}
]Response fields
| Name | Type | Description |
|---|---|---|
| id | number | Position id |
| owner | string | Owner account |
| pool | number | Pool id |
| tickLower, tickUpper | number | Price range of the position, in ticks |
| liquidity | string | Position liquidity |
| feeGrowthInsideALastX64, feeGrowthInsideBLastX64 | string | Fee growth inside the range at the last update, Q64.64 |
| inRange | boolean | Whether the current price is inside the range |
| amountA, amountB | string | Tokens in the position now, as assets |
| feesA, feesB | string | Fees earned and not yet collected, as assets |
| totalValue | number | Tokens plus uncollected fees, USD |
| totalFeesUSD | number | Uncollected fees, USD |
| depositedUSDTotal | number | USD value of deposits minus withdrawals, valued at the time of each |
| collectedFees | object | Fees already collected: tokenA, tokenB, inUSD, lastCollectTime |
| pNl | number | Earned fees in USD, collected plus uncollected. Price movement of the deposit is not included |
| closed | boolean | Whether all liquidity has been withdrawn |
| lockedUntil | number | Unix seconds the position is locked until, or null |
| isLocked | boolean | Whether the position is locked now. A locked position cannot be withdrawn |
Pool swaps
Swaps of a pool, newest first.
GET https://wax.alcor.exchange/api/v2/swap/pools/<pool_id>/swaps
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pool_id | number | yes | Pool id, in the path |
| from | number | no | Only swaps at or after this time, unix milliseconds |
| to | number | no | Only swaps at or before this time, unix milliseconds |
| sender | string | no | Only swaps sent by this account |
| recipient | string | no | Only swaps received by this account |
| limit | number | no | Number of swaps. Default 200 |
| skip | number | no | Swaps to skip, for paging |
Example
curl "https://wax.alcor.exchange/api/v2/swap/pools/1095/swaps?limit=1"[
{
"_id": "6ad0bded29945be352deacb2",
"pool": 1095,
"trx_id": "096bbefb42fe7e43580c68d05c02b95682b5c722b1fd01fb90fadf29e0abb90e",
"sender": "eldrinvale12",
"recipient": "eldrinvale12",
"sqrtPriceX64": "12931342024590619",
"totalUSDVolume": 0.4345,
"tokenA": -87.80659353,
"tokenB": 0.4325,
"time": "2026-10-15T11:50:05.000Z"
}
]Response fields
| Name | Type | Description |
|---|---|---|
| _id | string | Record id |
| pool | number | Pool id |
| trx_id | string | Transaction id |
| sender | string | Account that sent the swap |
| recipient | string | Account that received the output |
| sqrtPriceX64 | string | Pool price after the swap, Q64.64 square root |
| totalUSDVolume | number | Swap value, USD |
| tokenA, tokenB | number | Token amounts, signed from the pool's side: positive went into the pool, negative came out |
| time | string | Swap time, ISO 8601 |
Pool candles
OHLCV candles of a pool, oldest first. Periods without swaps are filled with flat candles at the last price.
GET https://wax.alcor.exchange/api/v2/swap/pools/<pool_id>/candles
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pool_id | number | yes | Pool id, in the path |
| resolution | string | yes | Candle size: 1, 5, 15, 30, 60, 240 (minutes), 1D, 1W, 1M |
| from | number | no | Start time, unix milliseconds. Used together with to |
| to | number | no | End time, unix milliseconds |
| limit | number | no | Most candles to return |
| reverse | boolean | no | true gives prices of token B in token A. Default: token A in token B |
| volumeField | string | no | volumeUSD (default), volumeA or volumeB |
Example
curl "https://wax.alcor.exchange/api/v2/swap/pools/1095/candles?resolution=60&from=1792057410000&to=1792068210000"[
{ "time": 1792058400000, "open": "0.00489139", "high": "0.00493338", "low": "0.00488846", "close": "0.00489139", "volume": 3.6053 },
{ "time": 1792062000000, "open": "0.00489139", "high": "0.00491414", "low": "0.00489288", "close": "0.00491414", "volume": 1.4758 }
]Response fields
| Name | Type | Description |
|---|---|---|
| time | number | Candle start, unix milliseconds |
| open, high, low, close | string | Prices |
| volume | number | Volume in the unit chosen by volumeField |
To get candles by token pair rather than by pool, use
GET https://wax.alcor.exchange/api/v2/swap/candles?tokenA=<token_id>&tokenB=<token_id> with the same parameters. It
picks the pair's main pool (the active pool with the highest TVL), prices token A in token B as asked, and answers
{ "candles": [...], "poolId": 1095, "isReversed": false }, where isReversed tells that the pool holds the tokens in
the other order.
Swap route
Moved to Swap route: it is not part of the deprecated API.
Swap route v3
Moved to Swap route.