INNER CODE UNIT · Python
get_historical_data
Spoofkapoof/TradingViewMCPServer · tradingview_mcp/server.py:166
def get_historical_data(
symbol: str, timeframe: str = "1h", outputsize: str = "compact"
) -> Dict[str, Any]:
"""
Get historical data for any asset type.
Args:
symbol: Symbol to fetch
timeframe: Timeframe (5m, 15m, 30m, 1h, 4h, 1d)
outputsize: 'compact' or 'full'
Returns:
Historical OHLCV data or error
"""
asset_type, formatted_symbol = detect_asset_type(symbol)
logger.info(f"Fetching historical data for {symbol} ({timeframe})")