Treasury
Conversions
Convert between assets in your available balance — for example BTC to USDT before a payout run.
Quote or convert
POST
/v1/conversionsBody
fromstringrequiredAsset code to sell, e.g. BTC.
tostringrequiredAsset code to receive, e.g. USDT_TRC20.
amountstringrequiredAmount of
from to convert.quote_onlybooleanReturn a quote without moving funds.
Shell
curl https://lipacoin.io/api/v1/conversions \
-H "Authorization: Bearer $LIPACOIN_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{ "from": "BTC", "to": "USDT_TRC20", "amount": "0.01", "quote_only": true }'Quote
{
"from": "BTC",
"to": "USDT_TRC20",
"from_amount": "0.01",
"to_amount": "958.17",
"rate": "96298.67",
"fee_amount": "4.81493350"
}Without quote_only the conversion executes immediately at a fresh rate and returns the conversion record (id, from_asset, to_asset, from_amount, to_amount, rate, fee_amount, created_at).
The rate is our oracle mid-price; a 0.5% spread is taken from the output (
fee_amount, in the to asset). The output is rounded down to the asset's precision. Insufficient balance returns insufficient_funds. Use an Idempotency-Key so a retried request can't convert twice.