# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501

import enum
import typing

from nautilus_trader import common
from nautilus_trader import model

__all__ = [
    "BarDataWrangler",
    "DataBackendSession",
    "DataCatalogConfig",
    "DataQueryResult",
    "NautilusDataType",
    "OrderBookDeltaDataWrangler",
    "OrderBookDepth10DataWrangler",
    "ParquetDataCatalog",
    "QuoteTickDataWrangler",
    "StreamingConfig",
    "StreamingFeatherWriter",
    "TradeTickDataWrangler",
]

@typing.final
class BarDataWrangler:
    def __init__(self, bar_type: str, price_precision: int, size_precision: int) -> None: ...
    @property
    def bar_type(self) -> str: ...
    @property
    def price_precision(self) -> int: ...
    @property
    def size_precision(self) -> int: ...
    def process_record_batch_bytes(self, data: bytes) -> list[model.Bar]: ...

@typing.final
class DataBackendSession:
    def __init__(self, chunk_size: int = 10000) -> None: ...
    def add_file(
        self,
        data_type: NautilusDataType,
        table_name: str,
        file_path: str,
        sql_query: str | None = None,
    ) -> None: ...
    def add_custom_file(
        self, type_name: str, table_name: str, file_path: str, sql_query: str | None = None
    ) -> None: ...
    def to_query_result(self) -> DataQueryResult: ...
    def register_object_store_from_uri(
        self, uri: str, storage_options: typing.Mapping[str, str] | None = None
    ) -> None: ...

@typing.final
class DataCatalogConfig:
    @property
    def path(self) -> str: ...
    @property
    def fs_protocol(self) -> str | None: ...
    @property
    def name(self) -> str | None: ...
    @property
    def fs_rust_storage_option_keys(self) -> list[str] | None: ...
    def __new__(
        cls,
        path: str,
        fs_protocol: str | None = None,
        fs_rust_storage_options: typing.Mapping[str, str] | None = None,
        name: str | None = None,
    ) -> DataCatalogConfig: ...

@typing.final
class DataQueryResult:
    def to_list(self) -> list[typing.Any]: ...
    def __iter__(self) -> DataQueryResult: ...
    def __next__(self) -> typing.Any | None: ...

@typing.final
class OrderBookDeltaDataWrangler:
    def __init__(self, instrument_id: str, price_precision: int, size_precision: int) -> None: ...
    @property
    def instrument_id(self) -> str: ...
    @property
    def price_precision(self) -> int: ...
    @property
    def size_precision(self) -> int: ...
    def process_record_batch_bytes(self, data: bytes) -> list[model.OrderBookDelta]: ...

@typing.final
class OrderBookDepth10DataWrangler:
    def __init__(self, instrument_id: str, price_precision: int, size_precision: int) -> None: ...
    @property
    def instrument_id(self) -> str: ...
    @property
    def price_precision(self) -> int: ...
    @property
    def size_precision(self) -> int: ...
    def process_record_batch_bytes(self, data: bytes) -> list[model.OrderBookDepth10]: ...

@typing.final
class ParquetDataCatalog:
    def __init__(
        self,
        base_path: str,
        storage_options: typing.Mapping[str, str] | None = None,
        batch_size: int | None = None,
        compression: int | None = None,
        max_row_group_size: int | None = None,
    ) -> None: ...
    def write_quote_ticks(
        self,
        data: typing.Sequence[model.QuoteTick],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def write_trade_ticks(
        self,
        data: typing.Sequence[model.TradeTick],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def write_order_book_deltas(
        self,
        data: typing.Sequence[model.OrderBookDelta],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def write_bars(
        self,
        data: typing.Sequence[model.Bar],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def write_order_book_depths(
        self,
        data: typing.Sequence[model.OrderBookDepth10],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def write_mark_price_updates(
        self,
        data: typing.Sequence[model.MarkPriceUpdate],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def write_index_price_updates(
        self,
        data: typing.Sequence[model.IndexPriceUpdate],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def write_option_greeks(
        self,
        data: typing.Sequence[model.OptionGreeks],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def write_instruments(self, data: typing.Any) -> list[str]: ...
    def instruments(
        self,
        instrument_ids: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
    ) -> list[typing.Any]: ...
    def extend_file_name(
        self, data_cls: str, instrument_id: str | None, start: int, end: int
    ) -> None: ...
    def consolidate_catalog(
        self,
        start: int | None = None,
        end: int | None = None,
        ensure_contiguous_files: bool | None = None,
        deduplicate: bool | None = None,
    ) -> None: ...
    def consolidate_data(
        self,
        type_name: str,
        instrument_id: str | None = None,
        start: int | None = None,
        end: int | None = None,
        ensure_contiguous_files: bool | None = None,
        deduplicate: bool | None = None,
    ) -> None: ...
    def consolidate_catalog_by_period(
        self,
        period_nanos: int | None = None,
        start: int | None = None,
        end: int | None = None,
        ensure_contiguous_files: bool | None = None,
    ) -> None: ...
    def consolidate_data_by_period(
        self,
        type_name: str,
        identifier: str | None = None,
        period_nanos: int | None = None,
        start: int | None = None,
        end: int | None = None,
        ensure_contiguous_files: bool | None = None,
    ) -> None: ...
    def reset_all_file_names(self) -> None: ...
    def reset_data_file_names(self, data_cls: str, instrument_id: str | None = None) -> None: ...
    def delete_catalog_range(self, start: int | None = None, end: int | None = None) -> None: ...
    def delete_data_range(
        self,
        type_name: str,
        instrument_id: str | None = None,
        start: int | None = None,
        end: int | None = None,
    ) -> None: ...
    def write_custom_data(
        self,
        data: typing.Sequence[typing.Any],
        start: int | None = None,
        end: int | None = None,
        skip_disjoint_check: bool = False,
    ) -> str: ...
    def list_instruments(self, data_type: str) -> list[str]: ...
    def list_parquet_files(self, data_type: str, instrument_id: str) -> list[str]: ...
    def query_files(
        self,
        data_cls: str,
        identifiers: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
    ) -> list[str]: ...
    def get_missing_intervals_for_request(
        self, start: int, end: int, data_cls: str, instrument_id: str | None = None
    ) -> list[tuple[int, int]]: ...
    def query_first_timestamp(
        self, data_cls: str, instrument_id: str | None = None
    ) -> int | None: ...
    def query_last_timestamp(
        self, data_cls: str, instrument_id: str | None = None
    ) -> int | None: ...
    def get_intervals(
        self, data_cls: str, instrument_id: str | None = None
    ) -> list[tuple[int, int]]: ...
    def query(
        self,
        data_type: str,
        identifiers: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
        files: typing.Sequence[str] | None = None,
        optimize_file_loading: bool = True,
    ) -> list[typing.Any]: ...
    def query_quote_ticks(
        self,
        identifiers: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[model.QuoteTick]: ...
    def query_trade_ticks(
        self,
        identifiers: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[model.TradeTick]: ...
    def query_order_book_deltas(
        self,
        identifiers: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[model.OrderBookDelta]: ...
    def query_bars(
        self,
        identifiers: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[model.Bar]: ...
    def query_order_book_depths(
        self,
        instrument_ids: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[model.OrderBookDepth10]: ...
    def query_mark_price_updates(
        self,
        instrument_ids: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[model.MarkPriceUpdate]: ...
    def query_index_price_updates(
        self,
        instrument_ids: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[model.IndexPriceUpdate]: ...
    def query_option_greeks(
        self,
        instrument_ids: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[model.OptionGreeks]: ...
    def list_data_types(self) -> list[str]: ...
    def list_live_runs(self) -> list[str]: ...
    def list_backtest_runs(self) -> list[str]: ...
    def list_backtests(self) -> list[str]: ...
    def read_live_run(self, instance_id: str) -> list[typing.Any]: ...
    def read_backtest(self, instance_id: str) -> list[typing.Any]: ...
    def convert_stream_to_data(
        self,
        instance_id: str,
        data_cls: str,
        subdirectory: str | None = None,
        identifiers: typing.Sequence[str] | None = None,
        use_ts_event_for_ts_init: bool = False,
    ) -> None: ...
    def query_custom_data(
        self,
        type_name: str,
        identifiers: typing.Sequence[str] | None = None,
        start: int | None = None,
        end: int | None = None,
        where_clause: str | None = None,
    ) -> list[typing.Any]: ...

@typing.final
class StreamingFeatherWriter:
    def __init__(
        self,
        path: str,
        cache: common.Cache,
        clock: common.Clock,
        fs_protocol: str | None = None,
        fs_storage_options: typing.Mapping[str, str] | None = None,
        include_types: typing.Sequence[str] | None = None,
        rotation_mode: int = 3,
        max_file_size: int = 1073741824,
        rotation_interval_ns: int | None = None,
        rotation_time_ns: int | None = None,
        rotation_timezone: str = "UTC",
        flush_interval_ms: int | None = None,
        replace: bool = False,
    ) -> None: ...
    def subscribe(self) -> None: ...
    def unsubscribe(self) -> None: ...
    def write(self, data: typing.Any) -> None: ...
    def flush(self) -> None: ...
    def close(self) -> None: ...
    @property
    def is_closed(self) -> bool: ...
    def get_current_file_info(self) -> dict[str, tuple[int, str]]: ...
    def get_next_rotation_time(
        self, type_str: str, instrument_id: str | None = None
    ) -> int | None: ...

@typing.final
class QuoteTickDataWrangler:
    def __init__(self, instrument_id: str, price_precision: int, size_precision: int) -> None: ...
    @property
    def instrument_id(self) -> str: ...
    @property
    def price_precision(self) -> int: ...
    @property
    def size_precision(self) -> int: ...
    def process_record_batch_bytes(self, data: bytes) -> list[model.QuoteTick]: ...

@typing.final
class StreamingConfig:
    @property
    def catalog_path(self) -> str: ...
    @property
    def fs_protocol(self) -> str: ...
    @property
    def flush_interval_ms(self) -> int: ...
    @property
    def replace_existing(self) -> bool: ...
    @property
    def rotation_mode(self) -> str: ...
    @property
    def max_file_size(self) -> int | None: ...
    @property
    def rotation_interval_ns(self) -> int | None: ...
    @property
    def schedule_ns(self) -> int | None: ...
    def __new__(
        cls,
        catalog_path: str,
        fs_protocol: str | None = None,
        flush_interval_ms: int | None = None,
        replace_existing: bool = ...,
        rotation_mode: str = ...,
        max_file_size: int = ...,
        rotation_interval_ns: int | None = None,
        schedule_ns: int | None = None,
    ) -> StreamingConfig: ...

@typing.final
class TradeTickDataWrangler:
    def __init__(self, instrument_id: str, price_precision: int, size_precision: int) -> None: ...
    @property
    def instrument_id(self) -> str: ...
    @property
    def price_precision(self) -> int: ...
    @property
    def size_precision(self) -> int: ...
    def process_record_batch_bytes(self, data: bytes) -> list[model.TradeTick]: ...

@typing.final
class NautilusDataType(enum.Enum):
    OrderBookDelta = ...
    OrderBookDepth10 = ...
    QuoteTick = ...
    TradeTick = ...
    Bar = ...
    MarkPriceUpdate = ...
    OptionGreeks = ...
    InstrumentStatus = ...

    def __hash__(self) -> int: ...
