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

import datetime
import enum
import typing

from nautilus_trader import model

__all__ = [
    "DYDX",
    "DYDX_CLIENT_ID",
    "DYDX_VENUE",
    "DydxDataClientConfig",
    "DydxDataClientFactory",
    "DydxExecutionClientConfig",
    "DydxExecutionClientFactory",
    "DydxNetwork",
]

DYDX: str
DYDX_CLIENT_ID: model.ClientId
DYDX_VENUE: model.Venue

@typing.final
class DydxDataClientConfig:
    @property
    def network(self) -> DydxNetwork: ...
    def __init__(
        self, proxy_url: str | None = None, network: DydxNetwork | None = None
    ) -> None: ...
    @property
    def has_proxy_url(self) -> bool: ...

@typing.final
class DydxDataClientFactory:
    def __init__(self) -> None: ...
    def name(self) -> str: ...

@typing.final
class DydxExecutionClientConfig:
    @property
    def account_id(self) -> model.AccountId: ...
    @property
    def network(self) -> DydxNetwork: ...
    @property
    def wallet_address(self) -> str | None: ...
    @property
    def subaccount_number(self) -> int: ...
    def __init__(
        self,
        account_id: model.AccountId,
        proxy_url: str | None = None,
        network: DydxNetwork | None = None,
        private_key: str | None = None,
        wallet_address: str | None = None,
        subaccount_number: int = 0,
    ) -> None: ...
    @property
    def has_proxy_url(self) -> bool: ...

@typing.final
class DydxExecutionClientFactory:
    def __init__(self) -> None: ...
    def name(self) -> str: ...

@typing.final
class DydxHttpClient:
    def __init__(
        self, base_url: str | None = None, network: DydxNetwork = ..., proxy_url: str | None = None
    ) -> None: ...
    def is_testnet(self) -> bool: ...
    def base_url(self) -> str: ...
    def request_instruments(
        self, maker_fee: str | None = ..., taker_fee: str | None = ...
    ) -> typing.Any: ...
    def fetch_and_cache_instruments(self) -> typing.Any: ...
    def fetch_instrument(self, ticker: str) -> typing.Any: ...
    def get_instrument(self, symbol: str) -> typing.Any | None: ...
    def instrument_count(self) -> int: ...
    def instrument_symbols(self) -> list[str]: ...
    def cache_instruments(self, py_instruments: typing.Sequence[typing.Any]) -> None: ...
    def get_orders(
        self,
        address: str,
        subaccount_number: int,
        market: str | None = None,
        limit: int | None = None,
    ) -> typing.Any: ...
    def get_fills(
        self,
        address: str,
        subaccount_number: int,
        market: str | None = None,
        limit: int | None = None,
    ) -> typing.Any: ...
    def get_subaccount(self, address: str, subaccount_number: int) -> typing.Any: ...
    def request_order_status_reports(
        self,
        address: str,
        subaccount_number: int,
        account_id: model.AccountId,
        instrument_id: model.InstrumentId | None = None,
    ) -> typing.Any: ...
    def request_fill_reports(
        self,
        address: str,
        subaccount_number: int,
        account_id: model.AccountId,
        instrument_id: model.InstrumentId | None = None,
    ) -> typing.Any: ...
    def request_position_status_reports(
        self,
        address: str,
        subaccount_number: int,
        account_id: model.AccountId,
        instrument_id: model.InstrumentId | None = None,
    ) -> typing.Any: ...
    def request_account_state(
        self, address: str, subaccount_number: int, account_id: model.AccountId
    ) -> typing.Any: ...
    def request_bars(
        self,
        bar_type: model.BarType,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
        timestamp_on_close: bool = True,
    ) -> typing.Any: ...
    def request_trade_ticks(
        self,
        instrument_id: model.InstrumentId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
    ) -> typing.Any: ...
    def request_funding_rates(
        self,
        instrument_id: model.InstrumentId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
    ) -> typing.Any: ...
    def request_orderbook_snapshot(self, instrument_id: model.InstrumentId) -> typing.Any: ...
    def get_time(self) -> typing.Any: ...
    def get_height(self) -> typing.Any: ...
    def get_transfers(
        self, address: str, subaccount_number: int, limit: int | None = None
    ) -> typing.Any: ...

@typing.final
class DydxOraclePrice:
    def __hash__(self) -> int: ...
    @property
    def instrument_id(self) -> model.InstrumentId: ...
    @property
    def oracle_price(self) -> model.Price: ...
    @property
    def ts_event(self) -> int: ...
    @property
    def ts_init(self) -> int: ...
    def to_dict(self) -> typing.Any: ...

@typing.final
class DydxClientOrderIdEncoder:
    def __init__(self) -> None: ...
    def encode(self, client_order_id: str) -> tuple[int, int]: ...
    def decode(self, client_id: int, client_metadata: int) -> str | None: ...
    def get(self, client_order_id: str) -> tuple[int, int] | None: ...
    def remove(self, client_id: int, client_metadata: int) -> str | None: ...
    def current_counter(self) -> int: ...
    def len(self) -> int: ...
    def is_empty(self) -> bool: ...

@typing.final
class DydxGrpcClient:
    @staticmethod
    def connect(grpc_url: str) -> typing.Any: ...
    @staticmethod
    def connect_with_fallback(grpc_urls: typing.Sequence[str]) -> typing.Any: ...
    def latest_block_height(self) -> typing.Any: ...
    def get_account(self, address: str) -> typing.Any: ...
    def get_account_balances(self, address: str) -> typing.Any: ...
    def get_subaccount(self, address: str, subaccount_number: int) -> typing.Any: ...
    def get_node_info(self) -> typing.Any: ...
    def simulate_tx(self, tx_bytes: typing.Sequence[int]) -> typing.Any: ...
    def get_tx(self, hash: str) -> typing.Any: ...

@typing.final
class DydxOrderSubmitter:
    def __init__(
        self,
        grpc_client: DydxGrpcClient,
        http_client: DydxHttpClient,
        private_key: str,
        wallet_address: str,
        subaccount_number: int = 0,
        chain_id: str | None = None,
        grpc_rate_limit_per_second: int | None = None,
    ) -> None: ...
    def record_block(self, height: int, timestamp: str | None = ...) -> None: ...
    def set_block_height(self, height: int) -> None: ...
    def get_block_height(self) -> int: ...
    def estimated_seconds_per_block(self) -> float | None: ...
    def is_block_time_ready(self) -> bool: ...
    def wallet_address(self) -> str: ...
    def resolve_authenticators(self) -> typing.Any: ...
    def submit_market_order(
        self,
        instrument_id: str,
        client_order_id: int,
        side: int,
        quantity: str,
        client_metadata: int | None = None,
    ) -> typing.Any: ...
    def submit_limit_order(
        self,
        instrument_id: str,
        client_order_id: int,
        side: int,
        price: str,
        quantity: str,
        time_in_force: int,
        post_only: bool,
        reduce_only: bool,
        expire_time: int | None = None,
        client_metadata: int | None = None,
    ) -> typing.Any: ...
    def submit_stop_market_order(
        self,
        instrument_id: str,
        client_order_id: int,
        side: int,
        trigger_price: str,
        quantity: str,
        reduce_only: bool,
        expire_time: int | None = None,
        client_metadata: int | None = None,
    ) -> typing.Any: ...
    def submit_stop_limit_order(
        self,
        instrument_id: str,
        client_order_id: int,
        side: int,
        trigger_price: str,
        limit_price: str,
        quantity: str,
        time_in_force: int,
        post_only: bool,
        reduce_only: bool,
        expire_time: int | None = None,
        client_metadata: int | None = None,
    ) -> typing.Any: ...
    def submit_take_profit_market_order(
        self,
        instrument_id: str,
        client_order_id: int,
        side: int,
        trigger_price: str,
        quantity: str,
        reduce_only: bool,
        expire_time: int | None = None,
        client_metadata: int | None = None,
    ) -> typing.Any: ...
    def submit_take_profit_limit_order(
        self,
        instrument_id: str,
        client_order_id: int,
        side: int,
        trigger_price: str,
        limit_price: str,
        quantity: str,
        time_in_force: int,
        post_only: bool,
        reduce_only: bool,
        expire_time: int | None = None,
        client_metadata: int | None = None,
    ) -> typing.Any: ...
    def cancel_order(
        self,
        instrument_id: str,
        client_order_id: int,
        time_in_force: int | None = None,
        expire_time_ns: int | None = None,
    ) -> typing.Any: ...
    def cancel_orders_batch(
        self, orders: typing.Sequence[tuple[str, int, int | None, int | None]] = ...
    ) -> typing.Any: ...

@typing.final
class DydxWallet:
    @staticmethod
    def from_private_key(private_key: str) -> DydxWallet: ...
    def address(self) -> str: ...

@typing.final
class DydxNetwork(enum.Enum):
    MAINNET = ...
    TESTNET = ...

    def __init__(self, value: typing.Any) -> None: ...
    def __hash__(self) -> int: ...
    @property
    def name(self) -> str: ...
    @property
    def value(self) -> int: ...
    @classmethod
    def variants(cls) -> list[str]: ...
    @classmethod
    def from_str(cls, data: typing.Any) -> DydxNetwork: ...

@typing.final
class DydxOrderSide(enum.Enum):
    Buy = ...
    Sell = ...

@typing.final
class DydxOrderType(enum.Enum):
    Limit = ...
    Market = ...
    StopLimit = ...
    StopMarket = ...
    TakeProfitLimit = ...
    TakeProfitMarket = ...
    TrailingStop = ...

def get_dydx_grpc_url(network: DydxNetwork) -> str: ...
def get_dydx_grpc_urls(network: DydxNetwork) -> list[str]: ...
def get_dydx_http_url(network: DydxNetwork) -> str: ...
def get_dydx_ws_url(network: DydxNetwork) -> str: ...
