"""
Realtime API namespace.

AUTO-GENERATED by scripts/generate_sdk.py - DO NOT EDIT MANUALLY!
Regenerate with: python scripts/generate_sdk.py --category realtime
"""
from __future__ import annotations

from typing import Any, Dict, Optional

from ._base import AsyncBaseAPI, BaseAPI


class RealtimeAPI(BaseAPI):
    """Realtime namespace: calendar, chart, health, quote, quotes."""

    def calendar(
        self,
        *,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get realtime economic calendar

        Get current economic calendar events from realtime feed."""
        _payload: Dict[str, Any] = {}
        return self._call("realtime.calendar", params=_payload, options=options, context=context)

    def chart(
        self,
        *,
        symbol: Optional[str] = None,
        identifier: Optional[str] = None,
        timeframe: Optional[str] = "1D",
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get realtime chart data

        Get OHLC chart data for a symbol+timeframe or by TepiloraCode identifier.

        Args:
        symbol: Symbol identifier (required if no identifier)
        identifier: TepiloraCode — resolves symbol automatically via rt:map:tc
        timeframe: Timeframe: 1D, 5D, 1M, 1Y"""
        _payload: Dict[str, Any] = {}
        if symbol is not None:
            _payload["symbol"] = symbol
        if identifier is not None:
            _payload["identifier"] = identifier
        if timeframe is not None:
            _payload["timeframe"] = timeframe
        return self._call("realtime.chart", params=_payload, options=options, context=context)

    def health(
        self,
        *,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get data source health status

        Get health status for all realtime data sources."""
        _payload: Dict[str, Any] = {}
        return self._call("realtime.health", params=_payload, options=options, context=context)

    def quote(
        self,
        *,
        category: Optional[str] = None,
        symbol: Optional[str] = None,
        identifier: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get single realtime quote

        Get a single realtime quote by category+symbol or by TepiloraCode identifier.

        Args:
        category: Asset category: idx, bond, fx, cmd, crypto, futures, stock (required if no identifier)
        symbol: Symbol identifier e.g. DAX, EURUSD, BTC (required if no identifier)
        identifier: TepiloraCode — resolves category+symbol automatically via rt:map:tc"""
        _payload: Dict[str, Any] = {}
        if category is not None:
            _payload["category"] = category
        if symbol is not None:
            _payload["symbol"] = symbol
        if identifier is not None:
            _payload["identifier"] = identifier
        return self._call("realtime.quote", params=_payload, options=options, context=context)

    def quotes(
        self,
        *,
        category: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get all realtime quotes

        Get all realtime quotes, optionally filtered by category.

        Args:
        category: Filter by category: idx, bond, fx, cmd, crypto, futures, stock"""
        _payload: Dict[str, Any] = {}
        if category is not None:
            _payload["category"] = category
        return self._call("realtime.quotes", params=_payload, options=options, context=context)



class AsyncRealtimeAPI(AsyncBaseAPI):
    """Realtime namespace: calendar, chart, health, quote, quotes."""

    async def calendar(
        self,
        *,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get realtime economic calendar

        Get current economic calendar events from realtime feed."""
        _payload: Dict[str, Any] = {}
        return await self._call("realtime.calendar", params=_payload, options=options, context=context)

    async def chart(
        self,
        *,
        symbol: Optional[str] = None,
        identifier: Optional[str] = None,
        timeframe: Optional[str] = "1D",
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get realtime chart data

        Get OHLC chart data for a symbol+timeframe or by TepiloraCode identifier.

        Args:
        symbol: Symbol identifier (required if no identifier)
        identifier: TepiloraCode — resolves symbol automatically via rt:map:tc
        timeframe: Timeframe: 1D, 5D, 1M, 1Y"""
        _payload: Dict[str, Any] = {}
        if symbol is not None:
            _payload["symbol"] = symbol
        if identifier is not None:
            _payload["identifier"] = identifier
        if timeframe is not None:
            _payload["timeframe"] = timeframe
        return await self._call("realtime.chart", params=_payload, options=options, context=context)

    async def health(
        self,
        *,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get data source health status

        Get health status for all realtime data sources."""
        _payload: Dict[str, Any] = {}
        return await self._call("realtime.health", params=_payload, options=options, context=context)

    async def quote(
        self,
        *,
        category: Optional[str] = None,
        symbol: Optional[str] = None,
        identifier: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get single realtime quote

        Get a single realtime quote by category+symbol or by TepiloraCode identifier.

        Args:
        category: Asset category: idx, bond, fx, cmd, crypto, futures, stock (required if no identifier)
        symbol: Symbol identifier e.g. DAX, EURUSD, BTC (required if no identifier)
        identifier: TepiloraCode — resolves category+symbol automatically via rt:map:tc"""
        _payload: Dict[str, Any] = {}
        if category is not None:
            _payload["category"] = category
        if symbol is not None:
            _payload["symbol"] = symbol
        if identifier is not None:
            _payload["identifier"] = identifier
        return await self._call("realtime.quote", params=_payload, options=options, context=context)

    async def quotes(
        self,
        *,
        category: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Get all realtime quotes

        Get all realtime quotes, optionally filtered by category.

        Args:
        category: Filter by category: idx, bond, fx, cmd, crypto, futures, stock"""
        _payload: Dict[str, Any] = {}
        if category is not None:
            _payload["category"] = category
        return await self._call("realtime.quotes", params=_payload, options=options, context=context)


