7290900dc7
Espone sma/rsi/atr/macd/realized_vol/funding_rate sopra CerberoClient delegando a call_tool(exchange, tool, args). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
61 lines
1.8 KiB
Python
61 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from .client import CerberoClient
|
|
|
|
|
|
class CerberoTools:
|
|
"""Sottoinsieme di tool MCP esposti agli agenti in Phase 1."""
|
|
|
|
def __init__(self, client: CerberoClient):
|
|
self._client = client
|
|
|
|
def sma(self, exchange: str, symbol: str, timeframe: str, length: int) -> Any:
|
|
return self._client.call_tool(
|
|
exchange, "sma", {"symbol": symbol, "timeframe": timeframe, "length": length}
|
|
)
|
|
|
|
def rsi(self, exchange: str, symbol: str, timeframe: str, length: int = 14) -> Any:
|
|
return self._client.call_tool(
|
|
exchange, "rsi", {"symbol": symbol, "timeframe": timeframe, "length": length}
|
|
)
|
|
|
|
def atr(self, exchange: str, symbol: str, timeframe: str, length: int = 14) -> Any:
|
|
return self._client.call_tool(
|
|
exchange, "atr", {"symbol": symbol, "timeframe": timeframe, "length": length}
|
|
)
|
|
|
|
def macd(
|
|
self,
|
|
exchange: str,
|
|
symbol: str,
|
|
timeframe: str,
|
|
fast: int = 12,
|
|
slow: int = 26,
|
|
signal: int = 9,
|
|
) -> Any:
|
|
return self._client.call_tool(
|
|
exchange,
|
|
"macd",
|
|
{
|
|
"symbol": symbol,
|
|
"timeframe": timeframe,
|
|
"fast": fast,
|
|
"slow": slow,
|
|
"signal": signal,
|
|
},
|
|
)
|
|
|
|
def realized_vol(
|
|
self, exchange: str, symbol: str, timeframe: str, window: int = 24
|
|
) -> Any:
|
|
return self._client.call_tool(
|
|
exchange,
|
|
"realized_vol",
|
|
{"symbol": symbol, "timeframe": timeframe, "window": window},
|
|
)
|
|
|
|
def funding_rate(self, exchange: str, symbol: str) -> Any:
|
|
return self._client.call_tool(exchange, "funding_rate", {"symbol": symbol})
|