import { GoldRushClient } from "@covalenthq/client-sdk";
const ApiServices = async () => {
const client = new GoldRushClient("<GOLDRUSH_API_KEY>");
const resp = await client.PricingService.getPoolSpotPrices({chainName: "chainName", walletAddress: "walletAddress"});
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>"
}Get pool spot prices
Get the spot token pair prices for a specified pool contract address. Supports pools on Uniswap V2, V3 and their forks.
import { GoldRushClient } from "@covalenthq/client-sdk";
const ApiServices = async () => {
const client = new GoldRushClient("<GOLDRUSH_API_KEY>");
const resp = await client.PricingService.getPoolSpotPrices({chainName: "chainName", walletAddress: "walletAddress"});
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
Processing
Authorizations
Bearer authentication header of the form: Bearer <token>, where <token> is your GoldRush API Key.
Path Parameters
The chain name eg: eth-mainnet.
The pool contract address.
Query Parameters
The currency to convert. Supports USD, CAD, EUR, SGD, INR, JPY, VND, CNY, KRW, RUB, TRY, NGN, ARS, AUD, CHF, and GBP.
Response
Successful response
The timestamp when the response was generated.
The deployed pool contract address.
The deployed contract address of token_0 in the token pair making up the pool.
The deployed contract name of token_0 in the token pair making up the pool.
The deployed contract symbol of token_0 in the token pair making up the pool.
Price of token_0 in units of token_1.
Price of token_0 in units of token_1 as of 24 hours ago.
Price of token_0 in the selected quote currency (defaults to USD).
Price of token_0 in the selected quote currency (defaults to USD) as of 24 hours ago.
The deployed contract address of token_1 in the token pair making up the pool.
The deployed contract name of token_1 in the token pair making up the pool.
The deployed contract symbol of token_1 in the token pair making up the pool.
Price of token_1 in units of token_0.
Price of token_1 in units of token_0 as of 24 hours ago.
Price of token_1 in the selected quote currency (defaults to USD).
Price of token_1 in the selected quote currency (defaults to USD) as of 24 hours ago.
The currency to convert. Supports USD, CAD, EUR, SGD, INR, JPY, VND, CNY, KRW, RUB, TRY, NGN, ARS, AUD, CHF, GBP, BTC and ETH.