DEX API: DEX prices, liquidity and slippage next to CEX prices
In short
- A DEX API returns a token's pool price, liquidity, volume, market cap, contract and network. For arbitrage you also need the CEX price of the same contract — Genesis API's DEX – Spot and DEX – Futures endpoints return it on the Pro and Max plans.
- A DEX price depends on trade size because a liquidity pool sets it. In a hypothetical example, a 3% spread leaves $11 on a $2,500 trade and turns negative at $5,000 after slippage, token tax and gas.
/orderbooks/dex-slippagereturns slippage for your trade size, buy and sell taxes and the honeypot flag. Genesis API only reads data: you sign the swap yourself in your own wallet.
A DEX API is programmatic access to data from decentralized exchanges (DEXs): a token's price in the pool, pool liquidity, trading volume, market cap, contract address and network. Most DEXs have no order book and no listing process: a liquidity pool sets the price, and anyone can create a pool. That is why a DEX API has to return, along with the price, the data you need to check the token and the pool.
For arbitrage, the DEX price is compared with the CEX price of the same contract, and you work out how much of the spread survives your trade size after slippage, token tax and gas. In Genesis API, DEX ↔ CEX pairs come from /arbitrage/dex-spot and /arbitrage/dex-futures, while slippage, taxes and the honeypot flag per contract come from /orderbooks/dex-slippage.
How a DEX sets its price
On most DEXs a swap goes through a liquidity pool — a smart contract holding reserves of two tokens, say a token and USDC. The price is the ratio of the reserves. A buy takes the token out of the pool and adds USDC, so each next unit of the token costs more than the previous one.
Uniswap describes such a pool with the constant product formula x × y = k, where x and y are the token reserves: after a swap, the product must not decrease.
Hypothetical example: a pool holds $200,000 of liquidity, $100,000 on each side. A $1,000 buy moves the average price by 2 × 1,000 / 200,000 = 1%, a $10,000 buy by 10%. A step-by-step calculation with a table is in the lesson What is DEX arbitrage.
The formula describes one classic pool. In Uniswap v3 and v4 it applies within the price ranges that liquidity providers choose, and the DEX price in Genesis Arbitrage rows is aggregated by contract and network. So the exact slippage for a trade size comes from data, and the formula serves as a quick estimate.
What you need from a DEX API
Judging a DEX ↔ CEX pair takes more than one price. Here is what you need and where it sits in Genesis API responses:
| Data | Why it matters in arbitrage | Genesis API field |
|---|---|---|
| DEX and CEX price | The spread and its direction | dex_price, cex_price, spread_pct |
| Pool liquidity | How far a trade moves the price | liquidity_usd |
| 24h volume | Whether the pool trades at all | dex_volume_24h, volume_24h_usd |
| Market cap | How big the token is | market_cap |
| Contract and network | Whether it is the same token as on the exchange | contract, network or chain |
| Pool age | A fresh pool is a reason to recheck the contract | pool_created_at |
| CEX deposits and withdrawals | Whether the token can move onto or off the exchange | deposit_enabled, withdraw_enabled |
| Slippage, tax, honeypot | How much of the spread is left | /orderbooks/dex-slippage |
| Pool links | Look at the pool and its trades yourself | dexscreener_url, dextools_url, gmgn_url |
Market cap and DEX volume come in DEX – Spot, pool age in the buy and sell sides of Cross-chain. A request for one coin's DEX – Spot row:
curl -G --compressed \
"https://api.genesisarbitrage.com/v1/arbitrage/dex-spot" \
-d coin=SCR \
-H "X-API-Key: gns_live_XXXXXXXXXXXXXXXX"
A row from the DEX — Spot documentation, shortened:
{
"coin": "SCR",
"exchange": "MEXC",
"cex_price": 0.02691,
"dex_price": 0.02679,
"spread_pct": 0.45,
"network": "SCROLL",
"contract": "0xd29687c813D741E2F938F4aC377128810E217b1b",
"liquidity_usd": 10544.15,
"market_cap": 5091835.0,
"dex_volume_24h": 319.73,
"deposit_enabled": true,
"withdraw_enabled": true,
"dexscreener_url": "https://dexscreener.com/scroll/0xd296…",
"dextools_url": null,
…
}
The token costs more on MEXC than in the pool, so the spread is positive: 0.45%. Pool liquidity is $10,544 and 24h DEX volume is about $320. If this is one classic pool, the average price of a $1,000 buy will be about 2 × 1,000 / 10,544 ≈ 19% above the starting price — more than 40 times the spread. Links can be null: this row has only dexscreener_url.
Why DEX prices drift from CEX prices
A pool's price changes only through trades in it, and from the outside a new price shows up with each block: Ethereum divides time into 12-second slots. On a CEX the price moves with the stream of orders in the book. A gap lasts until an arbitrageur closes it, and here is what gets in the way:
- Deposits or withdrawals are closed. If the token cannot move onto or off the exchange, the two markets live separately. In a row, that is
deposit_enabledandwithdraw_enabled. - Costs exceed the gap. Gas, pool and exchange fees: a gap smaller than these costs is not worth closing.
- Token tax. With a 5% buy tax, a gap of up to 5% is eaten by the tax itself.
- Thin pool. In a pool worth tens of thousands of dollars, one mid-size trade moves the price.
- A different token. A copy with a different contract can trade on a DEX under the same ticker. Genesis Arbitrage compares prices only when the contract address matches.
For arbitrage, the sign of the spread sets the trade direction, and the direction sets what must be open on the exchange and which DEX-leg data to read:
spread_pct | Trade | Needed on the CEX | DEX-leg data |
|---|---|---|---|
| Above 0 | Buy on the DEX, deposit to the exchange, sell | deposit_enabled | slippage_buy_pct, tax_buy_pct |
| Below 0 | Buy on the exchange, withdraw, sell on the DEX | withdraw_enabled | slippage_sell_pct, tax_sell_pct |
While the token travels between the wallet and the exchange, the spread can close. In a DEX – Futures pair, a futures short opened together with the DEX buy offsets the price move, but margin, funding and liquidation risk come with it — see the lesson Arbitrage: DEX — Futures. A DEX – Futures row also has max_position_usd, the maximum position size, where the exchange provides it.
Slippage, token tax and honeypots
/orderbooks/dex-slippage describes the DEX leg of a pair by contract: buy and sell slippage for sizes from $100 to $100,000, the token's buy and sell tax and the honeypot flag (a honeypot is a token you can buy but cannot sell). It is the same data as the DEX table columns on the site. The filters are contract (comma-separated for several addresses) and network; the fields are described in the DEX slippage section.
An example response from the documentation, one contract:
{
"sizes_usd": [100, 500, 1000, 2500, 5000, 10000, 20000, 50000,
100000],
"contracts": [
{
"contract": "0x6982508145454ce325ddbe47a25d4ec3d2311933",
"network": "ETH",
"tax_buy_pct": 0,
"tax_sell_pct": 0,
"honeypot": "no",
"slippage_buy_pct": [0.31, 0.33, 0.36, 0.44, 0.58, 0.86,
1.41, 3.12, 6.05],
"slippage_sell_pct": [0.31, 0.34, 0.37, 0.46, 0.61, 0.9,
1.5, 3.3, 6.4],
"updated_at": 1794671040
}
]
}
The arrays follow the sizes_usd grid: a $1,000 buy loses 0.36%, a $10,000 buy 0.86%, a $100,000 buy 6.05%. null in an array means the pool lacks liquidity for that size. honeypot takes three values: no, suspect — the sources disagree, and yes — selling may be impossible. Each contract has its own update time in updated_at.
Hypothetical example: a 3% spread and what is left of it
The token costs $1.00 on the DEX and $1.03 on the CEX: a 3% spread on the buy price, so you buy on the DEX and sell on the exchange. The buy tax is 1%, the exchange fee on the sale 0.1%, and gas for the swap and the transfer to the exchange $4. The slippage_buy_pct ladder: 0.5% at $500, 0.7% at $1,000, 1.3% at $2,500 and 2.3% at $5,000.
| Trade size | Slippage | Gas, % of size | Spread left |
|---|---|---|---|
| $500 | 0.5% | 0.8% | 0.6%, or $3 |
| $1,000 | 0.7% | 0.4% | 0.8%, or $8 |
| $2,500 | 1.3% | 0.16% | 0.44%, or $11 |
| $5,000 | 2.3% | 0.08% | −0.48%, or −$24 |
For $5,000: 3 − 2.3 − 1 − 0.1 − 0.08 = −0.48%, a $24 loss on the trade. Adding percentages is fine for an estimate; the exact calculation with products comes out a few hundredths of a percent lower.
In dollars, the most is left at $2,500, while at $5,000 the same spread turns the trade negative. As the size grows, gas shrinks as a share and slippage grows, so every pair has its own working size. With honeypot: "yes" and a negative spread there is nothing to calculate: a token bought on the exchange may not sell in the pool.
The CEX sale in the example uses the row price. In practice you check it against the exchange order book: Order-book Δ for DEX rows comes from /orderbooks/spreads/dex-spot for $500, $1,000, $2,500, $5,000 and $10,000 — fields in the documentation, a walkthrough in the guide Order book endpoints.
DEX endpoints in Genesis API
| Endpoint | What it returns | Documentation |
|---|---|---|
/arbitrage/dex-spot | DEX price vs CEX spot, liquidity, market cap, volume | DEX — Spot |
/arbitrage/dex-futures | DEX price vs CEX futures, max_position_usd | DEX — Futures |
/arbitrage/crosschain | One token on DEXs in two networks, pool age | Cross-chain |
/orderbooks/dex-slippage | Slippage from $100 to $100,000, taxes, honeypot | DEX slippage |
/market/dex-dumps | Token crashes on DEXs and whether the token trades on a CEX | DEX Dumps |
All five run on the Pro ($100 a month, 10 s freshness) and Max ($200, 5 s freshness) API plans; on Trial and Start they return 403 plan_restricted. DEX – Spot and DEX – Futures take coin, exchange, min_spread and min_liquidity, Cross-chain takes chain instead of exchange, and DEX Dumps takes chain and min_liquidity. Parameters and fields are covered in the guide Arbitrage endpoints, prices on the Genesis API pricing page.
min_spread compares the signed spread: min_spread=2 also drops a row with a −5% spread. To see both directions, apply the threshold to the absolute value in code, as the example below does. Large pool swaps with a price-impact estimate come from the on-chain endpoint /onchain/dex-swaps, covered in the article On-chain data API.
Without code, the site's table shows the same pairs: its columns, filters and check order are described in How to use the DEX – Spot table.
Python example: DEX – Spot pairs without traps
The script takes DEX – Spot pairs with liquidity from $50,000 and an absolute spread from 2%, requests slippage and taxes for their contracts and drops honeypot: "yes" and taxes above 5%. For the rest, it works out how much of the spread is left on $1,000 after slippage and tax. The key comes from the GENESIS_API_KEY environment variable.
The request function waits Retry-After seconds on 429 and 503. When the monthly quota is used up, Retry-After counts down to the quota reset and can run to days, so the script does not start a long wait:
import os
import time
import requests
API = "https://api.genesisarbitrage.com/v1"
HEADERS = {"X-API-Key": os.environ["GENESIS_API_KEY"]}
def get(path, params=None):
for _ in range(3):
r = requests.get(API + path, headers=HEADERS,
params=params, timeout=15)
if r.status_code == 403:
raise SystemExit("DEX endpoints need the Pro or Max plan")
if r.status_code in (429, 503):
wait = int(r.headers.get("Retry-After", "5"))
if wait > 60: # monthly quota used up
raise SystemExit(f"quota used up, retry in {wait} s")
time.sleep(wait)
continue
r.raise_for_status()
return r.json()["data"]
raise RuntimeError("API busy, try again later")
Picking pairs and checking contracts:
SIZE = 1000 # trade size, USD: one of the sizes_usd values
MAX_TAX = 5 # skip tokens taxed above 5%
rows = get("/arbitrage/dex-spot", {"min_liquidity": 50000})
rows = [x for x in rows
if x["contract"] and abs(x["spread_pct"]) >= 2]
addrs = sorted({x["contract"].lower() for x in rows})
checks, sizes = {}, []
for i in range(0, len(addrs), 50): # up to 50 addresses per call
d = get("/orderbooks/dex-slippage",
{"contract": ",".join(addrs[i:i + 50])})
sizes = d["sizes_usd"]
for c in d["contracts"]: # addresses come in lowercase
checks[c["contract"]] = c
found = []
for x in rows:
c = checks.get(x["contract"].lower())
if c is None or c["honeypot"] == "yes":
continue # no data, or selling may be impossible
taxes = [t for t in (c["tax_buy_pct"], c["tax_sell_pct"])
if t is not None] # null means no source, not 0%
if any(t > MAX_TAX for t in taxes):
continue
buy = x["spread_pct"] >= 0 # positive: buy on the DEX
ladder = c["slippage_buy_pct" if buy else "slippage_sell_pct"]
k = sizes.index(SIZE)
slip = ladder[k] if k < len(ladder) else None
if slip is None:
continue # the pool lacks liquidity for SIZE
tax = c["tax_buy_pct" if buy else "tax_sell_pct"]
left = abs(x["spread_pct"]) - slip - (tax or 0)
found.append((left, x, c["honeypot"], tax))
for left, x, hp, tax in sorted(found, key=lambda f: -f[0]):
print(f'{x["coin"]:<8} {x["exchange"]:<8} '
f'spread {x["spread_pct"]:+.2f}%, left {left:.2f}%, '
f'tax {"no data" if tax is None else tax}, '
f'honeypot {hp}')
The script does not subtract gas and exchange fees, so add your own network and exchange figures. It skips rows with no data in /orderbooks/dex-slippage: check those tokens by hand through the row's links. Addresses are compared in lowercase because DEX – Spot can return a contract in mixed case, as in the example above.
Poll in a loop no more often than meta.freshness_sec. On Pro that is every 10 seconds: 30 × 86,400 / 10 = 259,200 calls to one endpoint per 30 days against a 5M quota. How to save quota and traffic is covered in How to poll an API without hitting limits.
Risks the spread does not show
- MEV and sandwich attacks. A bot can see your DEX swap before it lands in a block: it buys in front of you, sells right after and takes part of the spread. The wider the slippage tolerance in your wallet, the more it can take; protection is covered in MEV and sandwich attacks on DEXs.
- Token owner powers. If the contract allows it, the owner can raise the tax or block sales after you buy, and today's
honeypot: "no"and zero tax do not protect you from that. Contract permissions and liquidity locks are checked step by step in How to check a token before buying. - Data delay. Prices arrive with your plan's delay and the slippage ladder with its own
updated_at. Before a trade, check the pool price through the row's link and the order book on the exchange. - Transfer to the exchange. Deposits can close while the token is in transit, and crediting waits for network confirmations, a number each exchange sets for itself.
- Gas. On a busy network gas rises and eats the spread on small trades.
Questions and answers
Can I buy a token through Genesis API?
No. Genesis API only returns data and places no orders, neither on DEXs nor on exchanges. You sign DEX swaps in your own wallet and open CEX trades on the exchange yourself.
How often are DEX prices updated in the API?
A pool's price changes with every trade in it and shows from the outside with each new block. The Genesis Arbitrage core refreshes data every second, and the API serves it at your plan's freshness: 10 s on Pro and 5 s on Max, the only plans with the DEX endpoints. The snapshot build time is in meta.updated_at; slippage and taxes carry each contract's own updated_at.
What does null mean in a token tax?
That there is no source for this token's tax data. Do not treat it as zero: the tax could be anything. The Python example above keeps such rows and prints "tax no data" so you can check them by hand.
Which Genesis API plan do I need for DEX data?
Pro ($100 a month) or Max ($200). On Trial and Start, DEX – Spot, DEX – Futures, Cross-chain, DEX Dumps and DEX slippage return 403 plan_restricted.
Do the responses include DexScreener links?
Yes. DEX – Spot and DEX – Futures rows and both Cross-chain sides carry dexscreener_url, dextools_url and gmgn_url, links to the pool or token page. When a link is missing, the field is null. In DEX Dumps the pool link is pool_url, and the others are in the links array.