# coding: utf-8

"""
    qoery

    The Cheapest DeFi Data API.

    The version of the OpenAPI document: 0.1.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from datetime import datetime
from pydantic import Field, StrictStr, field_validator
from typing import Optional
from typing_extensions import Annotated
from qoery._internal.models.candles_response import CandlesResponse
from qoery._internal.models.ticks_response import TicksResponse

from qoery._internal.api_client import ApiClient, RequestSerialized
from qoery._internal.api_response import ApiResponse
from qoery._internal.rest import RESTResponseType


class MarketDataApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def candles_get(
        self,
        interval: Annotated[str, Field(strict=True, description="Candle time interval. Fully flexible. Format: `[number][unit]` where unit is: - `s` = seconds (e.g., \"30s\", \"45s\") - `m` = minutes (e.g., \"1m\", \"5m\", \"15m\") - `h` = hours (e.g., \"1h\", \"4h\", \"12h\") - `d` = days (e.g., \"1d\")  Maximum: 1d ")],
        symbol: Annotated[Optional[StrictStr], Field(description="Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        pool: Annotated[Optional[StrictStr], Field(description="Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Start timestamp (ISO 8601 format). **Default:** Calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago). ")] = None,
        to: Annotated[Optional[datetime], Field(description="End timestamp (ISO 8601 format). **Default:** Current time (live data). ")] = None,
        networks: Annotated[Optional[StrictStr], Field(description="Comma-separated list of networks to query. **Supported networks:** ethereum, arbitrum, polygon, base, optimism **Default:** If not specified, queries `ethereum` first (fastest), then expands to `ethereum,arbitrum,polygon` if no results found. ")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum number of candles to return. Defaults to 5. Maximum is 100.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> CandlesResponse:
        """Get OHLCV Candles

        Fetch OHLCV candles for a given symbol pair OR specific pool.  **Required:** Provide either `symbol` OR `pool` parameter (mutually exclusive).  **Optimization:** Use `pool` address for faster response (1 subgraph request vs 2).  **Time Range Defaults:** - If `from` is omitted: calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago) - If `to` is omitted: defaults to current time (live data)  **Credits:** Each GraphQL query costs 1 credit. Total credits depend on data fetched (swaps, time range, pagination). Using `pool` skips discovery and is more efficient.

        :param interval: Candle time interval. Fully flexible. Format: `[number][unit]` where unit is: - `s` = seconds (e.g., \"30s\", \"45s\") - `m` = minutes (e.g., \"1m\", \"5m\", \"15m\") - `h` = hours (e.g., \"1h\", \"4h\", \"12h\") - `d` = days (e.g., \"1d\")  Maximum: 1d  (required)
        :type interval: str
        :param symbol: Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type symbol: str
        :param pool: Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type pool: str
        :param var_from: Start timestamp (ISO 8601 format). **Default:** Calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago). 
        :type var_from: datetime
        :param to: End timestamp (ISO 8601 format). **Default:** Current time (live data). 
        :type to: datetime
        :param networks: Comma-separated list of networks to query. **Supported networks:** ethereum, arbitrum, polygon, base, optimism **Default:** If not specified, queries `ethereum` first (fastest), then expands to `ethereum,arbitrum,polygon` if no results found. 
        :type networks: str
        :param limit: Maximum number of candles to return. Defaults to 5. Maximum is 100.
        :type limit: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._candles_get_serialize(
            interval=interval,
            symbol=symbol,
            pool=pool,
            var_from=var_from,
            to=to,
            networks=networks,
            limit=limit,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CandlesResponse",
            '400': "Error",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def candles_get_with_http_info(
        self,
        interval: Annotated[str, Field(strict=True, description="Candle time interval. Fully flexible. Format: `[number][unit]` where unit is: - `s` = seconds (e.g., \"30s\", \"45s\") - `m` = minutes (e.g., \"1m\", \"5m\", \"15m\") - `h` = hours (e.g., \"1h\", \"4h\", \"12h\") - `d` = days (e.g., \"1d\")  Maximum: 1d ")],
        symbol: Annotated[Optional[StrictStr], Field(description="Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        pool: Annotated[Optional[StrictStr], Field(description="Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Start timestamp (ISO 8601 format). **Default:** Calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago). ")] = None,
        to: Annotated[Optional[datetime], Field(description="End timestamp (ISO 8601 format). **Default:** Current time (live data). ")] = None,
        networks: Annotated[Optional[StrictStr], Field(description="Comma-separated list of networks to query. **Supported networks:** ethereum, arbitrum, polygon, base, optimism **Default:** If not specified, queries `ethereum` first (fastest), then expands to `ethereum,arbitrum,polygon` if no results found. ")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum number of candles to return. Defaults to 5. Maximum is 100.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[CandlesResponse]:
        """Get OHLCV Candles

        Fetch OHLCV candles for a given symbol pair OR specific pool.  **Required:** Provide either `symbol` OR `pool` parameter (mutually exclusive).  **Optimization:** Use `pool` address for faster response (1 subgraph request vs 2).  **Time Range Defaults:** - If `from` is omitted: calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago) - If `to` is omitted: defaults to current time (live data)  **Credits:** Each GraphQL query costs 1 credit. Total credits depend on data fetched (swaps, time range, pagination). Using `pool` skips discovery and is more efficient.

        :param interval: Candle time interval. Fully flexible. Format: `[number][unit]` where unit is: - `s` = seconds (e.g., \"30s\", \"45s\") - `m` = minutes (e.g., \"1m\", \"5m\", \"15m\") - `h` = hours (e.g., \"1h\", \"4h\", \"12h\") - `d` = days (e.g., \"1d\")  Maximum: 1d  (required)
        :type interval: str
        :param symbol: Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type symbol: str
        :param pool: Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type pool: str
        :param var_from: Start timestamp (ISO 8601 format). **Default:** Calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago). 
        :type var_from: datetime
        :param to: End timestamp (ISO 8601 format). **Default:** Current time (live data). 
        :type to: datetime
        :param networks: Comma-separated list of networks to query. **Supported networks:** ethereum, arbitrum, polygon, base, optimism **Default:** If not specified, queries `ethereum` first (fastest), then expands to `ethereum,arbitrum,polygon` if no results found. 
        :type networks: str
        :param limit: Maximum number of candles to return. Defaults to 5. Maximum is 100.
        :type limit: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._candles_get_serialize(
            interval=interval,
            symbol=symbol,
            pool=pool,
            var_from=var_from,
            to=to,
            networks=networks,
            limit=limit,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CandlesResponse",
            '400': "Error",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def candles_get_without_preload_content(
        self,
        interval: Annotated[str, Field(strict=True, description="Candle time interval. Fully flexible. Format: `[number][unit]` where unit is: - `s` = seconds (e.g., \"30s\", \"45s\") - `m` = minutes (e.g., \"1m\", \"5m\", \"15m\") - `h` = hours (e.g., \"1h\", \"4h\", \"12h\") - `d` = days (e.g., \"1d\")  Maximum: 1d ")],
        symbol: Annotated[Optional[StrictStr], Field(description="Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        pool: Annotated[Optional[StrictStr], Field(description="Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Start timestamp (ISO 8601 format). **Default:** Calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago). ")] = None,
        to: Annotated[Optional[datetime], Field(description="End timestamp (ISO 8601 format). **Default:** Current time (live data). ")] = None,
        networks: Annotated[Optional[StrictStr], Field(description="Comma-separated list of networks to query. **Supported networks:** ethereum, arbitrum, polygon, base, optimism **Default:** If not specified, queries `ethereum` first (fastest), then expands to `ethereum,arbitrum,polygon` if no results found. ")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Maximum number of candles to return. Defaults to 5. Maximum is 100.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get OHLCV Candles

        Fetch OHLCV candles for a given symbol pair OR specific pool.  **Required:** Provide either `symbol` OR `pool` parameter (mutually exclusive).  **Optimization:** Use `pool` address for faster response (1 subgraph request vs 2).  **Time Range Defaults:** - If `from` is omitted: calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago) - If `to` is omitted: defaults to current time (live data)  **Credits:** Each GraphQL query costs 1 credit. Total credits depend on data fetched (swaps, time range, pagination). Using `pool` skips discovery and is more efficient.

        :param interval: Candle time interval. Fully flexible. Format: `[number][unit]` where unit is: - `s` = seconds (e.g., \"30s\", \"45s\") - `m` = minutes (e.g., \"1m\", \"5m\", \"15m\") - `h` = hours (e.g., \"1h\", \"4h\", \"12h\") - `d` = days (e.g., \"1d\")  Maximum: 1d  (required)
        :type interval: str
        :param symbol: Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type symbol: str
        :param pool: Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type pool: str
        :param var_from: Start timestamp (ISO 8601 format). **Default:** Calculated based on `interval` and `limit` to fetch only the requested number of candles (e.g., with `limit=5` and `interval=15m`, defaults to 75 minutes ago). 
        :type var_from: datetime
        :param to: End timestamp (ISO 8601 format). **Default:** Current time (live data). 
        :type to: datetime
        :param networks: Comma-separated list of networks to query. **Supported networks:** ethereum, arbitrum, polygon, base, optimism **Default:** If not specified, queries `ethereum` first (fastest), then expands to `ethereum,arbitrum,polygon` if no results found. 
        :type networks: str
        :param limit: Maximum number of candles to return. Defaults to 5. Maximum is 100.
        :type limit: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._candles_get_serialize(
            interval=interval,
            symbol=symbol,
            pool=pool,
            var_from=var_from,
            to=to,
            networks=networks,
            limit=limit,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "CandlesResponse",
            '400': "Error",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _candles_get_serialize(
        self,
        interval,
        symbol,
        pool,
        var_from,
        to,
        networks,
        limit,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if symbol is not None:
            
            _query_params.append(('symbol', symbol))
            
        if pool is not None:
            
            _query_params.append(('pool', pool))
            
        if interval is not None:
            
            _query_params.append(('interval', interval))
            
        if var_from is not None:
            if isinstance(var_from, datetime):
                _query_params.append(
                    (
                        'from',
                        var_from.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('from', var_from))
            
        if to is not None:
            if isinstance(to, datetime):
                _query_params.append(
                    (
                        'to',
                        to.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('to', to))
            
        if networks is not None:
            
            _query_params.append(('networks', networks))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'ApiKeyAuthQuery', 
            'ApiKeyAuthHeader'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/candles',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def ticks_get(
        self,
        symbol: Annotated[Optional[StrictStr], Field(description="Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        pool: Annotated[Optional[StrictStr], Field(description="Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Start timestamp (ISO 8601). Default is 1 hour ago.")] = None,
        to: Annotated[Optional[datetime], Field(description="End timestamp (ISO 8601). Default is now.")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Maximum number of ticks to return (1-1000, default 100).")] = None,
        networks: Annotated[Optional[StrictStr], Field(description="Comma-separated list of networks to query.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> TicksResponse:
        """Get Raw Tick Data

        Fetch raw tick-level swap data for a pool (no OHLCV aggregation).  **Required:** Provide either `symbol` OR `pool` parameter (mutually exclusive).  **Use case:** Real-time trade monitoring, custom aggregation, order flow analysis.

        :param symbol: Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type symbol: str
        :param pool: Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type pool: str
        :param var_from: Start timestamp (ISO 8601). Default is 1 hour ago.
        :type var_from: datetime
        :param to: End timestamp (ISO 8601). Default is now.
        :type to: datetime
        :param limit: Maximum number of ticks to return (1-1000, default 100).
        :type limit: int
        :param networks: Comma-separated list of networks to query.
        :type networks: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._ticks_get_serialize(
            symbol=symbol,
            pool=pool,
            var_from=var_from,
            to=to,
            limit=limit,
            networks=networks,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TicksResponse",
            '400': "Error",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def ticks_get_with_http_info(
        self,
        symbol: Annotated[Optional[StrictStr], Field(description="Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        pool: Annotated[Optional[StrictStr], Field(description="Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Start timestamp (ISO 8601). Default is 1 hour ago.")] = None,
        to: Annotated[Optional[datetime], Field(description="End timestamp (ISO 8601). Default is now.")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Maximum number of ticks to return (1-1000, default 100).")] = None,
        networks: Annotated[Optional[StrictStr], Field(description="Comma-separated list of networks to query.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[TicksResponse]:
        """Get Raw Tick Data

        Fetch raw tick-level swap data for a pool (no OHLCV aggregation).  **Required:** Provide either `symbol` OR `pool` parameter (mutually exclusive).  **Use case:** Real-time trade monitoring, custom aggregation, order flow analysis.

        :param symbol: Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type symbol: str
        :param pool: Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type pool: str
        :param var_from: Start timestamp (ISO 8601). Default is 1 hour ago.
        :type var_from: datetime
        :param to: End timestamp (ISO 8601). Default is now.
        :type to: datetime
        :param limit: Maximum number of ticks to return (1-1000, default 100).
        :type limit: int
        :param networks: Comma-separated list of networks to query.
        :type networks: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._ticks_get_serialize(
            symbol=symbol,
            pool=pool,
            var_from=var_from,
            to=to,
            limit=limit,
            networks=networks,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TicksResponse",
            '400': "Error",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def ticks_get_without_preload_content(
        self,
        symbol: Annotated[Optional[StrictStr], Field(description="Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        pool: Annotated[Optional[StrictStr], Field(description="Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. ")] = None,
        var_from: Annotated[Optional[datetime], Field(description="Start timestamp (ISO 8601). Default is 1 hour ago.")] = None,
        to: Annotated[Optional[datetime], Field(description="End timestamp (ISO 8601). Default is now.")] = None,
        limit: Annotated[Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]], Field(description="Maximum number of ticks to return (1-1000, default 100).")] = None,
        networks: Annotated[Optional[StrictStr], Field(description="Comma-separated list of networks to query.")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get Raw Tick Data

        Fetch raw tick-level swap data for a pool (no OHLCV aggregation).  **Required:** Provide either `symbol` OR `pool` parameter (mutually exclusive).  **Use case:** Real-time trade monitoring, custom aggregation, order flow analysis.

        :param symbol: Trading pair symbol (e.g., \"ETH-USDC\"). Case-insensitive. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type symbol: str
        :param pool: Pool contract address. Use this instead of symbol for faster responses, and less credits used. **Note:** Provide either `symbol` OR `pool`, not both. 
        :type pool: str
        :param var_from: Start timestamp (ISO 8601). Default is 1 hour ago.
        :type var_from: datetime
        :param to: End timestamp (ISO 8601). Default is now.
        :type to: datetime
        :param limit: Maximum number of ticks to return (1-1000, default 100).
        :type limit: int
        :param networks: Comma-separated list of networks to query.
        :type networks: str
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._ticks_get_serialize(
            symbol=symbol,
            pool=pool,
            var_from=var_from,
            to=to,
            limit=limit,
            networks=networks,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "TicksResponse",
            '400': "Error",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _ticks_get_serialize(
        self,
        symbol,
        pool,
        var_from,
        to,
        limit,
        networks,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if symbol is not None:
            
            _query_params.append(('symbol', symbol))
            
        if pool is not None:
            
            _query_params.append(('pool', pool))
            
        if var_from is not None:
            if isinstance(var_from, datetime):
                _query_params.append(
                    (
                        'from',
                        var_from.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('from', var_from))
            
        if to is not None:
            if isinstance(to, datetime):
                _query_params.append(
                    (
                        'to',
                        to.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('to', to))
            
        if limit is not None:
            
            _query_params.append(('limit', limit))
            
        if networks is not None:
            
            _query_params.append(('networks', networks))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'ApiKeyAuthQuery', 
            'ApiKeyAuthHeader'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/ticks',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


