AlcorDocs

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

NameTypeRequiredDescription
tokenAstringnoOnly pools with this token as token A. With tokenB, the pools of that pair in either order
tokenBstringnoOnly pools with this token as token B
hide_scambooleannotrue 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

NameTypeRequiredDescription
pool_idnumberyesPool 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

NameTypeDescription
idnumberPool id
activebooleanWhether the pool is active
feenumberSwap fee in hundredths of a basis point: 3000 is 0.3%
feeProtocolnumberProtocol fee setting of the pool
tickSpacingnumberTick spacing
tokenA, tokenBobjectThe tokens: id, contract, symbol, decimals, and quantity held by the pool
sqrtPriceX64stringCurrent price as a Q64.64 square root
ticknumberCurrent tick
liquiditystringIn-range liquidity
maxLiquidityPerTickstringMost liquidity a tick can hold
feeGrowthGlobalAX64, feeGrowthGlobalBX64stringAccumulated fees per unit of liquidity, Q64.64
protocolFeeA, protocolFeeBnumberProtocol fees accrued and not yet collected
priceAnumberPrice of token A in token B
priceBnumberPrice of token B in token A
tvlUSDnumberTotal value locked, USD
volumeA24, volumeB24, volumeUSD24number24-hour volume in token A, token B and USD
volumeAWeek, volumeBWeek, volumeUSDWeeknumber7-day volume
volumeAMonth, volumeBMonth, volumeUSDMonthnumber30-day volume
volumeA90, volumeB90, volumeUSD90number90-day volume
change24, changeWeeknumberPrice change over 24 hours and 7 days, percent
firstSeenAtstringWhen 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

NameTypeDescription
idnumberPosition id
ownerstringOwner account
poolnumberPool id
tickLower, tickUppernumberPrice range of the position, in ticks
liquiditystringPosition liquidity
feeGrowthInsideALastX64, feeGrowthInsideBLastX64stringFee growth inside the range at the last update, Q64.64
inRangebooleanWhether the current price is inside the range
amountA, amountBstringTokens in the position now, as assets
feesA, feesBstringFees earned and not yet collected, as assets
totalValuenumberTokens plus uncollected fees, USD
totalFeesUSDnumberUncollected fees, USD
depositedUSDTotalnumberUSD value of deposits minus withdrawals, valued at the time of each
collectedFeesobjectFees already collected: tokenA, tokenB, inUSD, lastCollectTime
pNlnumberEarned fees in USD, collected plus uncollected. Price movement of the deposit is not included
closedbooleanWhether all liquidity has been withdrawn
lockedUntilnumberUnix seconds the position is locked until, or null
isLockedbooleanWhether 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

NameTypeRequiredDescription
pool_idnumberyesPool id, in the path
fromnumbernoOnly swaps at or after this time, unix milliseconds
tonumbernoOnly swaps at or before this time, unix milliseconds
senderstringnoOnly swaps sent by this account
recipientstringnoOnly swaps received by this account
limitnumbernoNumber of swaps. Default 200
skipnumbernoSwaps 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

NameTypeDescription
_idstringRecord id
poolnumberPool id
trx_idstringTransaction id
senderstringAccount that sent the swap
recipientstringAccount that received the output
sqrtPriceX64stringPool price after the swap, Q64.64 square root
totalUSDVolumenumberSwap value, USD
tokenA, tokenBnumberToken amounts, signed from the pool's side: positive went into the pool, negative came out
timestringSwap 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

NameTypeRequiredDescription
pool_idnumberyesPool id, in the path
resolutionstringyesCandle size: 1, 5, 15, 30, 60, 240 (minutes), 1D, 1W, 1M
fromnumbernoStart time, unix milliseconds. Used together with to
tonumbernoEnd time, unix milliseconds
limitnumbernoMost candles to return
reversebooleannotrue gives prices of token B in token A. Default: token A in token B
volumeFieldstringnovolumeUSD (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

NameTypeDescription
timenumberCandle start, unix milliseconds
open, high, low, closestringPrices
volumenumberVolume 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.

On this page