"""
Stocks API namespace.

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

from typing import Any, Dict, List, Optional, Union

from ._base import AsyncBaseAPI, BaseAPI


class StocksAPI(BaseAPI):
    """Stocks namespace: compare, dividends, indicators, momentum, peers, screen, signals, technicals, valuation."""

    def compare(
        self,
        *,
        identifiers: Union[str, List[str]],
        metrics: Optional[List[Any]] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Compare stocks

        Compare multiple stocks.

        Args:
        identifiers: List of TepiloraCodes
        metrics: Metrics to compare"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if metrics is not None:
            params["metrics"] = metrics
        return self._call("stocks.compare", params=params, options=options, context=context, response_format=response_format)

    def dividends(
        self,
        *,
        identifier: str,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Dividend data

        Dividend history and yield.

        Args:
        identifier: TepiloraCode or ISIN"""
        params: Dict[str, Any] = {}
        params["identifier"] = identifier
        return self._call("stocks.dividends", params=params, options=options, context=context, response_format=response_format)

    def indicators(
        self,
        *,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """List indicators

        List available technical indicators."""
        params: Dict[str, Any] = {}
        return self._call("stocks.indicators", params=params, options=options, context=context)

    def momentum(
        self,
        *,
        identifier: Optional[str] = None,
        prices: Optional[Dict[str, Any]] = None,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Momentum analysis

        Calculate momentum indicators.

        Args:
        identifier: TepiloraCode or ISIN
        prices: User-provided prices
        start_date: Start date (YYYY-MM-DD)
        end_date: End date (YYYY-MM-DD)"""
        params: Dict[str, Any] = {}
        if identifier is not None:
            params["identifier"] = identifier
        if prices is not None:
            params["prices"] = prices
        if start_date is not None:
            params["start_date"] = start_date
        if end_date is not None:
            params["end_date"] = end_date
        return self._call("stocks.momentum", params=params, options=options, context=context, response_format=response_format)

    def peers(
        self,
        *,
        identifier: str,
        limit: Optional[int] = 20,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Get peer stocks

        Find peer companies.

        Args:
        identifier: TepiloraCode or ISIN
        limit: Maximum results"""
        params: Dict[str, Any] = {}
        params["identifier"] = identifier
        if limit is not None:
            params["limit"] = limit
        return self._call("stocks.peers", params=params, options=options, context=context, response_format=response_format)

    def screen(
        self,
        *,
        universe: Optional[Dict[str, Any]] = None,
        criteria: Optional[Dict[str, Any]] = None,
        limit: Optional[int] = 50,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Screen stocks

        Screen stocks by technical criteria.

        Args:
        universe: Universe filters
        criteria: Screening criteria
        limit: Maximum results"""
        params: Dict[str, Any] = {}
        if universe is not None:
            params["universe"] = universe
        if criteria is not None:
            params["criteria"] = criteria
        if limit is not None:
            params["limit"] = limit
        return self._call("stocks.screen", params=params, options=options, context=context, response_format=response_format)

    def signals(
        self,
        *,
        identifier: Optional[str] = None,
        prices: Optional[Dict[str, Any]] = None,
        strategy: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Trading signals

        Generate trading signals.

        Args:
        identifier: TepiloraCode or ISIN
        prices: User-provided prices
        strategy: Signal strategy"""
        params: Dict[str, Any] = {}
        if identifier is not None:
            params["identifier"] = identifier
        if prices is not None:
            params["prices"] = prices
        if strategy is not None:
            params["strategy"] = strategy
        return self._call("stocks.signals", params=params, options=options, context=context, response_format=response_format)

    def technicals(
        self,
        *,
        identifier: Optional[str] = None,
        prices: Optional[Dict[str, Any]] = None,
        indicators: Optional[List[Any]] = None,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Technical indicators

        Calculate technical indicators (SMA, RSI, MACD, etc.).

        Args:
        identifier: TepiloraCode or ISIN
        prices: User-provided prices
        indicators: Indicators to calculate
        start_date: Start date (YYYY-MM-DD)
        end_date: End date (YYYY-MM-DD)"""
        params: Dict[str, Any] = {}
        if identifier is not None:
            params["identifier"] = identifier
        if prices is not None:
            params["prices"] = prices
        if indicators is not None:
            params["indicators"] = indicators
        if start_date is not None:
            params["start_date"] = start_date
        if end_date is not None:
            params["end_date"] = end_date
        return self._call("stocks.technicals", params=params, options=options, context=context, response_format=response_format)

    def valuation(
        self,
        *,
        identifier: str,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Valuation metrics

        PE, PB, EV/EBITDA, etc.

        Args:
        identifier: TepiloraCode or ISIN"""
        params: Dict[str, Any] = {}
        params["identifier"] = identifier
        return self._call("stocks.valuation", params=params, options=options, context=context, response_format=response_format)



class AsyncStocksAPI(AsyncBaseAPI):
    """Stocks namespace: compare, dividends, indicators, momentum, peers, screen, signals, technicals, valuation."""

    async def compare(
        self,
        *,
        identifiers: Union[str, List[str]],
        metrics: Optional[List[Any]] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Compare stocks

        Compare multiple stocks.

        Args:
        identifiers: List of TepiloraCodes
        metrics: Metrics to compare"""
        params: Dict[str, Any] = {}
        params["identifiers"] = identifiers
        if metrics is not None:
            params["metrics"] = metrics
        return await self._call("stocks.compare", params=params, options=options, context=context, response_format=response_format)

    async def dividends(
        self,
        *,
        identifier: str,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Dividend data

        Dividend history and yield.

        Args:
        identifier: TepiloraCode or ISIN"""
        params: Dict[str, Any] = {}
        params["identifier"] = identifier
        return await self._call("stocks.dividends", params=params, options=options, context=context, response_format=response_format)

    async def indicators(
        self,
        *,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """List indicators

        List available technical indicators."""
        params: Dict[str, Any] = {}
        return await self._call("stocks.indicators", params=params, options=options, context=context)

    async def momentum(
        self,
        *,
        identifier: Optional[str] = None,
        prices: Optional[Dict[str, Any]] = None,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Momentum analysis

        Calculate momentum indicators.

        Args:
        identifier: TepiloraCode or ISIN
        prices: User-provided prices
        start_date: Start date (YYYY-MM-DD)
        end_date: End date (YYYY-MM-DD)"""
        params: Dict[str, Any] = {}
        if identifier is not None:
            params["identifier"] = identifier
        if prices is not None:
            params["prices"] = prices
        if start_date is not None:
            params["start_date"] = start_date
        if end_date is not None:
            params["end_date"] = end_date
        return await self._call("stocks.momentum", params=params, options=options, context=context, response_format=response_format)

    async def peers(
        self,
        *,
        identifier: str,
        limit: Optional[int] = 20,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Get peer stocks

        Find peer companies.

        Args:
        identifier: TepiloraCode or ISIN
        limit: Maximum results"""
        params: Dict[str, Any] = {}
        params["identifier"] = identifier
        if limit is not None:
            params["limit"] = limit
        return await self._call("stocks.peers", params=params, options=options, context=context, response_format=response_format)

    async def screen(
        self,
        *,
        universe: Optional[Dict[str, Any]] = None,
        criteria: Optional[Dict[str, Any]] = None,
        limit: Optional[int] = 50,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Screen stocks

        Screen stocks by technical criteria.

        Args:
        universe: Universe filters
        criteria: Screening criteria
        limit: Maximum results"""
        params: Dict[str, Any] = {}
        if universe is not None:
            params["universe"] = universe
        if criteria is not None:
            params["criteria"] = criteria
        if limit is not None:
            params["limit"] = limit
        return await self._call("stocks.screen", params=params, options=options, context=context, response_format=response_format)

    async def signals(
        self,
        *,
        identifier: Optional[str] = None,
        prices: Optional[Dict[str, Any]] = None,
        strategy: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Trading signals

        Generate trading signals.

        Args:
        identifier: TepiloraCode or ISIN
        prices: User-provided prices
        strategy: Signal strategy"""
        params: Dict[str, Any] = {}
        if identifier is not None:
            params["identifier"] = identifier
        if prices is not None:
            params["prices"] = prices
        if strategy is not None:
            params["strategy"] = strategy
        return await self._call("stocks.signals", params=params, options=options, context=context, response_format=response_format)

    async def technicals(
        self,
        *,
        identifier: Optional[str] = None,
        prices: Optional[Dict[str, Any]] = None,
        indicators: Optional[List[Any]] = None,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Technical indicators

        Calculate technical indicators (SMA, RSI, MACD, etc.).

        Args:
        identifier: TepiloraCode or ISIN
        prices: User-provided prices
        indicators: Indicators to calculate
        start_date: Start date (YYYY-MM-DD)
        end_date: End date (YYYY-MM-DD)"""
        params: Dict[str, Any] = {}
        if identifier is not None:
            params["identifier"] = identifier
        if prices is not None:
            params["prices"] = prices
        if indicators is not None:
            params["indicators"] = indicators
        if start_date is not None:
            params["start_date"] = start_date
        if end_date is not None:
            params["end_date"] = end_date
        return await self._call("stocks.technicals", params=params, options=options, context=context, response_format=response_format)

    async def valuation(
        self,
        *,
        identifier: str,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
        response_format: Optional[str] = None,
    ) -> Any:
        """Valuation metrics

        PE, PB, EV/EBITDA, etc.

        Args:
        identifier: TepiloraCode or ISIN"""
        params: Dict[str, Any] = {}
        params["identifier"] = identifier
        return await self._call("stocks.valuation", params=params, options=options, context=context, response_format=response_format)


