Balance
Endpoint
GET /balance
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
currency_name | string | Yes | Currency name (e.g., USDT ). |
Headers
Header | Type | Required | Description |
---|---|---|---|
session-token | string | Yes | Authorization token. |
api-key | string | Yes | API key for user authentication. |
Note: You must provide either session-token
or api-key
in the headers for authentication.
Response
JSON Array containing a single object
Response Fields
Field | Type | Description |
---|---|---|
u | string | User ID. |
c | string | Currency name (e.g., ETH , USDT ). |
t | string | Total balance. |
a | string | Available balance. |
l | string | Last updated timestamp (in milliseconds). |
Example Usage
- cURL
- ReactJS
- React Native
- Node.js
- Java
- C#
- Python
- Go
- Rust
curl --location 'https://spot-markets.goonus.io/balance?currency_name=USDT' \
--header 'session-token: xxx'
import React, { useEffect, useState } from 'react';
function Balance() {
const [data, setData] = useState(null);
useEffect(() => {
fetch('https://spot-markets.goonus.io/balance?currency_name=USDT', {
headers: {
'session-token': 'xxx'
}
})
.then(response => response.json())
.then(setData)
.catch(error => console.error('Error:', error));
}, []);
return (
<div>
<h1>Balance</h1>
<pre>{data ? JSON.stringify(data, null, 2) : 'Loading...'}</pre>
</div>
);
}
export default Balance;
import { useEffect } from 'react';
import { Text, View } from 'react-native';
const fetchData = async () => {
try {
const response = await fetch('https://spot-markets.goonus.io/balance?currency_name=USDT', {
headers: {
'session-token': 'xxx'
}
});
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
};
export default function App() {
useEffect(() => {
fetchData();
}, []);
return (
<View>
<Text>Check console for API data.</Text>
</View>
);
}
const axios = require('axios');
axios.get('https://spot-markets.goonus.io/balance', {
params: {
currency_name: 'USDT'
},
headers: {
'session-token': 'xxx'
}
})
.then(response => console.log(response.data))
.catch(error => console.error('Error:', error));
import java.net.http.*;
import java.net.URI;
public class Balance {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://spot-markets.goonus.io/balance?currency_name=USDT"))
.header("session-token", "xxx")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program {
static async Task Main(string[] args) {
var client = new HttpClient();
client.DefaultRequestHeaders.Add("session-token", "xxx");
var response = await client.GetStringAsync("https://spot-markets.goonus.io/balance?currency_name=USDT");
Console.WriteLine(response);
}
}
import requests
url = "https://spot-markets.goonus.io/balance?currency_name=USDT"
headers = {"session-token": "xxx"}
response = requests.get(url, headers=headers)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://spot-markets.goonus.io/balance?currency_name=USDT"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("session-token", "xxx")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
use reqwest;
use tokio;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let resp = client
.get("https://spot-markets.goonus.io/balance?currency_name=USDT")
.header("session-token", "xxx")
.send()
.await?
.text()
.await?;
println!("{}", resp);
Ok(())
}
Response Example
[
{
"u": "1",
"c": "ETH",
"t": "99.20000000",
"a": "99.03000000",
"l": "1720747770838"
}
]