Find gains and losses data for a specific coin over different time intervals. On Coinranking we use this endpoint on our coin detail page.
https://api.coinranking.com/v2/coin/:uuid/gains-and-losses
Parameter | Description |
---|---|
uuid String | UUID of the coin you want to request gains and losses for. UUIDs of coins can be found using the Get coins endpoint or by checking the URL on coinranking.com, e.g. https://coinranking.com/coin/Qwsogvtv82FCd+bitcoin-btc is the URL for Bitcoin, and the part before the + (Qwsogvtv82FCd) is the UUID. |
Parameter | Description |
---|---|
referenceCurrencyUuid (optional) String |
UUID of coin (either fiat or crypto), in which all the prices are calculated. Defaults to US Dollar, but you can use any coin. You can find UUIDs for reference currencies in any coin endpoint, including a convenient dedicated reference currency endpoint Default value: yhjMzLPhuIDlExample:
...coin/Qwsogvtv82FCd/gains-and-losses?referenceCurrencyUuid=5k-_VTxqtCEI
|
interval (optional) String |
Time interval for the gains and losses calculation Default value: dayAllowed values: day week month Example:
...coin/Qwsogvtv82FCd/gains-and-losses?interval=week
|
limit (optional) Number |
Number of gains and losses entries to return Default value: 50 Maximum value: 100Example:
...coin/Qwsogvtv82FCd/gains-and-losses?limit=25
|
jsonHTTP/1.1 200 OK
{
"status": "success",
"data": {
"gainsAndLosses": [
{
"timestamp": 1640995200,
"price": "47156.85",
"change": "2.34"
},
{
"timestamp": 1640908800,
"price": "46078.12",
"change": "-1.87"
},
{
"timestamp": 1640822400,
"price": "46952.73",
"change": "0.92"
}
]
}
}
Property | Description |
---|---|
status String |
Status of the request Allowed values:success |
data Object |
|
data.gainsAndLosses Object[] |
Array of gains and losses data points |
data.gainsAndLosses.timestamp Number |
Epoch timestamp of the data point |
data.gainsAndLosses.price String |
Price of the coin at this timestamp |
data.gainsAndLosses.change String |
Percentage change from the previous interval |
jsonHTTP/1.1 404 Not Found
{
"status": "fail",
"type": "COIN_NOT_FOUND",
"message": "Coin not found"
}