Asset & Trade Histories
Endpoint
GET /asset-histories
Usage Scenarios
-
Retrieve trades for a specific order:
- Use the
order_id
,skip
, andtake
parameters.
- Use the
-
Retrieve balance changes for a specific currency:
- Use the
from
,to
,currency_name
,actions
andskip
,take
parameters.
- Use the
-
Retrieve trade history for a specific symbol:
- Use the
from
,to
,symbol_name
,actions
andskip
,take
parameters.
- Use the
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
order_id | string | Optional | Order ID to retrieve trades related to a specific order. (Use for case 1) |
currency_name | string | Optional | Currency name to filter asset changes (e.g., BTC ). (Use for case 2) |
symbol_name | string | Optional | Symbol name to filter trade history (e.g., BTC_USDT ). (Use for case 3) |
from | int64 | Optional | Start of the time range (timestamp in milliseconds). (Use for cases 2 & 3) |
to | int64 | Optional | End of the time range (timestamp in milliseconds). (Use for cases 2 & 3) |
skip | int32 | Yes | Number of records to skip (for pagination). |
take | int32 | Yes | Number of records to retrieve. Maximum is 100 . |
actions | string | Optional | Comma-separated list of actions: 0 (DEPOSIT), 1 (WITHDRAW), 2 (TRADE). (Use for cases 2 & 3) |
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 of Objects
Response Fields
Field | Type | Description |
---|---|---|
e | string | Event ID. |
i | int32 | Asset History Action. |
u | string | User ID. |
t | string | Timestamp of the event (in milliseconds). |
d | string | Onus transaction ID (for DEPOSIT/WITHDRAW). |
c | string | Currency name (for DEPOSIT/WITHDRAW). |
b | string | Balance before the event (for DEPOSIT/WITHDRAW). |
a | string | Balance after the event (for DEPOSIT/WITHDRAW). |
f | string | Order ID (for TRADE). |
g | string | Matched order ID (for TRADE). |
h | string | Symbol name (for TRADE). |
k | string | Base currency (for TRADE). |
l | string | Quote currency (for TRADE). |
m | int32 | Order Action (for TRADE). |
n | int32 | Trade Role (for TRADE). |
o | string | Matched price (for TRADE). |
p | string | Matched size (for TRADE). |
q | string | Fee currency (for TRADE). |
r | string | Fee amount (for TRADE). |
Example Usage
- cURL
- ReactJS
- React Native
- Node.js
- Java
- C#
- Python
- Go
- Rust
curl --location 'https://spot-markets.goonus.io/asset-histories?order_id=3633146456584533411&skip=0&take=100' \
--header 'session-token: xxx'
import React, { useEffect, useState } from 'react';
function AssetHistories() {
const [data, setData] = useState(null);
useEffect(() => {
fetch('https://spot-markets.goonus.io/asset-histories?order_id=3633146456584533411&skip=0&take=100', {
headers: {
'session-token': 'xxx'
}
})
.then(response => response.json())
.then(setData)
.catch(error => console.error('Error:', error));
}, []);
return (
<div>
<h1>Asset Histories</h1>
<pre>{data ? JSON.stringify(data, null, 2) : 'Loading...'}</pre>
</div>
);
}
export default AssetHistories;
import { useEffect } from 'react';
import { Text, View } from 'react-native';
const fetchData = async () => {
try {
const response = await fetch('https://spot-markets.goonus.io/asset-histories?order_id=3633146456584533411&skip=0&take=100', {
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/asset-histories', {
params: {
order_id: '3633146456584533411',
skip: 0,
take: 100
},
headers: {
'session-token': 'xxx'
}
}).then(response => console.log(response.data));
import java.net.http.*;
import java.net.URI;
public class AssetHistories {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://spot-markets.goonus.io/asset-histories?order_id=3633146456584533411&skip=0&take=100"))
.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/asset-histories?order_id=3633146456584533411&skip=0&take=100");
Console.WriteLine(response);
}
}
import requests
url = "https://spot-markets.goonus.io/asset-histories"
params = {"order_id": "3633146456584533411", "skip": 0, "take": 100}
headers = {"session-token": "xxx"}
response = requests.get(url, params=params, headers=headers)
print(response.json())
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://spot-markets.goonus.io/asset-histories?order_id=3633146456584533411&skip=0&take=100"
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/asset-histories")
.query(&[ ("order_id", "3633146456584533411"), ("skip", "0"), ("take", "100") ])
.header("session-token", "xxx")
.send()
.await?
.text()
.await?;
println!("{}", resp);
Ok(())
}
Response Example
[
{
"e": "1",
"i": 1,
"u": "2",
"t": "1720744941579",
"d": "USDT123456",
"c": "USDT",
"b": "100.00000000",
"a": "90.00000000",
"f": "3633146456584533411",
"g": "3633137527440971134",
"h": "ETH_USDT",
"k": "ETH",
"l": "USDT",
"m": 1,
"n": 0,
"o": "3438.50",
"p": "0.00581",
"q": "ETH",
"r": "0.00000581"
}
]