Market prices are the last traded price of each SwapWallet market, in two quote currencies: USDT (tether) and IRT (Toman). A pair is written TOKEN/QUOTE, so TON/USDT is the price of one TON in tether.
These are reference prices. A swap is priced from the order book at the moment you ask, with the fee included, so use Swaps to get the amount you'd actually receive.
Endpoints
/v1/market/pricesReturns the latest price of every tradable market in one call. Each token is listed against USDT and against IRT; USDT itself appears only as USDT/IRT. A market that is temporarily unavailable is left out.
This endpoint is public and needs no API key. If you do send an Authorization header, the key in it must be valid.
No parameters.
Returns an object in result that maps each pair to its last price, as a decimal string.
curl https://swapwallet.app/api/v1/market/prices \
-H "Authorization: Bearer $SWAPWALLET_API_KEY"const response = await fetch('https://swapwallet.app/api/v1/market/prices', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SWAPWALLET_API_KEY}`,
},
});
const data = await response.json();
console.log(data.result);import os
import requests
response = requests.get(
"https://swapwallet.app/api/v1/market/prices",
headers={"Authorization": f"Bearer {os.environ['SWAPWALLET_API_KEY']}"},
)
print(response.json()["result"])<?php
$ch = curl_init('https://swapwallet.app/api/v1/market/prices');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SWAPWALLET_API_KEY'),
],
]);
$data = json_decode(curl_exec($ch), true);
print_r($data['result']);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://swapwallet.app/api/v1/market/prices", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SWAPWALLET_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
fmt.Println(string(data))
}{
"status": "OK",
"result": {
"ETH/USDT": "2850.4",
"ETH/IRT": "776449000",
"TON/USDT": "0.98",
"TON/IRT": "266950",
"TRX/USDT": "0.2401",
"TRX/IRT": "65400",
"BTC/USDT": "84630.5",
"BTC/IRT": "23053348000",
"USDT/IRT": "272400"
}
}