Skip to main content
Glama

analyze_fng_trend

Evaluate Crypto Fear & Greed Index trends over specified days, providing insights on latest value, average, trend direction, and analyzed data points for informed decision-making.

Instructions

Analyze trends in Crypto Fear & Greed Index over specified days.

Parameters: days (int): Number of days to analyze (must be a positive integer).

Returns: str: A string containing the analysis results, including latest value, average value, trend direction, and number of data points analyzed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysYes

Implementation Reference

  • main.py:84-129 (handler)
    The handler function for the analyze_fng_trend tool. It fetches the last 'days' of Fear & Greed Index data from the API, calculates the average value, determines the trend (rising/falling/stable), and formats a summary string with the latest value, average, trend, and data points.
    @mcp.tool() async def analyze_fng_trend(days: int, ctx: Context) -> str: """ Analyze trends in Crypto Fear & Greed Index over specified days. Parameters: days (int): Number of days to analyze (must be a positive integer). Returns: str: A string containing the analysis results, including latest value, average value, trend direction, and number of data points analyzed. """ if days <= 0: return "Error: Days must be a positive integer" ctx.info(f"Fetching {days} days of FNG data") try: async with httpx.AsyncClient() as client: response = await client.get(API_URL, params={"limit": days}) response.raise_for_status() data = response.json()["data"] if not data: return "Error: No data available" values = [int(entry["value"]) for entry in data] total_entries = len(values) # Calculate statistics avg = sum(values) / total_entries trend = "rising" if values[0] > values[-1] else "falling" if values[0] < values[-1] else "stable" latest = data[0] # Most recent entry result = [ f"Fear & Greed Index Analysis ({days} days):", f"Latest Value: {latest['value']} ({latest['value_classification']}) " f"at {datetime.fromtimestamp(int(latest['timestamp']))} UTC", f"Average Value: {avg:.1f}", f"Trend: {trend}", f"Data points analyzed: {total_entries}" ] return "\n".join(result) except httpx.HTTPStatusError as e: return f"Error fetching data: {str(e)}" except Exception as e: return f"Unexpected error: {str(e)}"

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kukapay/crypto-feargreed-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server