Skip to main content

Asset & Trade Histories

Endpoint

GET /asset-histories

Usage Scenarios

  1. Retrieve trades for a specific order:

    • Use the order_id, skip, and take parameters.
  2. Retrieve balance changes for a specific currency:

    • Use the from, to, currency_name, actions and skip, take parameters.
  3. Retrieve trade history for a specific symbol:

    • Use the from, to, symbol_name, actions and skip, take parameters.

Parameters

ParameterTypeRequiredDescription
order_idstringOptionalOrder ID to retrieve trades related to a specific order. (Use for case 1)
currency_namestringOptionalCurrency name to filter asset changes (e.g., BTC). (Use for case 2)
symbol_namestringOptionalSymbol name to filter trade history (e.g., BTC_USDT). (Use for case 3)
fromint64OptionalStart of the time range (timestamp in milliseconds). (Use for cases 2 & 3)
toint64OptionalEnd of the time range (timestamp in milliseconds). (Use for cases 2 & 3)
skipint32YesNumber of records to skip (for pagination).
takeint32YesNumber of records to retrieve. Maximum is 100.
actionsstringOptionalComma-separated list of actions: 0 (DEPOSIT), 1 (WITHDRAW), 2 (TRADE). (Use for cases 2 & 3)

Headers

HeaderTypeRequiredDescription
session-tokenstringYesAuthorization token.
api-keystringYesAPI 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

FieldTypeDescription
estringEvent ID.
iint32Asset History Action.
ustringUser ID.
tstringTimestamp of the event (in milliseconds).
dstringOnus transaction ID (for DEPOSIT/WITHDRAW).
cstringCurrency name (for DEPOSIT/WITHDRAW).
bstringBalance before the event (for DEPOSIT/WITHDRAW).
astringBalance after the event (for DEPOSIT/WITHDRAW).
fstringOrder ID (for TRADE).
gstringMatched order ID (for TRADE).
hstringSymbol name (for TRADE).
kstringBase currency (for TRADE).
lstringQuote currency (for TRADE).
mint32Order Action (for TRADE).
nint32Trade Role (for TRADE).
ostringMatched price (for TRADE).
pstringMatched size (for TRADE).
qstringFee currency (for TRADE).
rstringFee amount (for TRADE).

Example Usage

curl --location 'https://spot-markets.goonus.io/asset-histories?order_id=3633146456584533411&skip=0&take=100' \
--header 'session-token: xxx'

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"
}
]