"""
@generated by mypy-protobuf.  Do not edit manually!
isort:skip_file
"""
import builtins
import cosmos.base.v1beta1.coin_pb2
import google.protobuf.descriptor
import google.protobuf.duration_pb2
import google.protobuf.internal.enum_type_wrapper
import google.protobuf.message
import sys
import typing

if sys.version_info >= (3, 10):
    import typing as typing_extensions
else:
    import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor

class _Direction:
    ValueType = typing.NewType("ValueType", builtins.int)
    V: typing_extensions.TypeAlias = ValueType

class _DirectionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Direction.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    DIRECTION_UNSPECIFIED: _Direction.ValueType  # 0
    LONG: _Direction.ValueType  # 1
    SHORT: _Direction.ValueType  # 2

class Direction(_Direction, metaclass=_DirectionEnumTypeWrapper):
    """The direction that the user is trading in
    LONG means the user is going long the base asset (e.g. buy BTC)
    SHORT means the user is shorting the base asset (e.g. sell BTC)
    """

DIRECTION_UNSPECIFIED: Direction.ValueType  # 0
LONG: Direction.ValueType  # 1
SHORT: Direction.ValueType  # 2
global___Direction = Direction

class _TwapCalcOption:
    ValueType = typing.NewType("ValueType", builtins.int)
    V: typing_extensions.TypeAlias = ValueType

class _TwapCalcOptionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_TwapCalcOption.ValueType], builtins.type):
    DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
    TWAP_CALC_OPTION_UNSPECIFIED: _TwapCalcOption.ValueType  # 0
    SPOT: _TwapCalcOption.ValueType  # 1
    """Spot price from quote asset reserve / base asset reserve"""
    QUOTE_ASSET_SWAP: _TwapCalcOption.ValueType  # 2
    """Swapping with quote assets, output denominated in base assets"""
    BASE_ASSET_SWAP: _TwapCalcOption.ValueType  # 3
    """Swapping with base assets, output denominated in quote assets"""

class TwapCalcOption(_TwapCalcOption, metaclass=_TwapCalcOptionEnumTypeWrapper):
    """Enumerates different options of calculating twap."""

TWAP_CALC_OPTION_UNSPECIFIED: TwapCalcOption.ValueType  # 0
SPOT: TwapCalcOption.ValueType  # 1
"""Spot price from quote asset reserve / base asset reserve"""
QUOTE_ASSET_SWAP: TwapCalcOption.ValueType  # 2
"""Swapping with quote assets, output denominated in base assets"""
BASE_ASSET_SWAP: TwapCalcOption.ValueType  # 3
"""Swapping with base assets, output denominated in quote assets"""
global___TwapCalcOption = TwapCalcOption

@typing_extensions.final
class Market(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    PAIR_FIELD_NUMBER: builtins.int
    ENABLED_FIELD_NUMBER: builtins.int
    MAINTENANCE_MARGIN_RATIO_FIELD_NUMBER: builtins.int
    MAX_LEVERAGE_FIELD_NUMBER: builtins.int
    LATEST_CUMULATIVE_PREMIUM_FRACTION_FIELD_NUMBER: builtins.int
    EXCHANGE_FEE_RATIO_FIELD_NUMBER: builtins.int
    ECOSYSTEM_FUND_FEE_RATIO_FIELD_NUMBER: builtins.int
    LIQUIDATION_FEE_RATIO_FIELD_NUMBER: builtins.int
    PARTIAL_LIQUIDATION_RATIO_FIELD_NUMBER: builtins.int
    FUNDING_RATE_EPOCH_ID_FIELD_NUMBER: builtins.int
    TWAP_LOOKBACK_WINDOW_FIELD_NUMBER: builtins.int
    PREPAID_BAD_DEBT_FIELD_NUMBER: builtins.int
    MAX_FUNDING_RATE_FIELD_NUMBER: builtins.int
    pair: builtins.str
    """the trading pair represented by this market
    always BASE:QUOTE, e.g. BTC:NUSD or ETH:NUSD
    """
    enabled: builtins.bool
    """whether or not the market is enabled"""
    maintenance_margin_ratio: builtins.str
    """the minimum margin ratio which a user must maintain on this market"""
    max_leverage: builtins.str
    """the maximum leverage a user is able to be taken on this market"""
    latest_cumulative_premium_fraction: builtins.str
    """Latest cumulative premium fraction for a given pair.
    Calculated once per funding rate interval.
    A premium fraction is the difference between mark and index, divided by the
    number of payments per day. (mark - index) / # payments in a day
    """
    exchange_fee_ratio: builtins.str
    """the percentage of the notional given to the exchange when trading"""
    ecosystem_fund_fee_ratio: builtins.str
    """the percentage of the notional transferred to the ecosystem fund when
    trading
    """
    liquidation_fee_ratio: builtins.str
    """the percentage of liquidated position that will be
    given to out as a reward. Half of the liquidation fee is given to the
    liquidator, and the other half is given to the ecosystem fund.
    """
    partial_liquidation_ratio: builtins.str
    """the portion of the position size we try to liquidate if the available
    margin is higher than liquidation fee
    """
    funding_rate_epoch_id: builtins.str
    """specifies the interval on which the funding rate is updated"""
    @property
    def twap_lookback_window(self) -> google.protobuf.duration_pb2.Duration:
        """amount of time to look back for TWAP calculations"""
    @property
    def prepaid_bad_debt(self) -> cosmos.base.v1beta1.coin_pb2.Coin:
        """the amount of collateral already credited from the ecosystem fund"""
    max_funding_rate: builtins.str
    """the maximum funding rate payment per epoch, this represents the maximum
    amount of funding that can be paid out per epoch as a percentage of the
    position size
    """
    def __init__(
        self,
        *,
        pair: builtins.str = ...,
        enabled: builtins.bool = ...,
        maintenance_margin_ratio: builtins.str = ...,
        max_leverage: builtins.str = ...,
        latest_cumulative_premium_fraction: builtins.str = ...,
        exchange_fee_ratio: builtins.str = ...,
        ecosystem_fund_fee_ratio: builtins.str = ...,
        liquidation_fee_ratio: builtins.str = ...,
        partial_liquidation_ratio: builtins.str = ...,
        funding_rate_epoch_id: builtins.str = ...,
        twap_lookback_window: google.protobuf.duration_pb2.Duration | None = ...,
        prepaid_bad_debt: cosmos.base.v1beta1.coin_pb2.Coin | None = ...,
        max_funding_rate: builtins.str = ...,
    ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["prepaid_bad_debt", b"prepaid_bad_debt", "twap_lookback_window", b"twap_lookback_window"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["ecosystem_fund_fee_ratio", b"ecosystem_fund_fee_ratio", "enabled", b"enabled", "exchange_fee_ratio", b"exchange_fee_ratio", "funding_rate_epoch_id", b"funding_rate_epoch_id", "latest_cumulative_premium_fraction", b"latest_cumulative_premium_fraction", "liquidation_fee_ratio", b"liquidation_fee_ratio", "maintenance_margin_ratio", b"maintenance_margin_ratio", "max_funding_rate", b"max_funding_rate", "max_leverage", b"max_leverage", "pair", b"pair", "partial_liquidation_ratio", b"partial_liquidation_ratio", "prepaid_bad_debt", b"prepaid_bad_debt", "twap_lookback_window", b"twap_lookback_window"]) -> None: ...

global___Market = Market

@typing_extensions.final
class AMM(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    PAIR_FIELD_NUMBER: builtins.int
    BASE_RESERVE_FIELD_NUMBER: builtins.int
    QUOTE_RESERVE_FIELD_NUMBER: builtins.int
    SQRT_DEPTH_FIELD_NUMBER: builtins.int
    PRICE_MULTIPLIER_FIELD_NUMBER: builtins.int
    TOTAL_LONG_FIELD_NUMBER: builtins.int
    TOTAL_SHORT_FIELD_NUMBER: builtins.int
    pair: builtins.str
    """identifies the market this AMM belongs to"""
    base_reserve: builtins.str
    """the amount of base reserves this AMM has"""
    quote_reserve: builtins.str
    """the amount of quote reserves this AMM has"""
    sqrt_depth: builtins.str
    """sqrt(k)"""
    price_multiplier: builtins.str
    """the price multiplier of the dynamic AMM"""
    total_long: builtins.str
    """Total long refers to the sum of long open notional in base."""
    total_short: builtins.str
    """Total short refers to the sum of short open notional in base."""
    def __init__(
        self,
        *,
        pair: builtins.str = ...,
        base_reserve: builtins.str = ...,
        quote_reserve: builtins.str = ...,
        sqrt_depth: builtins.str = ...,
        price_multiplier: builtins.str = ...,
        total_long: builtins.str = ...,
        total_short: builtins.str = ...,
    ) -> None: ...
    def ClearField(self, field_name: typing_extensions.Literal["base_reserve", b"base_reserve", "pair", b"pair", "price_multiplier", b"price_multiplier", "quote_reserve", b"quote_reserve", "sqrt_depth", b"sqrt_depth", "total_long", b"total_long", "total_short", b"total_short"]) -> None: ...

global___AMM = AMM

@typing_extensions.final
class Position(google.protobuf.message.Message):
    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    TRADER_ADDRESS_FIELD_NUMBER: builtins.int
    PAIR_FIELD_NUMBER: builtins.int
    SIZE_FIELD_NUMBER: builtins.int
    MARGIN_FIELD_NUMBER: builtins.int
    OPEN_NOTIONAL_FIELD_NUMBER: builtins.int
    LATEST_CUMULATIVE_PREMIUM_FRACTION_FIELD_NUMBER: builtins.int
    LAST_UPDATED_BLOCK_NUMBER_FIELD_NUMBER: builtins.int
    trader_address: builtins.str
    """address identifies the address owner of this position"""
    pair: builtins.str
    """pair identifies the pair associated with this position"""
    size: builtins.str
    """the position size"""
    margin: builtins.str
    """amount of margin remaining in the position"""
    open_notional: builtins.str
    """value of position in quote assets when opened"""
    latest_cumulative_premium_fraction: builtins.str
    """The most recent cumulative premium fraction this position has.
    Used to calculate the next funding payment.
    """
    last_updated_block_number: builtins.int
    """last block number this position was updated"""
    def __init__(
        self,
        *,
        trader_address: builtins.str = ...,
        pair: builtins.str = ...,
        size: builtins.str = ...,
        margin: builtins.str = ...,
        open_notional: builtins.str = ...,
        latest_cumulative_premium_fraction: builtins.str = ...,
        last_updated_block_number: builtins.int = ...,
    ) -> None: ...
    def ClearField(self, field_name: typing_extensions.Literal["last_updated_block_number", b"last_updated_block_number", "latest_cumulative_premium_fraction", b"latest_cumulative_premium_fraction", "margin", b"margin", "open_notional", b"open_notional", "pair", b"pair", "size", b"size", "trader_address", b"trader_address"]) -> None: ...

global___Position = Position

@typing_extensions.final
class ReserveSnapshot(google.protobuf.message.Message):
    """a snapshot of the perp.amm's reserves at a given point in time"""

    DESCRIPTOR: google.protobuf.descriptor.Descriptor

    AMM_FIELD_NUMBER: builtins.int
    TIMESTAMP_MS_FIELD_NUMBER: builtins.int
    @property
    def amm(self) -> global___AMM: ...
    timestamp_ms: builtins.int
    """milliseconds since unix epoch"""
    def __init__(
        self,
        *,
        amm: global___AMM | None = ...,
        timestamp_ms: builtins.int = ...,
    ) -> None: ...
    def HasField(self, field_name: typing_extensions.Literal["amm", b"amm"]) -> builtins.bool: ...
    def ClearField(self, field_name: typing_extensions.Literal["amm", b"amm", "timestamp_ms", b"timestamp_ms"]) -> None: ...

global___ReserveSnapshot = ReserveSnapshot
