Trades
Retrieve recent trade transactions for a specific symbol.
Endpoint
GET /trades
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
symbol_name | string | Yes | The trading pair symbol (e.g., BTC_USDT ). |
Response
JSON Array of Objects
Response Fields
Field | Type | Description |
---|---|---|
a | int8 | Order Action |
p | string | Price at which the trade occurred. |
v | string | Volume of the base coin traded (e.g., BTC for BTC_USDT ). |
t | string | Timestamp when the trade occurred (in milliseconds). |
Example Usage
- cURL
- ReactJS
- React Native
- Node.js
- Java
- C#
- Python
- Go
- Rust
curl --location 'https://spot-markets.goonus.io/trades?symbol_name=BTC_USDT'
import React, { useEffect, useState } from 'react';
function Trades() {
const [data, setData] = useState(null);
useEffect(() => {
fetch('https://spot-markets.goonus.io/trades?symbol_name=BTC_USDT')
.then(response => response.json())
.then(setData)
.catch(error => console.error('Error:', error));
}, []);
return (
<div>
<h1>Recent Trades</h1>
<pre>{data ? JSON.stringify(data, null, 2) : 'Loading...'}</pre>
</div>
);
}
export default Trades;
import { useEffect } from 'react';
import { Text, View } from 'react-native';
const fetchData = async () => {
try {
const response = await fetch('https://spot-markets.goonus.io/trades?symbol_name=BTC_USDT');
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/trades', {
params: {
symbol_name: 'BTC_USDT'
}
})
.then(response => console.log(response.data))
.catch(error => console.error('Error:', error));
import java.net.http.*;
import java.net.URI;
public class Trades {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://spot-markets.goonus.io/trades?symbol_name=BTC_USDT"))
.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();
var response = await client.GetStringAsync("https://spot-markets.goonus.io/trades?symbol_name=BTC_USDT");
Console.WriteLine(response);
}
}
import requests
url = "https://spot-markets.goonus.io/trades?symbol_name=BTC_USDT"
response = requests.get(url)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://spot-markets.goonus.io/trades?symbol_name=BTC_USDT"
resp, err := http.Get(url)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(body))
}
use reqwest;
use tokio;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let resp = reqwest::get("https://spot-markets.goonus.io/trades?symbol_name=BTC_USDT").await?.text().await?;
println!("{}", resp);
Ok(())
}
Response Example
[
{
"a": 0,
"p": "3.0000000",
"v": "0.050",
"t": "1720780956931"
},
{
"a": 1,
"p": "3.0000000",
"v": "0.150",
"t": "1720780957097"
},
{
"a": 0,
"p": "2.0000000",
"v": "0.100",
"t": "1720780957097"
}
]
note
- Sorting: Transactions are sorted from oldest to newest.