GoldRush SDK
import { GoldRushClient } from "@covalenthq/client-sdk";
const ApiServices = async () => {
const client = new GoldRushClient("<GOLDRUSH_API_KEY>");
const resp = await client.PricingService.getPoolSpotPrices("eth-mainnet", "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984");
console.log(resp.data);
};
ApiServices();curl --request GET \
--url https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"updated_at": "2023-11-07T05:31:56Z",
"pool_address": "<string>",
"token_0_address": "<string>",
"token_0_name": "<string>",
"token_0_ticker": "<string>",
"token_0_price": "<string>",
"token_0_price_24h": "<string>",
"token_0_price_quote": "<string>",
"token_0_price_24h_quote": "<string>",
"token_1_address": "<string>",
"token_1_name": "<string>",
"token_1_ticker": "<string>",
"token_1_price": "<string>",
"token_1_price_24h": "<string>",
"token_1_price_quote": "<string>",
"token_1_price_24h_quote": "<string>",
"quote_currency": "<string>"
}Prices
DEX Pool Spot Price API
Get the spot token pair prices for a specified pool contract address. Supports pools on Uniswap V2, V3 and their forks.
GET
/
v1
/
pricing
/
spot_prices
/
{chainName}
/
pools
/
{contractAddress}
/
GoldRush SDK
import { GoldRushClient } from "@covalenthq/client-sdk";
const ApiServices = async () => {
const client = new GoldRushClient("<GOLDRUSH_API_KEY>");
const resp = await client.PricingService.getPoolSpotPrices("eth-mainnet", "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984");
console.log(resp.data);
};
ApiServices();curl --request GET \
--url https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.covalenthq.com/v1/pricing/spot_prices/{chainName}/pools/{contractAddress}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"updated_at": "2023-11-07T05:31:56Z",
"pool_address": "<string>",
"token_0_address": "<string>",
"token_0_name": "<string>",
"token_0_ticker": "<string>",
"token_0_price": "<string>",
"token_0_price_24h": "<string>",
"token_0_price_quote": "<string>",
"token_0_price_24h_quote": "<string>",
"token_1_address": "<string>",
"token_1_name": "<string>",
"token_1_ticker": "<string>",
"token_1_price": "<string>",
"token_1_price_24h": "<string>",
"token_1_price_quote": "<string>",
"token_1_price_24h_quote": "<string>",
"quote_currency": "<string>"
}Credit Cost
1 per call
Processing
Batch
Estimate your monthly cost for this API using the Pricing Calculator.
Supports pools on Uniswap V2, V3 and their forks on all Foundational Chains.
Authorizations
Path Parameters
Query Parameters
Response
200 - application/json
Successful response