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

HeaderDescription
AuthorizationBearer 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

FieldTypeDescription
datefloatThe timestamp for when the trend started (in milliseconds since the epoch).
trendstringIndicates the current trend of the specified coin. Possible values are "up", "down", or "neutral".
trend_started_onstringThe date and time when the current trend began, in ISO 8601 format.
price_on_trend_startfloatThe price of the coin when the current trend began.
duration_in_daysintegerThe number of days that the trend has persisted.
peak_gainfloatThe maximum percentage gain reached during this trend.
peak_lossfloatThe maximum percentage loss reached during this trend.
max_pricefloatThe highest price of the coin recorded during this trend.
min_pricefloatThe 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));