Current Trend
398 words · 2 min read
Overview
This documentation describes how to use the Current Trend endpoint to access the current market trend data for various cryptocurrencies.
Endpoint
GET /api/v2/market/current-trend/<COIN>
Retrieve the current trend information for a specified cryptocurrency.
Base URL
https://api.guavy.com
Full Endpoint Example
https://api.guavy.com/api/v2/market/current-trend/<COIN>
Replace <COIN> with the desired cryptocurrency symbol, such as BTC for Bitcoin.
Authentication
This API requires authentication using a Bearer token. Include your API key in the request header as shown below.
Request Headers
| Header | Description | 
|---|---|
| Authorization | Bearer token for API authentication. | 
Example Header
-H "Authorization: Bearer YOUR-API-KEY"
Response Format
The response returns data in JSON format, containing details about the market's trend for the specified cryptocurrency.
Example Response
{
  "Success": {
    "date": 1726992000000.0,
    "trend": "up",
    "trend_started_on": "2024-09-22T08:00:00.000Z",
    "price_on_trend_start": 62971.70020817039,
    "duration_in_days": 35,
    "peak_gain": 8.748816541705867,
    "peak_loss": -3.7212031592763415,
    "max_price": 68480.97873257623,
    "min_price": 60628.39531057393
  }
}
Field Descriptions
| Field | Type | Description | 
|---|---|---|
| date | float | The timestamp for when the trend started (in milliseconds since the epoch). | 
| trend | string | Indicates the current trend of the specified coin. Possible values are "up","down", or"neutral". | 
| trend_started_on | string | The date and time when the current trend began, in ISO 8601 format. | 
| price_on_trend_start | float | The price of the coin when the current trend began. | 
| duration_in_days | integer | The number of days that the trend has persisted. | 
| peak_gain | float | The maximum percentage gain reached during this trend. | 
| peak_loss | float | The maximum percentage loss reached during this trend. | 
| max_price | float | The highest price of the coin recorded during this trend. | 
| min_price | float | The lowest price of the coin recorded during this trend. | 
Code Examples
cURL
curl -X GET "https://api.guavy.com/api/v2/market/current-trend/BTC" \
-H "Authorization: Bearer YOUR-API-KEY"
Python (requests library)
import requests
url = "https://api.guavy.com/api/v2/market/current-trend/BTC"
headers = {
    "Authorization": "Bearer YOUR-API-KEY"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print("Failed to retrieve data:", response.status_code)
JavaScript (fetch API)
fetch("https://api.guavy.com/api/v2/market/current-trend/BTC", {
    method: "GET",
    headers: {
        "Authorization": "Bearer YOUR-API-KEY"
    }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));