Recent Trends

393 words · 2 min read

Overview

This documentation describes how to use the Recent Trends endpoint to access information on trend changes for various cryptocurrencies that occurred within a specified number of days.

Endpoint

GET /api/v2/market/recent-trend-change/<DAYS-AGO>

Retrieve trend change information for cryptocurrencies, limited to changes that occurred within the specified number of days.

Base URL

https://api.guavy.com

Full Endpoint Example

https://api.guavy.com/api/v2/market/recent-trend-change/<DAYS-AGO>

Replace <DAYS-AGO> with the desired number of days (e.g., 7 for changes that occurred in the last 7 days).

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 a list of recent trend changes for various cryptocurrencies within the specified time frame.

Example Response

{
  "Success": [
    {
      "date": 1727337600000.0,
      "trend": "up",
      "coin": "SOL",
      "trend_started_on": "2024-09-26T08:00:00.000Z",
      "price_on_trend_start": 151.74378288210804,
      "duration_in_days": 1
    }
  ]
}

Field Descriptions

FieldTypeDescription
datefloatThe date of the trend change in milliseconds since the epoch.
trendstringThe trend direction after the change. Possible values are "up", "down", and "neutral".
coinstringThe ticker symbol of the cryptocurrency experiencing the trend change.
trend_started_onstringThe start date and time of the new trend in ISO 8601 format.
price_on_trend_startfloatThe price of the cryptocurrency at the start of the new trend.
duration_in_daysintegerThe duration of the trend in days.

Code Examples

cURL

curl -X GET "https://api.guavy.com/api/v2/market/recent-trend-change/7" \
-H "Authorization: Bearer YOUR-API-KEY"

Python (requests library)

import requests

url = "https://api.guavy.com/api/v2/market/recent-trend-change/7"
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/recent-trend-change/7", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR-API-KEY",
  },
})
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.error("Error:", error));