Calculate how much USD will be received for selling a position
GET
/
market
/
{marketAddress}
/
tokensToUsd
Calculate tokens to USD conversion
Copy
curl --request GET \ --url https://mainnet.base.org/market/{marketAddress}/tokensToUsd
Copy
{ "tokensOut": 123, "usdOut": 123}
This is a smart contract view function. The curl example shown is for illustration. To call this function, use web3 libraries (ethers.js, viem, web3.py) or JSON-RPC directly.