# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: api.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import datetime
from typing import AsyncGenerator, Dict, List, Optional

import betterproto
import grpclib

from . import common


class MarketStatus(betterproto.Enum):
    MS_UNKNOWN = 0
    MS_ONLINE = 1


class Side(betterproto.Enum):
    S_UNKNOWN = 0
    S_BID = 1
    S_ASK = 2


class OrderStatus(betterproto.Enum):
    OS_UNKNOWN = 0
    OS_OPEN = 1
    OS_PARTIAL_FILL = 2
    OS_CANCELLED = 3
    OS_FILLED = 4


class Direction(betterproto.Enum):
    D_ASCENDING = 0
    D_DESCENDING = 1


class SubmitStrategy(betterproto.Enum):
    P_UKNOWN = 0
    P_SUBMIT_ALL = 1
    P_ABORT_ON_FIRST_ERROR = 2
    P_WAIT_FOR_CONFIRMATION = 3


class Step(betterproto.Enum):
    STEP0 = 0
    STEP1 = 1
    STEP2 = 2
    STEP3 = 3


class Project(betterproto.Enum):
    P_UNKNOWN = 0
    P_ALL = 1
    P_JUPITER = 2
    P_RAYDIUM = 3
    P_SERUM = 4
    P_OPENBOOK = 5
    P_DRIFT = 6


@dataclass
class GetMarketsRequest(betterproto.Message):
    pass


@dataclass
class GetMarketsResponse(betterproto.Message):
    markets: Dict[str, "Market"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )


@dataclass
class Market(betterproto.Message):
    market: str = betterproto.string_field(1)
    status: "MarketStatus" = betterproto.enum_field(2)
    address: str = betterproto.string_field(3)
    base_mint: str = betterproto.string_field(4)
    quoted_mint: str = betterproto.string_field(5)
    base_decimals: int = betterproto.int64_field(6)
    quote_decimals: int = betterproto.int64_field(7)
    project: "Project" = betterproto.enum_field(8)


@dataclass
class GetTickersRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    project: "Project" = betterproto.enum_field(2)


@dataclass
class GetTickersResponse(betterproto.Message):
    tickers: List["Ticker"] = betterproto.message_field(1)


@dataclass
class Ticker(betterproto.Message):
    market: str = betterproto.string_field(1)
    market_address: str = betterproto.string_field(2)
    bid: float = betterproto.double_field(3)
    bid_size: float = betterproto.double_field(4)
    ask: float = betterproto.double_field(5)
    ask_size: float = betterproto.double_field(6)
    project: "Project" = betterproto.enum_field(7)


@dataclass
class GetKlineRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    from_: datetime = betterproto.message_field(2)
    to: datetime = betterproto.message_field(3)
    resolution: str = betterproto.string_field(4)
    limit: int = betterproto.uint32_field(5)


@dataclass
class GetKlineResponse(betterproto.Message):
    market: str = betterproto.string_field(1)
    timestamp: datetime = betterproto.message_field(2)
    candles: List["Candle"] = betterproto.message_field(3)


@dataclass
class Candle(betterproto.Message):
    start_time: datetime = betterproto.message_field(1)
    update_time: datetime = betterproto.message_field(2)
    open: float = betterproto.double_field(3)
    close: float = betterproto.double_field(4)
    low: float = betterproto.double_field(5)
    high: float = betterproto.double_field(6)
    amount: float = betterproto.double_field(7)
    volume: float = betterproto.double_field(8)
    count: float = betterproto.double_field(9)


@dataclass
class GetOrderbookRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetOrderbooksRequest(betterproto.Message):
    markets: List[str] = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetOrderbookResponse(betterproto.Message):
    market: str = betterproto.string_field(1)
    market_address: str = betterproto.string_field(2)
    bids: List["OrderbookItem"] = betterproto.message_field(3)
    asks: List["OrderbookItem"] = betterproto.message_field(4)


@dataclass
class OrderbookItem(betterproto.Message):
    price: float = betterproto.double_field(1)
    size: float = betterproto.double_field(2)
    order_i_d: str = betterproto.string_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)
    owner_address: str = betterproto.string_field(5)


@dataclass
class GetMarketDepthRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetMarketDepthsRequest(betterproto.Message):
    markets: List[str] = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetMarketDepthResponse(betterproto.Message):
    market: str = betterproto.string_field(1)
    market_address: str = betterproto.string_field(2)
    bids: List["MarketDepthItem"] = betterproto.message_field(3)
    asks: List["MarketDepthItem"] = betterproto.message_field(4)


@dataclass
class MarketDepthItem(betterproto.Message):
    price: float = betterproto.double_field(1)
    size: float = betterproto.double_field(2)


@dataclass
class GetTradesRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetTradesResponse(betterproto.Message):
    trades: List["Trade"] = betterproto.message_field(1)


@dataclass
class Trade(betterproto.Message):
    side: "Side" = betterproto.enum_field(1)
    size: float = betterproto.double_field(2)
    fill_price: float = betterproto.double_field(3)
    order_i_d: str = betterproto.string_field(4)
    is_maker: bool = betterproto.bool_field(5)
    address: str = betterproto.string_field(6)
    fee_or_rebate: float = betterproto.double_field(7)
    order_price: float = betterproto.double_field(8)


@dataclass
class GetServerTimeRequest(betterproto.Message):
    pass


@dataclass
class GetServerTimeResponse(betterproto.Message):
    timestamp: str = betterproto.string_field(1)


@dataclass
class GetAccountBalanceRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)


@dataclass
class GetAccountBalanceResponse(betterproto.Message):
    tokens: List["TokenBalance"] = betterproto.message_field(1)


@dataclass
class TokenBalance(betterproto.Message):
    symbol: str = betterproto.string_field(1)
    token_mint: str = betterproto.string_field(2)
    settled_amount: float = betterproto.double_field(3)
    unsettled_amount: float = betterproto.double_field(4)
    open_orders_amount: float = betterproto.double_field(5)


@dataclass
class GetTokenAccountsRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)


@dataclass
class GetTokenAccountsResponse(betterproto.Message):
    accounts: List["TokenAccount"] = betterproto.message_field(1)


@dataclass
class TokenAccount(betterproto.Message):
    symbol: str = betterproto.string_field(1)
    token_mint: str = betterproto.string_field(2)
    token_account: str = betterproto.string_field(3)
    amount: float = betterproto.double_field(4)


@dataclass
class PostOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    payer_address: str = betterproto.string_field(2)
    market: str = betterproto.string_field(3)
    side: "Side" = betterproto.enum_field(4)
    type: List[common.OrderType] = betterproto.enum_field(5)
    amount: float = betterproto.double_field(6)
    price: float = betterproto.double_field(7)
    open_orders_address: str = betterproto.string_field(8)
    client_order_i_d: int = betterproto.uint64_field(9)
    compute_limit: int = betterproto.uint32_field(10)
    compute_price: int = betterproto.uint64_field(11)
    project: "Project" = betterproto.enum_field(12)


@dataclass
class PostReplaceOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    payer_address: str = betterproto.string_field(2)
    market: str = betterproto.string_field(3)
    side: "Side" = betterproto.enum_field(4)
    type: List[common.OrderType] = betterproto.enum_field(5)
    amount: float = betterproto.double_field(6)
    price: float = betterproto.double_field(7)
    open_orders_address: str = betterproto.string_field(8)
    client_order_i_d: int = betterproto.uint64_field(9)
    order_i_d: str = betterproto.string_field(10)
    compute_limit: int = betterproto.uint32_field(11)
    compute_price: int = betterproto.uint64_field(12)
    project: "Project" = betterproto.enum_field(13)


@dataclass
class PostOrderResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)
    open_orders_address: str = betterproto.string_field(2)


@dataclass
class PostCancelOrderRequest(betterproto.Message):
    order_i_d: str = betterproto.string_field(1)
    side: "Side" = betterproto.enum_field(2)
    market_address: str = betterproto.string_field(3)
    owner_address: str = betterproto.string_field(4)
    open_orders_address: str = betterproto.string_field(5)
    compute_limit: int = betterproto.uint32_field(6)
    compute_price: int = betterproto.uint64_field(7)
    project: "Project" = betterproto.enum_field(8)


@dataclass
class PostCancelByClientOrderIDRequest(betterproto.Message):
    client_order_i_d: int = betterproto.uint64_field(1)
    market_address: str = betterproto.string_field(2)
    owner_address: str = betterproto.string_field(3)
    open_orders_address: str = betterproto.string_field(4)
    compute_limit: int = betterproto.uint32_field(5)
    compute_price: int = betterproto.uint64_field(6)
    project: "Project" = betterproto.enum_field(7)


@dataclass
class PostCancelOrderResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class PostCancelAllRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    owner_address: str = betterproto.string_field(2)
    open_orders_addresses: List[str] = betterproto.string_field(3)
    compute_limit: int = betterproto.uint32_field(4)
    compute_price: int = betterproto.uint64_field(5)
    project: "Project" = betterproto.enum_field(6)


@dataclass
class TransactionMessage(betterproto.Message):
    content: str = betterproto.string_field(1)
    is_cleanup: bool = betterproto.bool_field(2)


@dataclass
class TransactionMessageJito(betterproto.Message):
    content: str = betterproto.string_field(1)


@dataclass
class PostCancelAllResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class PostSettleRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    market: str = betterproto.string_field(2)
    base_token_wallet: str = betterproto.string_field(3)
    quote_token_wallet: str = betterproto.string_field(4)
    open_orders_address: str = betterproto.string_field(5)
    compute_limit: int = betterproto.uint32_field(6)
    compute_price: int = betterproto.uint64_field(7)
    project: "Project" = betterproto.enum_field(8)


@dataclass
class PostSettleResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class Settlement(betterproto.Message):
    symbol: str = betterproto.string_field(1)
    unsettled: float = betterproto.double_field(2)
    amount: float = betterproto.double_field(3)


@dataclass
class GetOrdersRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    status: "OrderStatus" = betterproto.enum_field(2)
    side: "Side" = betterproto.enum_field(3)
    types: List[common.OrderType] = betterproto.enum_field(4)
    from_: datetime = betterproto.message_field(5)
    limit: int = betterproto.uint32_field(6)
    direction: "Direction" = betterproto.enum_field(7)
    address: str = betterproto.string_field(8)
    open_orders_address: str = betterproto.string_field(9)
    project: "Project" = betterproto.enum_field(10)


@dataclass
class GetOrdersResponse(betterproto.Message):
    orders: List["Order"] = betterproto.message_field(1)


@dataclass
class Order(betterproto.Message):
    order_i_d: str = betterproto.string_field(1)
    market: str = betterproto.string_field(2)
    side: "Side" = betterproto.enum_field(3)
    types: List[common.OrderType] = betterproto.enum_field(4)
    price: float = betterproto.double_field(5)
    remaining_size: float = betterproto.double_field(6)
    created_at: datetime = betterproto.message_field(7)
    client_order_i_d: str = betterproto.string_field(8)
    open_order_account: str = betterproto.string_field(9)


@dataclass
class GetOrderStatusStreamRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    owner_address: str = betterproto.string_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetOrderStatusStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    order_info: "GetOrderStatusResponse" = betterproto.message_field(2)


@dataclass
class GetOrderStatusResponse(betterproto.Message):
    market: str = betterproto.string_field(1)
    open_order_address: str = betterproto.string_field(2)
    order_i_d: str = betterproto.string_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)
    quantity_released: float = betterproto.float_field(5)
    quantity_remaining: float = betterproto.float_field(6)
    fill_price: float = betterproto.float_field(7)
    side: "Side" = betterproto.enum_field(8)
    order_status: "OrderStatus" = betterproto.enum_field(9)
    order_price: float = betterproto.float_field(10)


@dataclass
class PostSubmitRequest(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)
    skip_pre_flight: bool = betterproto.bool_field(2)


@dataclass
class PostSubmitJitoBundleRequest(betterproto.Message):
    transactions: List["TransactionMessageJito"] = betterproto.message_field(1)


@dataclass
class PostSubmitJitoBundleResponse(betterproto.Message):
    uuids: str = betterproto.string_field(1)


@dataclass
class PostSubmitRequestEntry(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)
    skip_pre_flight: bool = betterproto.bool_field(2)


@dataclass
class PostSubmitBatchRequest(betterproto.Message):
    entries: List["PostSubmitRequestEntry"] = betterproto.message_field(1)
    submit_strategy: "SubmitStrategy" = betterproto.enum_field(2)


@dataclass
class PostSubmitBatchResponseEntry(betterproto.Message):
    signature: str = betterproto.string_field(1)
    error: str = betterproto.string_field(2)
    submitted: bool = betterproto.bool_field(3)


@dataclass
class PostSubmitBatchResponse(betterproto.Message):
    transactions: List["PostSubmitBatchResponseEntry"] = betterproto.message_field(1)


@dataclass
class PostSubmitResponse(betterproto.Message):
    signature: str = betterproto.string_field(1)


@dataclass
class GetOpenOrdersRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    address: str = betterproto.string_field(3)
    open_orders_address: str = betterproto.string_field(4)
    project: "Project" = betterproto.enum_field(5)


@dataclass
class GetOpenOrdersResponse(betterproto.Message):
    orders: List["Order"] = betterproto.message_field(1)


@dataclass
class GetOrderByIDRequest(betterproto.Message):
    order_i_d: str = betterproto.string_field(1)
    market: str = betterproto.string_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetOrderByIDResponse(betterproto.Message):
    order: "Order" = betterproto.message_field(1)


@dataclass
class GetUnsettledRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    owner_address: str = betterproto.string_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class UnsettledAccountToken(betterproto.Message):
    address: str = betterproto.string_field(1)
    amount: float = betterproto.double_field(2)


@dataclass
class UnsettledAccount(betterproto.Message):
    account: str = betterproto.string_field(1)
    base_token: "UnsettledAccountToken" = betterproto.message_field(2)
    quote_token: "UnsettledAccountToken" = betterproto.message_field(3)


@dataclass
class GetUnsettledResponse(betterproto.Message):
    market: str = betterproto.string_field(1)
    unsettled: List["UnsettledAccount"] = betterproto.message_field(2)


@dataclass
class GetOrderbooksStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    orderbook: "GetOrderbookResponse" = betterproto.message_field(2)


@dataclass
class GetMarketDepthsStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    data: "GetMarketDepthResponse" = betterproto.message_field(2)


@dataclass
class GetTickersStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    ticker: "GetTickersResponse" = betterproto.message_field(2)


@dataclass
class GetTradesStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    trades: "GetTradesResponse" = betterproto.message_field(2)


@dataclass
class GetQuotesRequest(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    out_token: str = betterproto.string_field(2)
    in_amount: float = betterproto.double_field(3)
    slippage: float = betterproto.double_field(4)
    limit: int = betterproto.int32_field(5)
    projects: List["Project"] = betterproto.enum_field(6)


@dataclass
class GetQuotesResponse(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    in_token_address: str = betterproto.string_field(2)
    out_token: str = betterproto.string_field(3)
    out_token_address: str = betterproto.string_field(4)
    in_amount: float = betterproto.double_field(5)
    quotes: List["ProjectQuote"] = betterproto.message_field(6)


@dataclass
class GetRaydiumQuotesRequest(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    out_token: str = betterproto.string_field(2)
    in_amount: float = betterproto.double_field(3)
    slippage: float = betterproto.double_field(4)


@dataclass
class GetRaydiumQuotesResponse(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    in_token_address: str = betterproto.string_field(2)
    out_token: str = betterproto.string_field(3)
    out_token_address: str = betterproto.string_field(4)
    in_amount: float = betterproto.double_field(5)
    routes: List["RaydiumQuoteRoute"] = betterproto.message_field(6)


@dataclass
class GetJupiterQuotesRequest(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    out_token: str = betterproto.string_field(2)
    in_amount: float = betterproto.double_field(3)
    slippage: float = betterproto.double_field(4)
    limit: int = betterproto.int32_field(5)


@dataclass
class GetJupiterQuotesResponse(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    in_token_address: str = betterproto.string_field(2)
    out_token: str = betterproto.string_field(3)
    out_token_address: str = betterproto.string_field(4)
    in_amount: float = betterproto.double_field(5)
    routes: List["JupiterQuoteRoute"] = betterproto.message_field(6)


@dataclass
class ProjectQuote(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    routes: List["QuoteRoute"] = betterproto.message_field(2)


@dataclass
class TradeSwapRequest(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    owner_address: str = betterproto.string_field(2)
    in_token: str = betterproto.string_field(3)
    out_token: str = betterproto.string_field(4)
    in_amount: float = betterproto.double_field(5)
    slippage: float = betterproto.double_field(6)
    compute_limit: int = betterproto.uint32_field(7)
    compute_price: int = betterproto.uint64_field(8)


@dataclass
class PostJupiterSwapRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    in_token: str = betterproto.string_field(2)
    out_token: str = betterproto.string_field(3)
    in_amount: float = betterproto.double_field(4)
    slippage: float = betterproto.double_field(5)
    compute_limit: int = betterproto.uint32_field(6)
    compute_price: int = betterproto.uint64_field(7)


@dataclass
class PostRaydiumSwapRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    in_token: str = betterproto.string_field(2)
    out_token: str = betterproto.string_field(3)
    in_amount: float = betterproto.double_field(4)
    slippage: float = betterproto.double_field(5)
    compute_limit: int = betterproto.uint32_field(6)
    compute_price: int = betterproto.uint64_field(7)


@dataclass
class PostRaydiumSwapResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)
    out_amount: float = betterproto.double_field(2)
    out_amount_min: float = betterproto.double_field(3)
    price_impact: common.PriceImpactPercentV2 = betterproto.message_field(4)
    fees: List[common.Fee] = betterproto.message_field(5)


@dataclass
class PostJupiterSwapResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)
    out_amount: float = betterproto.double_field(2)
    out_amount_min: float = betterproto.double_field(3)
    price_impact: common.PriceImpactPercentV2 = betterproto.message_field(4)
    fees: List[common.Fee] = betterproto.message_field(5)


@dataclass
class PostRaydiumRouteSwapResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)
    out_amount: float = betterproto.double_field(2)
    out_amount_min: float = betterproto.double_field(3)


@dataclass
class PostJupiterRouteSwapResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)
    out_amount: float = betterproto.double_field(2)
    out_amount_min: float = betterproto.double_field(3)
    price_impact: common.PriceImpactPercentV2 = betterproto.message_field(4)
    fees: List[common.Fee] = betterproto.message_field(5)


@dataclass
class RouteTradeSwapRequest(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    owner_address: str = betterproto.string_field(2)
    steps: List["RouteStep"] = betterproto.message_field(3)
    slippage: float = betterproto.double_field(4)
    compute_limit: int = betterproto.uint32_field(5)
    compute_price: int = betterproto.uint64_field(6)


@dataclass
class PostRaydiumRouteSwapRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    steps: List["RaydiumRouteStep"] = betterproto.message_field(2)
    slippage: float = betterproto.double_field(3)
    compute_limit: int = betterproto.uint32_field(4)
    compute_price: int = betterproto.uint64_field(5)


@dataclass
class RaydiumRouteStep(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    in_amount: float = betterproto.double_field(2)
    out_token: str = betterproto.string_field(3)
    out_amount: float = betterproto.double_field(4)
    out_amount_min: float = betterproto.double_field(5)
    pool_address: str = betterproto.string_field(6)


@dataclass
class PostJupiterRouteSwapRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    steps: List["JupiterRouteStep"] = betterproto.message_field(2)
    slippage: float = betterproto.double_field(3)
    compute_limit: int = betterproto.uint32_field(4)
    compute_price: int = betterproto.uint64_field(5)


@dataclass
class JupiterRouteStep(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    in_amount: float = betterproto.double_field(2)
    out_token: str = betterproto.string_field(3)
    out_amount: float = betterproto.double_field(4)
    out_amount_min: float = betterproto.double_field(5)
    project: "StepProject" = betterproto.message_field(6)


@dataclass
class RouteStep(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    in_amount: float = betterproto.double_field(2)
    out_token: str = betterproto.string_field(3)
    out_amount: float = betterproto.double_field(4)
    out_amount_min: float = betterproto.double_field(5)
    project: "StepProject" = betterproto.message_field(6)


@dataclass
class TradeSwapResponse(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    transactions: List["TransactionMessage"] = betterproto.message_field(2)
    out_amount: float = betterproto.double_field(3)
    out_amount_min: float = betterproto.double_field(4)
    price_impact: common.PriceImpactPercent = betterproto.message_field(5)
    fees: List[common.Fee] = betterproto.message_field(6)


@dataclass
class QuoteRoute(betterproto.Message):
    in_amount: float = betterproto.double_field(1)
    out_amount: float = betterproto.double_field(2)
    out_amount_min: float = betterproto.double_field(3)
    steps: List["QuoteStep"] = betterproto.message_field(4)


@dataclass
class QuoteStep(betterproto.Message):
    project: "StepProject" = betterproto.message_field(1)
    in_token: str = betterproto.string_field(2)
    in_token_address: str = betterproto.string_field(3)
    out_token: str = betterproto.string_field(4)
    out_token_address: str = betterproto.string_field(5)
    in_amount: float = betterproto.double_field(6)
    out_amount: float = betterproto.double_field(7)
    slippage: float = betterproto.double_field(8)
    price_impact_percent: common.PriceImpactPercent = betterproto.message_field(9)
    fee: common.Fee = betterproto.message_field(10)
    out_amount_min: float = betterproto.double_field(11)


@dataclass
class JupiterQuoteRoute(betterproto.Message):
    in_amount: float = betterproto.double_field(1)
    out_amount: float = betterproto.double_field(2)
    out_amount_min: float = betterproto.double_field(3)
    steps: List["JupiterQuoteStep"] = betterproto.message_field(4)


@dataclass
class JupiterQuoteStep(betterproto.Message):
    project: "StepProject" = betterproto.message_field(1)
    in_token: str = betterproto.string_field(2)
    in_token_address: str = betterproto.string_field(3)
    out_token: str = betterproto.string_field(4)
    out_token_address: str = betterproto.string_field(5)
    in_amount: float = betterproto.double_field(6)
    out_amount: float = betterproto.double_field(7)
    slippage: float = betterproto.double_field(8)
    price_impact_percent: common.PriceImpactPercentV2 = betterproto.message_field(9)
    fee: common.Fee = betterproto.message_field(10)
    out_amount_min: float = betterproto.double_field(11)


@dataclass
class RaydiumQuoteRoute(betterproto.Message):
    in_amount: float = betterproto.double_field(1)
    out_amount: float = betterproto.double_field(2)
    out_amount_min: float = betterproto.double_field(3)
    steps: List["RaydiumQuoteStep"] = betterproto.message_field(4)


@dataclass
class RaydiumQuoteStep(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    in_token_address: str = betterproto.string_field(2)
    out_token: str = betterproto.string_field(3)
    out_token_address: str = betterproto.string_field(4)
    in_amount: float = betterproto.double_field(5)
    out_amount: float = betterproto.double_field(6)
    slippage: float = betterproto.double_field(7)
    price_impact_percent: common.PriceImpactPercentV2 = betterproto.message_field(8)
    fee: common.Fee = betterproto.message_field(10)
    out_amount_min: float = betterproto.double_field(11)


@dataclass
class StepProject(betterproto.Message):
    label: str = betterproto.string_field(1)
    id: str = betterproto.string_field(2)


@dataclass
class GetRecentBlockHashRequest(betterproto.Message):
    pass


@dataclass
class GetRecentBlockHashResponse(betterproto.Message):
    block_hash: str = betterproto.string_field(1)


@dataclass
class Block(betterproto.Message):
    slot: int = betterproto.uint64_field(1)
    hash: str = betterproto.string_field(2)
    time: int = betterproto.int64_field(3)
    height: int = betterproto.uint64_field(4)


@dataclass
class GetBlockStreamRequest(betterproto.Message):
    pass


@dataclass
class GetBlockStreamResponse(betterproto.Message):
    block: "Block" = betterproto.message_field(1)


@dataclass
class GetPoolsRequest(betterproto.Message):
    projects: List["Project"] = betterproto.enum_field(1)
    pair_or_address: str = betterproto.string_field(2)


@dataclass
class GetPoolsResponse(betterproto.Message):
    projects: List["ProjectPools"] = betterproto.message_field(1)


@dataclass
class GetRaydiumPoolsRequest(betterproto.Message):
    pair_or_address: str = betterproto.string_field(1)


@dataclass
class GetRaydiumPoolsResponse(betterproto.Message):
    pools: List["ProjectPool"] = betterproto.message_field(1)


@dataclass
class GetTransactionRequest(betterproto.Message):
    signature: str = betterproto.string_field(1)


@dataclass
class GetTransactionResponse(betterproto.Message):
    status: str = betterproto.string_field(1)
    metadata: "TransactionMeta" = betterproto.message_field(2)


@dataclass
class Instruction(betterproto.Message):
    program_id_index: int = betterproto.uint32_field(1)
    accounts: List[int] = betterproto.uint32_field(2)
    data: str = betterproto.string_field(3)


@dataclass
class TransactionMeta(betterproto.Message):
    err: str = betterproto.string_field(1)
    errored: bool = betterproto.bool_field(2)
    fee: int = betterproto.uint64_field(3)
    pre_balances: List[int] = betterproto.uint64_field(4)
    post_balances: List[int] = betterproto.uint64_field(5)
    inner_instructions: List[
        "TransactionMetaInnerInstruction"
    ] = betterproto.message_field(6)
    log_messages: List[str] = betterproto.string_field(7)
    pre_token_balances: List["TransactionMetaTokenBalance"] = betterproto.message_field(
        8
    )
    post_token_balances: List[
        "TransactionMetaTokenBalance"
    ] = betterproto.message_field(9)


@dataclass
class TransactionMetaInnerInstruction(betterproto.Message):
    index: int = betterproto.uint32_field(1)
    instructions: List["Instruction"] = betterproto.message_field(2)


@dataclass
class TransactionMetaTokenBalance(betterproto.Message):
    account_index: int = betterproto.uint32_field(1)
    mint: str = betterproto.string_field(2)
    ui_token_amount: "UITokenAmount" = betterproto.message_field(3)
    owner: str = betterproto.string_field(4)


@dataclass
class UITokenAmount(betterproto.Message):
    ui_amount: float = betterproto.float_field(1)
    decimals: int = betterproto.uint32_field(2)
    amount: str = betterproto.string_field(3)
    ui_amount_string: str = betterproto.string_field(4)


@dataclass
class ProjectPools(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    pools: List["ProjectPool"] = betterproto.message_field(2)


@dataclass
class ProjectPool(betterproto.Message):
    pool: str = betterproto.string_field(1)
    pool_address: str = betterproto.string_field(2)
    token1_reserves: int = betterproto.int64_field(3)
    token1_mint_address: str = betterproto.string_field(4)
    token1_mint_symbol: str = betterproto.string_field(5)
    token2_reserves: int = betterproto.int64_field(6)
    token2_mint_address: str = betterproto.string_field(7)
    token2_mint_symbol: str = betterproto.string_field(8)
    open_time: int = betterproto.uint64_field(9)


@dataclass
class GetQuotesStreamRequest(betterproto.Message):
    projects: List["Project"] = betterproto.enum_field(1)
    token_pairs: List["TokenPair"] = betterproto.message_field(2)


@dataclass
class GetQuotesStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    quote: "GetQuotesStreamUpdate" = betterproto.message_field(2)


@dataclass
class GetQuotesStreamUpdate(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    in_token_address: str = betterproto.string_field(2)
    out_token: str = betterproto.string_field(3)
    out_token_address: str = betterproto.string_field(4)
    in_amount: float = betterproto.double_field(5)
    out_amount: float = betterproto.double_field(6)
    project: "Project" = betterproto.enum_field(7)


@dataclass
class GetSwapsStreamRequest(betterproto.Message):
    projects: List["Project"] = betterproto.enum_field(1)
    pools: List[str] = betterproto.string_field(2)
    include_failed: bool = betterproto.bool_field(3)


@dataclass
class GetSwapsStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    swap: "GetSwapsStreamUpdate" = betterproto.message_field(2)


@dataclass
class GetNewRaydiumPoolsRequest(betterproto.Message):
    pass


@dataclass
class GetNewRaydiumPoolsResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    pool: "ProjectPool" = betterproto.message_field(2)


@dataclass
class GetSwapsStreamUpdate(betterproto.Message):
    success: bool = betterproto.bool_field(1)
    project: "Project" = betterproto.enum_field(2)
    pool_address: str = betterproto.string_field(3)
    in_token: str = betterproto.string_field(4)
    in_token_address: str = betterproto.string_field(5)
    out_token: str = betterproto.string_field(6)
    out_token_address: str = betterproto.string_field(7)
    in_amount: float = betterproto.double_field(8)
    out_amount_min: float = betterproto.double_field(9)
    source_account: str = betterproto.string_field(10)
    destination_account: str = betterproto.string_field(11)
    owner_account: str = betterproto.string_field(12)
    signature: str = betterproto.string_field(13)


@dataclass
class TokenPair(betterproto.Message):
    in_token: str = betterproto.string_field(1)
    out_token: str = betterproto.string_field(2)
    in_amount: float = betterproto.double_field(3)


@dataclass
class GetPriceRequest(betterproto.Message):
    tokens: List[str] = betterproto.string_field(1)


@dataclass
class GetPriceResponse(betterproto.Message):
    token_prices: List["TokenPrice"] = betterproto.message_field(1)


@dataclass
class GetRaydiumPricesRequest(betterproto.Message):
    tokens: List[str] = betterproto.string_field(1)


@dataclass
class GetJupiterPricesRequest(betterproto.Message):
    tokens: List[str] = betterproto.string_field(1)


@dataclass
class GetRaydiumPricesResponse(betterproto.Message):
    token_prices: List["TokenPriceV2"] = betterproto.message_field(1)


@dataclass
class GetJupiterPricesResponse(betterproto.Message):
    token_prices: List["TokenPriceV2"] = betterproto.message_field(1)


@dataclass
class TokenPrice(betterproto.Message):
    token: str = betterproto.string_field(1)
    token_address: str = betterproto.string_field(2)
    project: "Project" = betterproto.enum_field(3)
    buy: float = betterproto.double_field(4)
    buy_size: float = betterproto.double_field(5)
    sell: float = betterproto.double_field(6)
    sell_size: float = betterproto.double_field(7)


@dataclass
class TokenPriceV2(betterproto.Message):
    token: str = betterproto.string_field(1)
    token_address: str = betterproto.string_field(2)
    buy: float = betterproto.double_field(3)
    buy_size: float = betterproto.double_field(4)
    sell: float = betterproto.double_field(5)
    sell_size: float = betterproto.double_field(6)


@dataclass
class GetPoolReservesStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    reserves: "PoolReserves" = betterproto.message_field(2)


@dataclass
class PoolReserves(betterproto.Message):
    token1_reserves: str = betterproto.string_field(1)
    token1_address: str = betterproto.string_field(2)
    token2_reserves: str = betterproto.string_field(3)
    token2_address: str = betterproto.string_field(4)
    pool_address: str = betterproto.string_field(5)
    project: "Project" = betterproto.enum_field(6)


@dataclass
class GetPoolReservesStreamRequest(betterproto.Message):
    projects: List["Project"] = betterproto.enum_field(1)
    pair_or_address: str = betterproto.string_field(2)


@dataclass
class GetPricesStreamRequest(betterproto.Message):
    projects: List["Project"] = betterproto.enum_field(1)
    tokens: List[str] = betterproto.string_field(2)


@dataclass
class GetPricesStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    price: "TokenPrice" = betterproto.message_field(2)


@dataclass
class GetPerpOrderbookRequest(betterproto.Message):
    """Drift messages"""

    contract: common.PerpContract = betterproto.enum_field(1)
    limit: int = betterproto.uint32_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetPerpOrderbooksRequest(betterproto.Message):
    contracts: List[common.PerpContract] = betterproto.enum_field(1)
    limit: int = betterproto.uint32_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetPerpOrderbookResponse(betterproto.Message):
    contract: common.PerpContract = betterproto.enum_field(1)
    bids: List["PerpOrderbookItem"] = betterproto.message_field(2)
    asks: List["PerpOrderbookItem"] = betterproto.message_field(3)


@dataclass
class PerpOrderbookItem(betterproto.Message):
    price: float = betterproto.double_field(1)
    size: float = betterproto.double_field(2)
    order_i_d: str = betterproto.string_field(3)
    client_order_i_d: str = betterproto.string_field(4)
    status: str = betterproto.string_field(5)
    order_type: str = betterproto.string_field(6)
    slot: int = betterproto.int64_field(7)
    reduce_only: bool = betterproto.bool_field(8)
    trigger_price: float = betterproto.double_field(9)
    trigger_condition: str = betterproto.string_field(10)
    post_only: bool = betterproto.bool_field(11)
    oracle_price_offset: float = betterproto.double_field(12)
    auction_duration: int = betterproto.int32_field(13)
    auction_start_price: float = betterproto.double_field(14)
    auction_end_price: float = betterproto.double_field(15)


@dataclass
class GetPerpOrderbooksStreamResponse(betterproto.Message):
    slot: int = betterproto.int64_field(1)
    orderbook: "GetPerpOrderbookResponse" = betterproto.message_field(2)


@dataclass
class GetUserRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class GetUserResponse(betterproto.Message):
    user_accounts: List["UserDetail"] = betterproto.message_field(1)


@dataclass
class UserDetail(betterproto.Message):
    status: str = betterproto.string_field(1)
    sub_account_id: int = betterproto.uint64_field(2)
    account_address: str = betterproto.string_field(3)
    account_name: str = betterproto.string_field(4)


@dataclass
class PostCreateUserRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    project: "Project" = betterproto.enum_field(2)
    action: str = betterproto.string_field(3)
    sub_account_i_d: int = betterproto.uint64_field(4)
    account_name: str = betterproto.string_field(5)


@dataclass
class PostCreateUserResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class PostCancelPerpOrdersRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    project: "Project" = betterproto.enum_field(2)
    contract: common.PerpContract = betterproto.enum_field(3)
    account_address: str = betterproto.string_field(4)


@dataclass
class PostCancelPerpOrdersResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class PostCancelDriftMarginOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    client_order_i_d: int = betterproto.uint64_field(3)
    order_i_d: int = betterproto.uint64_field(4)


@dataclass
class PostCancelDriftMarginOrderResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class PostModifyDriftOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    order_i_d: int = betterproto.uint64_field(3)
    new_position_side: str = betterproto.string_field(4)
    post_only: str = betterproto.string_field(5)
    new_base_amount: float = betterproto.double_field(6)
    new_limit_price: float = betterproto.double_field(7)


@dataclass
class PostModifyDriftOrderResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class PostCancelPerpOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    project: "Project" = betterproto.enum_field(2)
    contract: common.PerpContract = betterproto.enum_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)
    order_i_d: int = betterproto.uint64_field(5)
    account_address: str = betterproto.string_field(6)


@dataclass
class PostCancelPerpOrderResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class PostCreateDriftUserRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    action: str = betterproto.string_field(2)
    sub_account_i_d: int = betterproto.uint64_field(3)
    account_name: str = betterproto.string_field(4)


@dataclass
class PostCreateDriftUserResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class GetDriftUserRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)


@dataclass
class GetDriftUserResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    user_accounts: List["UserDetail"] = betterproto.message_field(2)


@dataclass
class PostCloseDriftPerpPositionsRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    contracts: List[str] = betterproto.string_field(3)


@dataclass
class PostCloseDriftPerpPositionsResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class GetDriftPerpOrderbookRequest(betterproto.Message):
    contract: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)


@dataclass
class GetDriftPerpOrderbookResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    contract: str = betterproto.string_field(2)
    bids: List["PerpOrderbookItem"] = betterproto.message_field(3)
    asks: List["PerpOrderbookItem"] = betterproto.message_field(4)


@dataclass
class PostManageCollateralRequest(betterproto.Message):
    account_address: str = betterproto.string_field(1)
    amount: float = betterproto.double_field(2)
    project: "Project" = betterproto.enum_field(3)
    type: common.PerpCollateralType = betterproto.enum_field(4)
    token: common.PerpCollateralToken = betterproto.enum_field(5)
    to_account_address: str = betterproto.string_field(6)


@dataclass
class PostManageCollateralResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class GetDriftOpenMarginOrdersRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    markets: List[str] = betterproto.string_field(3)


@dataclass
class GetDriftOpenMarginOrdersResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    owner_address: str = betterproto.string_field(2)
    orders: List["DriftMarginOrder"] = betterproto.message_field(3)


@dataclass
class DriftMarginOrder(betterproto.Message):
    order_i_d: int = betterproto.uint64_field(1)
    client_order_i_d: int = betterproto.uint64_field(2)
    market: str = betterproto.string_field(3)
    position_side: str = betterproto.string_field(4)
    order_type: str = betterproto.string_field(5)
    price: float = betterproto.double_field(6)
    size: float = betterproto.double_field(7)
    remaining_size: float = betterproto.double_field(8)
    status: str = betterproto.string_field(9)
    account_address: str = betterproto.string_field(10)
    sub_account_i_d: int = betterproto.uint64_field(11)
    post_only: bool = betterproto.bool_field(12)


@dataclass
class GetOpenPerpOrdersRequest(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    owner_address: str = betterproto.string_field(2)
    account_address: str = betterproto.string_field(3)
    contracts: List[common.PerpContract] = betterproto.enum_field(4)


@dataclass
class GetOpenPerpOrdersResponse(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    orders: List["PerpOrder"] = betterproto.message_field(2)


@dataclass
class PerpOrder(betterproto.Message):
    order_i_d: int = betterproto.uint64_field(1)
    client_order_i_d: int = betterproto.uint64_field(2)
    contract: common.PerpContract = betterproto.enum_field(3)
    position_side: common.PerpPositionSide = betterproto.enum_field(4)
    order_type: str = betterproto.string_field(5)
    price: float = betterproto.double_field(6)
    size: float = betterproto.double_field(7)
    remaining_size: float = betterproto.double_field(8)
    status: str = betterproto.string_field(9)
    account_address: str = betterproto.string_field(10)
    sub_account_i_d: int = betterproto.uint64_field(11)
    post_only: bool = betterproto.bool_field(12)


@dataclass
class GetPerpPositionsRequest(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    owner_address: str = betterproto.string_field(2)
    account_address: str = betterproto.string_field(3)
    contracts: List[common.PerpContract] = betterproto.enum_field(4)


@dataclass
class GetPerpPositionsResponse(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    perp_positions: List["PerpPosition"] = betterproto.message_field(2)


@dataclass
class PostClosePerpPositionsRequest(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    owner_address: str = betterproto.string_field(2)
    account_address: str = betterproto.string_field(3)
    contracts: List[common.PerpContract] = betterproto.enum_field(4)


@dataclass
class PostClosePerpPositionsResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class PerpPosition(betterproto.Message):
    contract: common.PerpContract = betterproto.enum_field(1)
    volume_available: float = betterproto.double_field(2)
    volume_in_order: float = betterproto.double_field(3)
    position_margin: float = betterproto.double_field(4)
    position_side: common.PerpPositionSide = betterproto.enum_field(5)
    notional_value: float = betterproto.double_field(6)
    index_price: float = betterproto.double_field(7)
    liquidation_price: float = betterproto.double_field(8)
    account_address: str = betterproto.string_field(9)
    sub_account_i_d: int = betterproto.int64_field(10)
    unrealized_p_n_l: float = betterproto.double_field(11)


@dataclass
class PostPerpOrderRequest(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)
    owner_address: str = betterproto.string_field(2)
    contract: common.PerpContract = betterproto.enum_field(3)
    account_address: str = betterproto.string_field(4)
    position_side: common.PerpPositionSide = betterproto.enum_field(5)
    slippage: float = betterproto.double_field(6)
    type: common.PerpOrderType = betterproto.enum_field(7)
    amount: float = betterproto.double_field(8)
    price: float = betterproto.double_field(9)
    client_order_i_d: int = betterproto.uint64_field(10)
    post_only: common.PostOnlyParams = betterproto.enum_field(11)


@dataclass
class PostPerpOrderResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class PostDriftPerpOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    contract: str = betterproto.string_field(2)
    account_address: str = betterproto.string_field(3)
    position_side: str = betterproto.string_field(4)
    slippage: float = betterproto.double_field(5)
    type: str = betterproto.string_field(6)
    amount: float = betterproto.double_field(7)
    price: float = betterproto.double_field(8)
    client_order_i_d: int = betterproto.uint64_field(9)
    post_only: str = betterproto.string_field(10)


@dataclass
class PostDriftPerpOrderResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class PostDriftMarginOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    market: str = betterproto.string_field(3)
    position_side: str = betterproto.string_field(4)
    slippage: float = betterproto.double_field(5)
    type: str = betterproto.string_field(6)
    amount: float = betterproto.double_field(7)
    price: float = betterproto.double_field(8)
    client_order_i_d: int = betterproto.uint64_field(9)
    post_only: str = betterproto.string_field(10)


@dataclass
class PostDriftMarginOrderResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class PostDriftEnableMarginTradingRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    enable_margin: bool = betterproto.bool_field(3)


@dataclass
class PostDriftEnableMarginTradingResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class GetPerpTradesStreamRequest(betterproto.Message):
    contracts: List[common.PerpContract] = betterproto.enum_field(1)
    project: "Project" = betterproto.enum_field(2)


@dataclass
class GetPerpTradesStreamResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    trade: "GetPerpTradesResponse" = betterproto.message_field(2)


@dataclass
class GetPerpTradesResponse(betterproto.Message):
    contract: common.PerpContract = betterproto.enum_field(1)
    index_price: float = betterproto.double_field(2)
    market_index: int = betterproto.int64_field(3)
    filler: str = betterproto.string_field(4)
    filler_reward: float = betterproto.double_field(5)
    fill_record_i_d: int = betterproto.int64_field(6)
    base_asset_amount_filled: float = betterproto.double_field(7)
    quote_asset_amount_filled: float = betterproto.double_field(8)
    taker_fee: float = betterproto.double_field(9)
    maker_fee: float = betterproto.double_field(10)
    referrer_reward: float = betterproto.double_field(11)
    quote_asset_amount_surplus: float = betterproto.double_field(12)
    spot_fulfillment_method_fee: float = betterproto.double_field(13)
    taker: str = betterproto.string_field(14)
    taker_order_i_d: int = betterproto.int64_field(15)
    taker_order_direction: str = betterproto.string_field(16)
    taker_order_base_asset_amount: float = betterproto.double_field(17)
    taker_order_cumulative_base_asset_amount_filled: float = betterproto.double_field(
        18
    )
    taker_order_cumulative_quote_asset_amount_filled: float = betterproto.double_field(
        19
    )
    maker: str = betterproto.string_field(20)
    maker_order_i_d: int = betterproto.int64_field(21)
    maker_order_direction: str = betterproto.string_field(22)
    maker_order_base_asset_amount: float = betterproto.double_field(23)
    maker_order_cumulative_base_asset_amount_filled: float = betterproto.double_field(
        24
    )
    maker_order_cumulative_quote_asset_amount_filled: float = betterproto.double_field(
        25
    )


@dataclass
class PostSettlePNLRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    settlee_account_address: str = betterproto.string_field(2)
    contract: common.PerpContract = betterproto.enum_field(3)
    project: "Project" = betterproto.enum_field(4)


@dataclass
class PostSettlePNLResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class GetAssetsRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    project: "Project" = betterproto.enum_field(3)


@dataclass
class Asset(betterproto.Message):
    valuation_asset: str = betterproto.string_field(1)
    balance: float = betterproto.double_field(2)
    valuation: float = betterproto.double_field(3)
    account_address: str = betterproto.string_field(4)
    sub_account_i_d: int = betterproto.int64_field(5)


@dataclass
class GetAssetsResponse(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    assets: List["Asset"] = betterproto.message_field(2)


@dataclass
class PostSettlePNLsRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    settlee_account_addresses: List[str] = betterproto.string_field(2)
    contract: common.PerpContract = betterproto.enum_field(3)
    project: "Project" = betterproto.enum_field(4)


@dataclass
class PostSettlePNLsResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class PostLiquidatePerpRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    settlee_account_address: str = betterproto.string_field(2)
    contract: common.PerpContract = betterproto.enum_field(3)
    amount: float = betterproto.double_field(4)
    project: "Project" = betterproto.enum_field(5)


@dataclass
class PostLiquidatePerpResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class GetPerpContractsRequest(betterproto.Message):
    project: "Project" = betterproto.enum_field(1)


@dataclass
class ContractInfo(betterproto.Message):
    contract: common.PerpContract = betterproto.enum_field(1)
    contract_address: str = betterproto.string_field(2)
    funding_rate: float = betterproto.double_field(3)
    min_size: float = betterproto.double_field(4)
    perp_price: float = betterproto.double_field(5)
    index_price: float = betterproto.double_field(6)
    open_interest: float = betterproto.double_field(7)


@dataclass
class GetPerpContractsResponse(betterproto.Message):
    contracts: List["ContractInfo"] = betterproto.message_field(1)


@dataclass
class GetOpenPerpOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    order_i_d: int = betterproto.uint64_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)
    project: "Project" = betterproto.enum_field(5)


@dataclass
class GetOpenPerpOrderResponse(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    order: "PerpOrder" = betterproto.message_field(2)


@dataclass
class GetDriftOpenMarginOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    order_i_d: int = betterproto.uint64_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)


@dataclass
class GetDriftOpenMarginOrderResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    owner_address: str = betterproto.string_field(2)
    order: "DriftMarginOrder" = betterproto.message_field(3)


@dataclass
class GetDriftOpenPerpOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    order_i_d: int = betterproto.uint64_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)


@dataclass
class GetDriftOpenPerpOrderResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    owner_address: str = betterproto.string_field(2)
    order: "DriftPerpOrder" = betterproto.message_field(3)


@dataclass
class PostDriftManageCollateralRequest(betterproto.Message):
    account_address: str = betterproto.string_field(1)
    amount: float = betterproto.double_field(2)
    type: str = betterproto.string_field(3)
    token: str = betterproto.string_field(4)
    to_account_address: str = betterproto.string_field(5)


@dataclass
class PostDriftManageCollateralResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class GetDriftPerpContractsRequest(betterproto.Message):
    pass


@dataclass
class GetDriftPerpContractsResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    contracts: List["ContractInfo"] = betterproto.message_field(2)


@dataclass
class PostDriftSettlePNLRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    settlee_account_address: str = betterproto.string_field(2)
    contract: str = betterproto.string_field(3)


@dataclass
class PostDriftSettlePNLResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class GetDriftAssetsRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)


@dataclass
class GetDriftAssetsResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    owner_address: str = betterproto.string_field(2)
    assets: List["Asset"] = betterproto.message_field(3)


@dataclass
class PostDriftSettlePNLsRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    settlee_account_addresses: List[str] = betterproto.string_field(2)
    contract: str = betterproto.string_field(3)


@dataclass
class PostDriftSettlePNLsResponse(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class PostLiquidateDriftPerpRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    settlee_account_address: str = betterproto.string_field(2)
    contract: str = betterproto.string_field(3)
    amount: float = betterproto.double_field(4)


@dataclass
class PostLiquidateDriftPerpResponse(betterproto.Message):
    transaction: "TransactionMessage" = betterproto.message_field(1)


@dataclass
class Context(betterproto.Message):
    """Drift V2"""

    slot: int = betterproto.uint64_field(1)


@dataclass
class GetDriftOpenPerpOrdersRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    contracts: List[str] = betterproto.string_field(3)


@dataclass
class GetDriftOpenPerpOrdersValue(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    orders: List["DriftPerpOrder"] = betterproto.message_field(2)


@dataclass
class GetDriftOpenPerpOrdersResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    data: "GetDriftOpenPerpOrdersValue" = betterproto.message_field(2)


@dataclass
class DriftPerpOrder(betterproto.Message):
    order_i_d: int = betterproto.uint64_field(1)
    client_order_i_d: int = betterproto.uint64_field(2)
    contract: str = betterproto.string_field(3)
    position_side: str = betterproto.string_field(4)
    order_type: str = betterproto.string_field(5)
    price: float = betterproto.double_field(6)
    size: float = betterproto.double_field(7)
    remaining_size: float = betterproto.double_field(8)
    status: str = betterproto.string_field(9)
    account_address: str = betterproto.string_field(10)
    sub_account_i_d: int = betterproto.uint64_field(11)
    post_only: bool = betterproto.bool_field(12)


@dataclass
class PostDriftCancelPerpOrderRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    contract: str = betterproto.string_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)
    order_i_d: int = betterproto.uint64_field(5)


@dataclass
class PostDriftCancelPerpOrderValue(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class PostDriftCancelPerpOrderResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    data: "PostDriftCancelPerpOrderValue" = betterproto.message_field(2)


@dataclass
class GetDriftPerpPositionsRequest(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    contracts: List[str] = betterproto.string_field(3)


@dataclass
class GetDriftPerpPositionsValue(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    perp_positions: List["DriftPerpPosition"] = betterproto.message_field(2)


@dataclass
class GetDriftPerpPositionsResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    data: "GetDriftPerpPositionsValue" = betterproto.message_field(2)


@dataclass
class DriftPerpPosition(betterproto.Message):
    contract: str = betterproto.string_field(1)
    account_address: str = betterproto.string_field(2)
    sub_account_i_d: int = betterproto.int64_field(3)
    volume_available: float = betterproto.double_field(4)
    volume_in_order: float = betterproto.double_field(5)
    position_margin: float = betterproto.double_field(6)
    position_side: str = betterproto.string_field(7)
    notional_value: float = betterproto.double_field(8)
    index_price: float = betterproto.double_field(9)
    liquidation_price: float = betterproto.double_field(10)
    unrealized_p_n_l: float = betterproto.double_field(11)


@dataclass
class GetDriftMarginOrderbooksRequest(betterproto.Message):
    markets: List[str] = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    metadata: bool = betterproto.bool_field(3)


@dataclass
class GetDriftMarginOrderbooksStreamResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    orderbook: "GetDriftMarginOrderbookResponse" = betterproto.message_field(2)


@dataclass
class GetDriftMarginOrderbookRequest(betterproto.Message):
    market: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    metadata: bool = betterproto.bool_field(3)


@dataclass
class GetDriftMarginOrderbookValue(betterproto.Message):
    market: str = betterproto.string_field(1)
    market_address: str = betterproto.string_field(2)
    bids: List["DriftMarginOrderbookItem"] = betterproto.message_field(3)
    asks: List["DriftMarginOrderbookItem"] = betterproto.message_field(4)


@dataclass
class GetDriftMarginOrderbookResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    data: "GetDriftMarginOrderbookValue" = betterproto.message_field(2)


@dataclass
class DriftMarginOrderbookItem(betterproto.Message):
    price: float = betterproto.double_field(1)
    size: float = betterproto.double_field(2)
    order_i_d: str = betterproto.string_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)
    owner_address: str = betterproto.string_field(5)
    metadata: Dict[str, str] = betterproto.map_field(
        6, betterproto.TYPE_STRING, betterproto.TYPE_STRING
    )


@dataclass
class GetDriftMarketsRequest(betterproto.Message):
    metadata: bool = betterproto.bool_field(1)


@dataclass
class GetDriftMarketsValue(betterproto.Message):
    markets: Dict[str, "DriftMarket"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )


@dataclass
class GetDriftMarketsResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    data: "GetDriftMarketsValue" = betterproto.message_field(2)


@dataclass
class DriftMarket(betterproto.Message):
    market: str = betterproto.string_field(1)
    status: str = betterproto.string_field(2)
    address: str = betterproto.string_field(3)
    base_mint: str = betterproto.string_field(4)
    quoted_mint: str = betterproto.string_field(5)
    base_decimals: int = betterproto.int64_field(6)
    quote_decimals: int = betterproto.int64_field(7)
    metadata: Dict[str, str] = betterproto.map_field(
        8, betterproto.TYPE_STRING, betterproto.TYPE_STRING
    )


@dataclass
class GetDriftMarketDepthRequest(betterproto.Message):
    contract: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)


@dataclass
class GetDriftMarketDepthsStreamRequest(betterproto.Message):
    contracts: List[str] = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)


@dataclass
class GetDriftMarketDepthStreamResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    data: "GetDriftMarketDepthResponse" = betterproto.message_field(2)


@dataclass
class DriftMarketDepthItem(betterproto.Message):
    price: float = betterproto.double_field(1)
    size: float = betterproto.double_field(2)


@dataclass
class GetDriftMarketDepthValue(betterproto.Message):
    contract: str = betterproto.string_field(1)
    bids: List["DriftMarketDepthItem"] = betterproto.message_field(2)
    asks: List["DriftMarketDepthItem"] = betterproto.message_field(3)


@dataclass
class GetDriftMarketDepthResponse(betterproto.Message):
    context: "Context" = betterproto.message_field(1)
    data: "GetDriftMarketDepthValue" = betterproto.message_field(2)


@dataclass
class GetMarketsRequestV2(betterproto.Message):
    """Openbook V2 Messages"""

    pass


@dataclass
class GetMarketsResponseV2(betterproto.Message):
    markets: Dict[str, "MarketV2"] = betterproto.map_field(
        1, betterproto.TYPE_STRING, betterproto.TYPE_MESSAGE
    )


@dataclass
class MarketV2(betterproto.Message):
    market: str = betterproto.string_field(1)
    address: str = betterproto.string_field(3)
    base_mint: str = betterproto.string_field(4)
    quoted_mint: str = betterproto.string_field(5)
    base_decimals: int = betterproto.int64_field(6)
    quote_decimals: int = betterproto.int64_field(7)


@dataclass
class GetTickersRequestV2(betterproto.Message):
    market: str = betterproto.string_field(1)


@dataclass
class GetTickersResponseV2(betterproto.Message):
    tickers: List["TickerV2"] = betterproto.message_field(1)


@dataclass
class TickerV2(betterproto.Message):
    market: str = betterproto.string_field(1)
    market_address: str = betterproto.string_field(2)
    bid: float = betterproto.double_field(3)
    bid_size: float = betterproto.double_field(4)
    ask: float = betterproto.double_field(5)
    ask_size: float = betterproto.double_field(6)


@dataclass
class GetOrderbookRequestV2(betterproto.Message):
    market: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)


@dataclass
class GetOrderbookResponseV2(betterproto.Message):
    market: str = betterproto.string_field(1)
    market_address: str = betterproto.string_field(2)
    bids: List["OrderbookItemV2"] = betterproto.message_field(3)
    asks: List["OrderbookItemV2"] = betterproto.message_field(4)


@dataclass
class OrderbookItemV2(betterproto.Message):
    price: float = betterproto.double_field(1)
    size: float = betterproto.double_field(2)
    order_i_d: str = betterproto.string_field(3)
    client_order_i_d: int = betterproto.uint64_field(4)
    owner_address: str = betterproto.string_field(5)


@dataclass
class GetMarketDepthRequestV2(betterproto.Message):
    market: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)


@dataclass
class GetMarketDepthResponseV2(betterproto.Message):
    market: str = betterproto.string_field(1)
    market_address: str = betterproto.string_field(2)
    bids: List["MarketDepthItemV2"] = betterproto.message_field(3)
    asks: List["MarketDepthItemV2"] = betterproto.message_field(4)


@dataclass
class MarketDepthItemV2(betterproto.Message):
    price: float = betterproto.double_field(1)
    size: float = betterproto.double_field(2)


@dataclass
class PostOrderRequestV2(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    payer_address: str = betterproto.string_field(2)
    market: str = betterproto.string_field(3)
    side: str = betterproto.string_field(4)
    type: str = betterproto.string_field(5)
    amount: float = betterproto.double_field(6)
    price: float = betterproto.double_field(7)
    open_orders_address: str = betterproto.string_field(8)
    client_order_i_d: int = betterproto.uint64_field(9)
    compute_limit: int = betterproto.uint32_field(10)
    compute_price: int = betterproto.uint64_field(11)


@dataclass
class PostReplaceOrderRequestV2(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    payer_address: str = betterproto.string_field(2)
    market: str = betterproto.string_field(3)
    side: str = betterproto.string_field(4)
    type: str = betterproto.string_field(5)
    amount: float = betterproto.double_field(6)
    price: float = betterproto.double_field(7)
    open_orders_address: str = betterproto.string_field(8)
    client_order_i_d: int = betterproto.uint64_field(9)
    order_i_d: str = betterproto.string_field(10)
    compute_limit: int = betterproto.uint32_field(11)
    compute_price: int = betterproto.uint64_field(12)


@dataclass
class PostCancelOrderRequestV2(betterproto.Message):
    order_i_d: str = betterproto.string_field(1)
    side: str = betterproto.string_field(2)
    market_address: str = betterproto.string_field(3)
    owner_address: str = betterproto.string_field(4)
    open_orders_address: str = betterproto.string_field(5)
    client_order_i_d: int = betterproto.uint64_field(6)
    compute_limit: int = betterproto.uint32_field(7)
    compute_price: int = betterproto.uint64_field(8)


@dataclass
class PostCancelOrderResponseV2(betterproto.Message):
    transactions: List["TransactionMessage"] = betterproto.message_field(1)


@dataclass
class PostSettleRequestV2(betterproto.Message):
    owner_address: str = betterproto.string_field(1)
    market: str = betterproto.string_field(2)
    base_token_wallet: str = betterproto.string_field(3)
    quote_token_wallet: str = betterproto.string_field(4)
    open_orders_address: str = betterproto.string_field(5)
    compute_limit: int = betterproto.uint32_field(6)
    compute_price: int = betterproto.uint64_field(7)


@dataclass
class GetOpenOrdersRequestV2(betterproto.Message):
    market: str = betterproto.string_field(1)
    limit: int = betterproto.uint32_field(2)
    address: str = betterproto.string_field(3)
    open_orders_address: str = betterproto.string_field(4)
    order_i_d: str = betterproto.string_field(5)
    client_order_i_d: int = betterproto.uint64_field(6)


@dataclass
class GetUnsettledRequestV2(betterproto.Message):
    market: str = betterproto.string_field(1)
    owner_address: str = betterproto.string_field(2)


@dataclass
class GetOpenOrdersResponseV2(betterproto.Message):
    orders: List["OrderV2"] = betterproto.message_field(1)


@dataclass
class OrderV2(betterproto.Message):
    order_i_d: str = betterproto.string_field(1)
    market: str = betterproto.string_field(2)
    side: str = betterproto.string_field(3)
    type: str = betterproto.string_field(4)
    price: float = betterproto.double_field(5)
    remaining_size: float = betterproto.double_field(6)
    created_at: datetime = betterproto.message_field(7)
    client_order_i_d: str = betterproto.string_field(8)
    open_order_account: str = betterproto.string_field(9)


class ApiStub(betterproto.ServiceStub):
    async def get_transaction(self, *, signature: str = "") -> GetTransactionResponse:
        request = GetTransactionRequest()
        request.signature = signature

        return await self._unary_unary(
            "/api.Api/GetTransaction",
            request,
            GetTransactionResponse,
        )

    async def post_submit_v2(
        self,
        *,
        transaction: Optional["TransactionMessage"] = None,
        skip_pre_flight: bool = False,
    ) -> PostSubmitResponse:
        request = PostSubmitRequest()
        if transaction is not None:
            request.transaction = transaction
        request.skip_pre_flight = skip_pre_flight

        return await self._unary_unary(
            "/api.Api/PostSubmitV2",
            request,
            PostSubmitResponse,
        )

    async def post_submit_jito_bundle(
        self, *, transactions: List["TransactionMessageJito"] = []
    ) -> PostSubmitJitoBundleResponse:
        request = PostSubmitJitoBundleRequest()
        if transactions is not None:
            request.transactions = transactions

        return await self._unary_unary(
            "/api.Api/PostSubmitJitoBundle",
            request,
            PostSubmitJitoBundleResponse,
        )

    async def post_submit_batch_v2(
        self,
        *,
        entries: List["PostSubmitRequestEntry"] = [],
        submit_strategy: "SubmitStrategy" = 0,
    ) -> PostSubmitBatchResponse:
        request = PostSubmitBatchRequest()
        if entries is not None:
            request.entries = entries
        request.submit_strategy = submit_strategy

        return await self._unary_unary(
            "/api.Api/PostSubmitBatchV2",
            request,
            PostSubmitBatchResponse,
        )

    async def get_raydium_pools(
        self, *, pair_or_address: str = ""
    ) -> GetRaydiumPoolsResponse:
        """Raydium V2"""

        request = GetRaydiumPoolsRequest()
        request.pair_or_address = pair_or_address

        return await self._unary_unary(
            "/api.Api/GetRaydiumPools",
            request,
            GetRaydiumPoolsResponse,
        )

    async def get_raydium_quotes(
        self,
        *,
        in_token: str = "",
        out_token: str = "",
        in_amount: float = 0,
        slippage: float = 0,
    ) -> GetRaydiumQuotesResponse:
        request = GetRaydiumQuotesRequest()
        request.in_token = in_token
        request.out_token = out_token
        request.in_amount = in_amount
        request.slippage = slippage

        return await self._unary_unary(
            "/api.Api/GetRaydiumQuotes",
            request,
            GetRaydiumQuotesResponse,
        )

    async def get_raydium_prices(
        self, *, tokens: List[str] = []
    ) -> GetRaydiumPricesResponse:
        request = GetRaydiumPricesRequest()
        request.tokens = tokens

        return await self._unary_unary(
            "/api.Api/GetRaydiumPrices",
            request,
            GetRaydiumPricesResponse,
        )

    async def post_raydium_swap(
        self,
        *,
        owner_address: str = "",
        in_token: str = "",
        out_token: str = "",
        in_amount: float = 0,
        slippage: float = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> PostRaydiumSwapResponse:
        request = PostRaydiumSwapRequest()
        request.owner_address = owner_address
        request.in_token = in_token
        request.out_token = out_token
        request.in_amount = in_amount
        request.slippage = slippage
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostRaydiumSwap",
            request,
            PostRaydiumSwapResponse,
        )

    async def post_raydium_route_swap(
        self,
        *,
        owner_address: str = "",
        steps: List["RaydiumRouteStep"] = [],
        slippage: float = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> PostRaydiumRouteSwapResponse:
        request = PostRaydiumRouteSwapRequest()
        request.owner_address = owner_address
        if steps is not None:
            request.steps = steps
        request.slippage = slippage
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostRaydiumRouteSwap",
            request,
            PostRaydiumRouteSwapResponse,
        )

    async def get_jupiter_quotes(
        self,
        *,
        in_token: str = "",
        out_token: str = "",
        in_amount: float = 0,
        slippage: float = 0,
        limit: int = 0,
    ) -> GetJupiterQuotesResponse:
        """Jupiter V2"""

        request = GetJupiterQuotesRequest()
        request.in_token = in_token
        request.out_token = out_token
        request.in_amount = in_amount
        request.slippage = slippage
        request.limit = limit

        return await self._unary_unary(
            "/api.Api/GetJupiterQuotes",
            request,
            GetJupiterQuotesResponse,
        )

    async def get_jupiter_prices(
        self, *, tokens: List[str] = []
    ) -> GetJupiterPricesResponse:
        request = GetJupiterPricesRequest()
        request.tokens = tokens

        return await self._unary_unary(
            "/api.Api/GetJupiterPrices",
            request,
            GetJupiterPricesResponse,
        )

    async def post_jupiter_swap(
        self,
        *,
        owner_address: str = "",
        in_token: str = "",
        out_token: str = "",
        in_amount: float = 0,
        slippage: float = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> PostJupiterSwapResponse:
        request = PostJupiterSwapRequest()
        request.owner_address = owner_address
        request.in_token = in_token
        request.out_token = out_token
        request.in_amount = in_amount
        request.slippage = slippage
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostJupiterSwap",
            request,
            PostJupiterSwapResponse,
        )

    async def post_jupiter_route_swap(
        self,
        *,
        owner_address: str = "",
        steps: List["JupiterRouteStep"] = [],
        slippage: float = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> PostJupiterRouteSwapResponse:
        request = PostJupiterRouteSwapRequest()
        request.owner_address = owner_address
        if steps is not None:
            request.steps = steps
        request.slippage = slippage
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostJupiterRouteSwap",
            request,
            PostJupiterRouteSwapResponse,
        )

    async def post_close_drift_perp_positions(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        contracts: List[str] = [],
    ) -> PostCloseDriftPerpPositionsResponse:
        """Drift V2"""

        request = PostCloseDriftPerpPositionsRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.contracts = contracts

        return await self._unary_unary(
            "/api.Api/PostCloseDriftPerpPositions",
            request,
            PostCloseDriftPerpPositionsResponse,
        )

    async def get_drift_perp_orderbook(
        self, *, contract: str = "", limit: int = 0
    ) -> GetDriftPerpOrderbookResponse:
        request = GetDriftPerpOrderbookRequest()
        request.contract = contract
        request.limit = limit

        return await self._unary_unary(
            "/api.Api/GetDriftPerpOrderbook",
            request,
            GetDriftPerpOrderbookResponse,
        )

    async def post_create_drift_user(
        self,
        *,
        owner_address: str = "",
        action: str = "",
        sub_account_i_d: int = 0,
        account_name: str = "",
    ) -> PostCreateDriftUserResponse:
        request = PostCreateDriftUserRequest()
        request.owner_address = owner_address
        request.action = action
        request.sub_account_i_d = sub_account_i_d
        request.account_name = account_name

        return await self._unary_unary(
            "/api.Api/PostCreateDriftUser",
            request,
            PostCreateDriftUserResponse,
        )

    async def get_drift_user(
        self, *, owner_address: str = "", account_address: str = ""
    ) -> GetDriftUserResponse:
        request = GetDriftUserRequest()
        request.owner_address = owner_address
        request.account_address = account_address

        return await self._unary_unary(
            "/api.Api/GetDriftUser",
            request,
            GetDriftUserResponse,
        )

    async def post_drift_manage_collateral(
        self,
        *,
        account_address: str = "",
        amount: float = 0,
        type: str = "",
        token: str = "",
        to_account_address: str = "",
    ) -> PostDriftManageCollateralResponse:
        request = PostDriftManageCollateralRequest()
        request.account_address = account_address
        request.amount = amount
        request.type = type
        request.token = token
        request.to_account_address = to_account_address

        return await self._unary_unary(
            "/api.Api/PostDriftManageCollateral",
            request,
            PostDriftManageCollateralResponse,
        )

    async def post_drift_perp_order(
        self,
        *,
        owner_address: str = "",
        contract: str = "",
        account_address: str = "",
        position_side: str = "",
        slippage: float = 0,
        type: str = "",
        amount: float = 0,
        price: float = 0,
        client_order_i_d: int = 0,
        post_only: str = "",
    ) -> PostDriftPerpOrderResponse:
        request = PostDriftPerpOrderRequest()
        request.owner_address = owner_address
        request.contract = contract
        request.account_address = account_address
        request.position_side = position_side
        request.slippage = slippage
        request.type = type
        request.amount = amount
        request.price = price
        request.client_order_i_d = client_order_i_d
        request.post_only = post_only

        return await self._unary_unary(
            "/api.Api/PostDriftPerpOrder",
            request,
            PostDriftPerpOrderResponse,
        )

    async def post_drift_settle_p_n_l(
        self,
        *,
        owner_address: str = "",
        settlee_account_address: str = "",
        contract: str = "",
    ) -> PostDriftSettlePNLResponse:
        request = PostDriftSettlePNLRequest()
        request.owner_address = owner_address
        request.settlee_account_address = settlee_account_address
        request.contract = contract

        return await self._unary_unary(
            "/api.Api/PostDriftSettlePNL",
            request,
            PostDriftSettlePNLResponse,
        )

    async def post_drift_settle_p_n_ls(
        self,
        *,
        owner_address: str = "",
        settlee_account_addresses: List[str] = [],
        contract: str = "",
    ) -> PostDriftSettlePNLsResponse:
        request = PostDriftSettlePNLsRequest()
        request.owner_address = owner_address
        request.settlee_account_addresses = settlee_account_addresses
        request.contract = contract

        return await self._unary_unary(
            "/api.Api/PostDriftSettlePNLs",
            request,
            PostDriftSettlePNLsResponse,
        )

    async def get_drift_assets(
        self, *, owner_address: str = "", account_address: str = ""
    ) -> GetDriftAssetsResponse:
        request = GetDriftAssetsRequest()
        request.owner_address = owner_address
        request.account_address = account_address

        return await self._unary_unary(
            "/api.Api/GetDriftAssets",
            request,
            GetDriftAssetsResponse,
        )

    async def get_drift_perp_contracts(self) -> GetDriftPerpContractsResponse:
        request = GetDriftPerpContractsRequest()

        return await self._unary_unary(
            "/api.Api/GetDriftPerpContracts",
            request,
            GetDriftPerpContractsResponse,
        )

    async def post_liquidate_drift_perp(
        self,
        *,
        owner_address: str = "",
        settlee_account_address: str = "",
        contract: str = "",
        amount: float = 0,
    ) -> PostLiquidateDriftPerpResponse:
        request = PostLiquidateDriftPerpRequest()
        request.owner_address = owner_address
        request.settlee_account_address = settlee_account_address
        request.contract = contract
        request.amount = amount

        return await self._unary_unary(
            "/api.Api/PostLiquidateDriftPerp",
            request,
            PostLiquidateDriftPerpResponse,
        )

    async def get_drift_open_perp_order(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        order_i_d: int = 0,
        client_order_i_d: int = 0,
    ) -> GetDriftOpenPerpOrderResponse:
        request = GetDriftOpenPerpOrderRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.order_i_d = order_i_d
        request.client_order_i_d = client_order_i_d

        return await self._unary_unary(
            "/api.Api/GetDriftOpenPerpOrder",
            request,
            GetDriftOpenPerpOrderResponse,
        )

    async def get_drift_open_margin_order(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        order_i_d: int = 0,
        client_order_i_d: int = 0,
    ) -> GetDriftOpenMarginOrderResponse:
        request = GetDriftOpenMarginOrderRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.order_i_d = order_i_d
        request.client_order_i_d = client_order_i_d

        return await self._unary_unary(
            "/api.Api/GetDriftOpenMarginOrder",
            request,
            GetDriftOpenMarginOrderResponse,
        )

    async def get_drift_perp_positions(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        contracts: List[str] = [],
    ) -> GetDriftPerpPositionsResponse:
        request = GetDriftPerpPositionsRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.contracts = contracts

        return await self._unary_unary(
            "/api.Api/GetDriftPerpPositions",
            request,
            GetDriftPerpPositionsResponse,
        )

    async def get_drift_open_perp_orders(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        contracts: List[str] = [],
    ) -> GetDriftOpenPerpOrdersResponse:
        request = GetDriftOpenPerpOrdersRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.contracts = contracts

        return await self._unary_unary(
            "/api.Api/GetDriftOpenPerpOrders",
            request,
            GetDriftOpenPerpOrdersResponse,
        )

    async def post_drift_cancel_perp_order(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        contract: str = "",
        client_order_i_d: int = 0,
        order_i_d: int = 0,
    ) -> PostDriftCancelPerpOrderResponse:
        request = PostDriftCancelPerpOrderRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.contract = contract
        request.client_order_i_d = client_order_i_d
        request.order_i_d = order_i_d

        return await self._unary_unary(
            "/api.Api/PostDriftCancelPerpOrder",
            request,
            PostDriftCancelPerpOrderResponse,
        )

    async def post_modify_drift_order(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        order_i_d: int = 0,
        new_position_side: str = "",
        post_only: str = "",
        new_base_amount: float = 0,
        new_limit_price: float = 0,
    ) -> PostModifyDriftOrderResponse:
        request = PostModifyDriftOrderRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.order_i_d = order_i_d
        request.new_position_side = new_position_side
        request.post_only = post_only
        request.new_base_amount = new_base_amount
        request.new_limit_price = new_limit_price

        return await self._unary_unary(
            "/api.Api/PostModifyDriftOrder",
            request,
            PostModifyDriftOrderResponse,
        )

    async def post_cancel_drift_margin_order(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        client_order_i_d: int = 0,
        order_i_d: int = 0,
    ) -> PostCancelDriftMarginOrderResponse:
        request = PostCancelDriftMarginOrderRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.client_order_i_d = client_order_i_d
        request.order_i_d = order_i_d

        return await self._unary_unary(
            "/api.Api/PostCancelDriftMarginOrder",
            request,
            PostCancelDriftMarginOrderResponse,
        )

    async def get_drift_open_margin_orders(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        markets: List[str] = [],
    ) -> GetDriftOpenMarginOrdersResponse:
        request = GetDriftOpenMarginOrdersRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.markets = markets

        return await self._unary_unary(
            "/api.Api/GetDriftOpenMarginOrders",
            request,
            GetDriftOpenMarginOrdersResponse,
        )

    async def get_drift_markets(
        self, *, metadata: bool = False
    ) -> GetDriftMarketsResponse:
        request = GetDriftMarketsRequest()
        request.metadata = metadata

        return await self._unary_unary(
            "/api.Api/GetDriftMarkets",
            request,
            GetDriftMarketsResponse,
        )

    async def post_drift_margin_order(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        market: str = "",
        position_side: str = "",
        slippage: float = 0,
        type: str = "",
        amount: float = 0,
        price: float = 0,
        client_order_i_d: int = 0,
        post_only: str = "",
    ) -> PostDriftMarginOrderResponse:
        request = PostDriftMarginOrderRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.market = market
        request.position_side = position_side
        request.slippage = slippage
        request.type = type
        request.amount = amount
        request.price = price
        request.client_order_i_d = client_order_i_d
        request.post_only = post_only

        return await self._unary_unary(
            "/api.Api/PostDriftMarginOrder",
            request,
            PostDriftMarginOrderResponse,
        )

    async def post_drift_enable_margin_trading(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        enable_margin: bool = False,
    ) -> PostDriftEnableMarginTradingResponse:
        request = PostDriftEnableMarginTradingRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.enable_margin = enable_margin

        return await self._unary_unary(
            "/api.Api/PostDriftEnableMarginTrading",
            request,
            PostDriftEnableMarginTradingResponse,
        )

    async def get_drift_margin_orderbook(
        self, *, market: str = "", limit: int = 0, metadata: bool = False
    ) -> GetDriftMarginOrderbookResponse:
        request = GetDriftMarginOrderbookRequest()
        request.market = market
        request.limit = limit
        request.metadata = metadata

        return await self._unary_unary(
            "/api.Api/GetDriftMarginOrderbook",
            request,
            GetDriftMarginOrderbookResponse,
        )

    async def get_drift_market_depth(
        self, *, contract: str = "", limit: int = 0
    ) -> GetDriftMarketDepthResponse:
        request = GetDriftMarketDepthRequest()
        request.contract = contract
        request.limit = limit

        return await self._unary_unary(
            "/api.Api/GetDriftMarketDepth",
            request,
            GetDriftMarketDepthResponse,
        )

    async def get_drift_margin_orderbooks_stream(
        self, *, markets: List[str] = [], limit: int = 0, metadata: bool = False
    ) -> AsyncGenerator[GetDriftMarginOrderbooksStreamResponse, None]:
        request = GetDriftMarginOrderbooksRequest()
        request.markets = markets
        request.limit = limit
        request.metadata = metadata

        async for response in self._unary_stream(
            "/api.Api/GetDriftMarginOrderbooksStream",
            request,
            GetDriftMarginOrderbooksStreamResponse,
        ):
            yield response

    async def get_drift_market_depths_stream(
        self, *, contracts: List[str] = [], limit: int = 0
    ) -> AsyncGenerator[GetDriftMarketDepthStreamResponse, None]:
        request = GetDriftMarketDepthsStreamRequest()
        request.contracts = contracts
        request.limit = limit

        async for response in self._unary_stream(
            "/api.Api/GetDriftMarketDepthsStream",
            request,
            GetDriftMarketDepthStreamResponse,
        ):
            yield response

    async def get_markets_v2(self) -> GetMarketsResponseV2:
        request = GetMarketsRequestV2()

        return await self._unary_unary(
            "/api.Api/GetMarketsV2",
            request,
            GetMarketsResponseV2,
        )

    async def get_tickers_v2(self, *, market: str = "") -> GetTickersResponseV2:
        request = GetTickersRequestV2()
        request.market = market

        return await self._unary_unary(
            "/api.Api/GetTickersV2",
            request,
            GetTickersResponseV2,
        )

    async def get_orderbook_v2(
        self, *, market: str = "", limit: int = 0
    ) -> GetOrderbookResponseV2:
        request = GetOrderbookRequestV2()
        request.market = market
        request.limit = limit

        return await self._unary_unary(
            "/api.Api/GetOrderbookV2",
            request,
            GetOrderbookResponseV2,
        )

    async def get_market_depth_v2(
        self, *, market: str = "", limit: int = 0
    ) -> GetMarketDepthResponseV2:
        request = GetMarketDepthRequestV2()
        request.market = market
        request.limit = limit

        return await self._unary_unary(
            "/api.Api/GetMarketDepthV2",
            request,
            GetMarketDepthResponseV2,
        )

    async def post_order_v2(
        self,
        *,
        owner_address: str = "",
        payer_address: str = "",
        market: str = "",
        side: str = "",
        type: str = "",
        amount: float = 0,
        price: float = 0,
        open_orders_address: str = "",
        client_order_i_d: int = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> PostOrderResponse:
        request = PostOrderRequestV2()
        request.owner_address = owner_address
        request.payer_address = payer_address
        request.market = market
        request.side = side
        request.type = type
        request.amount = amount
        request.price = price
        request.open_orders_address = open_orders_address
        request.client_order_i_d = client_order_i_d
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostOrderV2",
            request,
            PostOrderResponse,
        )

    async def post_cancel_order_v2(
        self,
        *,
        order_i_d: str = "",
        side: str = "",
        market_address: str = "",
        owner_address: str = "",
        open_orders_address: str = "",
        client_order_i_d: int = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> PostCancelOrderResponseV2:
        request = PostCancelOrderRequestV2()
        request.order_i_d = order_i_d
        request.side = side
        request.market_address = market_address
        request.owner_address = owner_address
        request.open_orders_address = open_orders_address
        request.client_order_i_d = client_order_i_d
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostCancelOrderV2",
            request,
            PostCancelOrderResponseV2,
        )

    async def post_replace_order_v2(
        self,
        *,
        owner_address: str = "",
        payer_address: str = "",
        market: str = "",
        side: str = "",
        type: str = "",
        amount: float = 0,
        price: float = 0,
        open_orders_address: str = "",
        client_order_i_d: int = 0,
        order_i_d: str = "",
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> PostOrderResponse:
        request = PostReplaceOrderRequestV2()
        request.owner_address = owner_address
        request.payer_address = payer_address
        request.market = market
        request.side = side
        request.type = type
        request.amount = amount
        request.price = price
        request.open_orders_address = open_orders_address
        request.client_order_i_d = client_order_i_d
        request.order_i_d = order_i_d
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostReplaceOrderV2",
            request,
            PostOrderResponse,
        )

    async def post_settle_v2(
        self,
        *,
        owner_address: str = "",
        market: str = "",
        base_token_wallet: str = "",
        quote_token_wallet: str = "",
        open_orders_address: str = "",
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> PostSettleResponse:
        request = PostSettleRequestV2()
        request.owner_address = owner_address
        request.market = market
        request.base_token_wallet = base_token_wallet
        request.quote_token_wallet = quote_token_wallet
        request.open_orders_address = open_orders_address
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostSettleV2",
            request,
            PostSettleResponse,
        )

    async def get_open_orders_v2(
        self,
        *,
        market: str = "",
        limit: int = 0,
        address: str = "",
        open_orders_address: str = "",
        order_i_d: str = "",
        client_order_i_d: int = 0,
    ) -> GetOpenOrdersResponseV2:
        request = GetOpenOrdersRequestV2()
        request.market = market
        request.limit = limit
        request.address = address
        request.open_orders_address = open_orders_address
        request.order_i_d = order_i_d
        request.client_order_i_d = client_order_i_d

        return await self._unary_unary(
            "/api.Api/GetOpenOrdersV2",
            request,
            GetOpenOrdersResponseV2,
        )

    async def get_unsettled_v2(
        self, *, market: str = "", owner_address: str = ""
    ) -> GetUnsettledResponse:
        request = GetUnsettledRequestV2()
        request.market = market
        request.owner_address = owner_address

        return await self._unary_unary(
            "/api.Api/GetUnsettledV2",
            request,
            GetUnsettledResponse,
        )

    async def get_price(self, *, tokens: List[str] = []) -> GetPriceResponse:
        request = GetPriceRequest()
        request.tokens = tokens

        return await self._unary_unary(
            "/api.Api/GetPrice",
            request,
            GetPriceResponse,
        )

    async def get_markets(self) -> GetMarketsResponse:
        request = GetMarketsRequest()

        return await self._unary_unary(
            "/api.Api/GetMarkets",
            request,
            GetMarketsResponse,
        )

    async def get_pools(
        self, *, projects: List["Project"] = [], pair_or_address: str = ""
    ) -> GetPoolsResponse:
        request = GetPoolsRequest()
        request.projects = projects
        request.pair_or_address = pair_or_address

        return await self._unary_unary(
            "/api.Api/GetPools",
            request,
            GetPoolsResponse,
        )

    async def get_tickers(
        self, *, market: str = "", project: "Project" = 0
    ) -> GetTickersResponse:
        request = GetTickersRequest()
        request.market = market
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetTickers",
            request,
            GetTickersResponse,
        )

    async def get_kline(
        self,
        *,
        market: str = "",
        from_: Optional[datetime] = None,
        to: Optional[datetime] = None,
        resolution: str = "",
        limit: int = 0,
    ) -> GetKlineResponse:
        request = GetKlineRequest()
        request.market = market
        if from_ is not None:
            request.from_ = from_
        if to is not None:
            request.to = to
        request.resolution = resolution
        request.limit = limit

        return await self._unary_unary(
            "/api.Api/GetKline",
            request,
            GetKlineResponse,
        )

    async def get_orderbook(
        self, *, market: str = "", limit: int = 0, project: "Project" = 0
    ) -> GetOrderbookResponse:
        request = GetOrderbookRequest()
        request.market = market
        request.limit = limit
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetOrderbook",
            request,
            GetOrderbookResponse,
        )

    async def get_market_depth(
        self, *, market: str = "", limit: int = 0, project: "Project" = 0
    ) -> GetMarketDepthResponse:
        request = GetMarketDepthRequest()
        request.market = market
        request.limit = limit
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetMarketDepth",
            request,
            GetMarketDepthResponse,
        )

    async def get_trades(
        self, *, market: str = "", limit: int = 0, project: "Project" = 0
    ) -> GetTradesResponse:
        request = GetTradesRequest()
        request.market = market
        request.limit = limit
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetTrades",
            request,
            GetTradesResponse,
        )

    async def get_quotes(
        self,
        *,
        in_token: str = "",
        out_token: str = "",
        in_amount: float = 0,
        slippage: float = 0,
        limit: int = 0,
        projects: List["Project"] = [],
    ) -> GetQuotesResponse:
        request = GetQuotesRequest()
        request.in_token = in_token
        request.out_token = out_token
        request.in_amount = in_amount
        request.slippage = slippage
        request.limit = limit
        request.projects = projects

        return await self._unary_unary(
            "/api.Api/GetQuotes",
            request,
            GetQuotesResponse,
        )

    async def get_server_time(self) -> GetServerTimeResponse:
        """system API"""

        request = GetServerTimeRequest()

        return await self._unary_unary(
            "/api.Api/GetServerTime",
            request,
            GetServerTimeResponse,
        )

    async def get_recent_block_hash(self) -> GetRecentBlockHashResponse:
        request = GetRecentBlockHashRequest()

        return await self._unary_unary(
            "/api.Api/GetRecentBlockHash",
            request,
            GetRecentBlockHashResponse,
        )

    async def get_account_balance(
        self, *, owner_address: str = ""
    ) -> GetAccountBalanceResponse:
        """account endpoints"""

        request = GetAccountBalanceRequest()
        request.owner_address = owner_address

        return await self._unary_unary(
            "/api.Api/GetAccountBalance",
            request,
            GetAccountBalanceResponse,
        )

    async def get_token_accounts(
        self, *, owner_address: str = ""
    ) -> GetTokenAccountsResponse:
        request = GetTokenAccountsRequest()
        request.owner_address = owner_address

        return await self._unary_unary(
            "/api.Api/GetTokenAccounts",
            request,
            GetTokenAccountsResponse,
        )

    async def post_order(
        self,
        *,
        owner_address: str = "",
        payer_address: str = "",
        market: str = "",
        side: "Side" = 0,
        type: List[common.OrderType] = [],
        amount: float = 0,
        price: float = 0,
        open_orders_address: str = "",
        client_order_i_d: int = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
        project: "Project" = 0,
    ) -> PostOrderResponse:
        """trade endpoints"""

        request = PostOrderRequest()
        request.owner_address = owner_address
        request.payer_address = payer_address
        request.market = market
        request.side = side
        request.type = type
        request.amount = amount
        request.price = price
        request.open_orders_address = open_orders_address
        request.client_order_i_d = client_order_i_d
        request.compute_limit = compute_limit
        request.compute_price = compute_price
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostOrder",
            request,
            PostOrderResponse,
        )

    async def post_submit(
        self,
        *,
        transaction: Optional["TransactionMessage"] = None,
        skip_pre_flight: bool = False,
    ) -> PostSubmitResponse:
        request = PostSubmitRequest()
        if transaction is not None:
            request.transaction = transaction
        request.skip_pre_flight = skip_pre_flight

        return await self._unary_unary(
            "/api.Api/PostSubmit",
            request,
            PostSubmitResponse,
        )

    async def post_submit_batch(
        self,
        *,
        entries: List["PostSubmitRequestEntry"] = [],
        submit_strategy: "SubmitStrategy" = 0,
    ) -> PostSubmitBatchResponse:
        request = PostSubmitBatchRequest()
        if entries is not None:
            request.entries = entries
        request.submit_strategy = submit_strategy

        return await self._unary_unary(
            "/api.Api/PostSubmitBatch",
            request,
            PostSubmitBatchResponse,
        )

    async def post_cancel_order(
        self,
        *,
        order_i_d: str = "",
        side: "Side" = 0,
        market_address: str = "",
        owner_address: str = "",
        open_orders_address: str = "",
        compute_limit: int = 0,
        compute_price: int = 0,
        project: "Project" = 0,
    ) -> PostCancelOrderResponse:
        request = PostCancelOrderRequest()
        request.order_i_d = order_i_d
        request.side = side
        request.market_address = market_address
        request.owner_address = owner_address
        request.open_orders_address = open_orders_address
        request.compute_limit = compute_limit
        request.compute_price = compute_price
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostCancelOrder",
            request,
            PostCancelOrderResponse,
        )

    async def post_cancel_by_client_order_i_d(
        self,
        *,
        client_order_i_d: int = 0,
        market_address: str = "",
        owner_address: str = "",
        open_orders_address: str = "",
        compute_limit: int = 0,
        compute_price: int = 0,
        project: "Project" = 0,
    ) -> PostCancelOrderResponse:
        request = PostCancelByClientOrderIDRequest()
        request.client_order_i_d = client_order_i_d
        request.market_address = market_address
        request.owner_address = owner_address
        request.open_orders_address = open_orders_address
        request.compute_limit = compute_limit
        request.compute_price = compute_price
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostCancelByClientOrderID",
            request,
            PostCancelOrderResponse,
        )

    async def post_cancel_all(
        self,
        *,
        market: str = "",
        owner_address: str = "",
        open_orders_addresses: List[str] = [],
        compute_limit: int = 0,
        compute_price: int = 0,
        project: "Project" = 0,
    ) -> PostCancelAllResponse:
        request = PostCancelAllRequest()
        request.market = market
        request.owner_address = owner_address
        request.open_orders_addresses = open_orders_addresses
        request.compute_limit = compute_limit
        request.compute_price = compute_price
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostCancelAll",
            request,
            PostCancelAllResponse,
        )

    async def post_replace_by_client_order_i_d(
        self,
        *,
        owner_address: str = "",
        payer_address: str = "",
        market: str = "",
        side: "Side" = 0,
        type: List[common.OrderType] = [],
        amount: float = 0,
        price: float = 0,
        open_orders_address: str = "",
        client_order_i_d: int = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
        project: "Project" = 0,
    ) -> PostOrderResponse:
        request = PostOrderRequest()
        request.owner_address = owner_address
        request.payer_address = payer_address
        request.market = market
        request.side = side
        request.type = type
        request.amount = amount
        request.price = price
        request.open_orders_address = open_orders_address
        request.client_order_i_d = client_order_i_d
        request.compute_limit = compute_limit
        request.compute_price = compute_price
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostReplaceByClientOrderID",
            request,
            PostOrderResponse,
        )

    async def post_replace_order(
        self,
        *,
        owner_address: str = "",
        payer_address: str = "",
        market: str = "",
        side: "Side" = 0,
        type: List[common.OrderType] = [],
        amount: float = 0,
        price: float = 0,
        open_orders_address: str = "",
        client_order_i_d: int = 0,
        order_i_d: str = "",
        compute_limit: int = 0,
        compute_price: int = 0,
        project: "Project" = 0,
    ) -> PostOrderResponse:
        request = PostReplaceOrderRequest()
        request.owner_address = owner_address
        request.payer_address = payer_address
        request.market = market
        request.side = side
        request.type = type
        request.amount = amount
        request.price = price
        request.open_orders_address = open_orders_address
        request.client_order_i_d = client_order_i_d
        request.order_i_d = order_i_d
        request.compute_limit = compute_limit
        request.compute_price = compute_price
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostReplaceOrder",
            request,
            PostOrderResponse,
        )

    async def post_settle(
        self,
        *,
        owner_address: str = "",
        market: str = "",
        base_token_wallet: str = "",
        quote_token_wallet: str = "",
        open_orders_address: str = "",
        compute_limit: int = 0,
        compute_price: int = 0,
        project: "Project" = 0,
    ) -> PostSettleResponse:
        request = PostSettleRequest()
        request.owner_address = owner_address
        request.market = market
        request.base_token_wallet = base_token_wallet
        request.quote_token_wallet = quote_token_wallet
        request.open_orders_address = open_orders_address
        request.compute_limit = compute_limit
        request.compute_price = compute_price
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostSettle",
            request,
            PostSettleResponse,
        )

    async def post_trade_swap(
        self,
        *,
        project: "Project" = 0,
        owner_address: str = "",
        in_token: str = "",
        out_token: str = "",
        in_amount: float = 0,
        slippage: float = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> TradeSwapResponse:
        request = TradeSwapRequest()
        request.project = project
        request.owner_address = owner_address
        request.in_token = in_token
        request.out_token = out_token
        request.in_amount = in_amount
        request.slippage = slippage
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostTradeSwap",
            request,
            TradeSwapResponse,
        )

    async def get_orders(
        self,
        *,
        market: str = "",
        status: "OrderStatus" = 0,
        side: "Side" = 0,
        types: List[common.OrderType] = [],
        from_: Optional[datetime] = None,
        limit: int = 0,
        direction: "Direction" = 0,
        address: str = "",
        open_orders_address: str = "",
        project: "Project" = 0,
    ) -> GetOrdersResponse:
        request = GetOrdersRequest()
        request.market = market
        request.status = status
        request.side = side
        request.types = types
        if from_ is not None:
            request.from_ = from_
        request.limit = limit
        request.direction = direction
        request.address = address
        request.open_orders_address = open_orders_address
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetOrders",
            request,
            GetOrdersResponse,
        )

    async def get_open_orders(
        self,
        *,
        market: str = "",
        limit: int = 0,
        address: str = "",
        open_orders_address: str = "",
        project: "Project" = 0,
    ) -> GetOpenOrdersResponse:
        request = GetOpenOrdersRequest()
        request.market = market
        request.limit = limit
        request.address = address
        request.open_orders_address = open_orders_address
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetOpenOrders",
            request,
            GetOpenOrdersResponse,
        )

    async def get_order_by_i_d(
        self, *, order_i_d: str = "", market: str = "", project: "Project" = 0
    ) -> GetOrderByIDResponse:
        request = GetOrderByIDRequest()
        request.order_i_d = order_i_d
        request.market = market
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetOrderByID",
            request,
            GetOrderByIDResponse,
        )

    async def get_unsettled(
        self, *, market: str = "", owner_address: str = "", project: "Project" = 0
    ) -> GetUnsettledResponse:
        request = GetUnsettledRequest()
        request.market = market
        request.owner_address = owner_address
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetUnsettled",
            request,
            GetUnsettledResponse,
        )

    async def post_route_trade_swap(
        self,
        *,
        project: "Project" = 0,
        owner_address: str = "",
        steps: List["RouteStep"] = [],
        slippage: float = 0,
        compute_limit: int = 0,
        compute_price: int = 0,
    ) -> TradeSwapResponse:
        request = RouteTradeSwapRequest()
        request.project = project
        request.owner_address = owner_address
        if steps is not None:
            request.steps = steps
        request.slippage = slippage
        request.compute_limit = compute_limit
        request.compute_price = compute_price

        return await self._unary_unary(
            "/api.Api/PostRouteTradeSwap",
            request,
            TradeSwapResponse,
        )

    async def post_perp_order(
        self,
        *,
        project: "Project" = 0,
        owner_address: str = "",
        contract: common.PerpContract = 0,
        account_address: str = "",
        position_side: common.PerpPositionSide = 0,
        slippage: float = 0,
        type: common.PerpOrderType = 0,
        amount: float = 0,
        price: float = 0,
        client_order_i_d: int = 0,
        post_only: common.PostOnlyParams = 0,
    ) -> PostPerpOrderResponse:
        """perp endpoints migrated to v2"""

        request = PostPerpOrderRequest()
        request.project = project
        request.owner_address = owner_address
        request.contract = contract
        request.account_address = account_address
        request.position_side = position_side
        request.slippage = slippage
        request.type = type
        request.amount = amount
        request.price = price
        request.client_order_i_d = client_order_i_d
        request.post_only = post_only

        return await self._unary_unary(
            "/api.Api/PostPerpOrder",
            request,
            PostPerpOrderResponse,
        )

    async def get_perp_positions(
        self,
        *,
        project: "Project" = 0,
        owner_address: str = "",
        account_address: str = "",
        contracts: List[common.PerpContract] = [],
    ) -> GetPerpPositionsResponse:
        """migrated to v2"""

        request = GetPerpPositionsRequest()
        request.project = project
        request.owner_address = owner_address
        request.account_address = account_address
        request.contracts = contracts

        return await self._unary_unary(
            "/api.Api/GetPerpPositions",
            request,
            GetPerpPositionsResponse,
        )

    async def get_open_perp_orders(
        self,
        *,
        project: "Project" = 0,
        owner_address: str = "",
        account_address: str = "",
        contracts: List[common.PerpContract] = [],
    ) -> GetOpenPerpOrdersResponse:
        """migrated to v2"""

        request = GetOpenPerpOrdersRequest()
        request.project = project
        request.owner_address = owner_address
        request.account_address = account_address
        request.contracts = contracts

        return await self._unary_unary(
            "/api.Api/GetOpenPerpOrders",
            request,
            GetOpenPerpOrdersResponse,
        )

    async def post_cancel_perp_orders(
        self,
        *,
        owner_address: str = "",
        project: "Project" = 0,
        contract: common.PerpContract = 0,
        account_address: str = "",
    ) -> PostCancelPerpOrdersResponse:
        """migrated to v2"""

        request = PostCancelPerpOrdersRequest()
        request.owner_address = owner_address
        request.project = project
        request.contract = contract
        request.account_address = account_address

        return await self._unary_unary(
            "/api.Api/PostCancelPerpOrders",
            request,
            PostCancelPerpOrdersResponse,
        )

    async def post_cancel_perp_order(
        self,
        *,
        owner_address: str = "",
        project: "Project" = 0,
        contract: common.PerpContract = 0,
        client_order_i_d: int = 0,
        order_i_d: int = 0,
        account_address: str = "",
    ) -> PostCancelPerpOrderResponse:
        """migrated to v2"""

        request = PostCancelPerpOrderRequest()
        request.owner_address = owner_address
        request.project = project
        request.contract = contract
        request.client_order_i_d = client_order_i_d
        request.order_i_d = order_i_d
        request.account_address = account_address

        return await self._unary_unary(
            "/api.Api/PostCancelPerpOrder",
            request,
            PostCancelPerpOrderResponse,
        )

    async def post_close_perp_positions(
        self,
        *,
        project: "Project" = 0,
        owner_address: str = "",
        account_address: str = "",
        contracts: List[common.PerpContract] = [],
    ) -> PostClosePerpPositionsResponse:
        """migrated to v2"""

        request = PostClosePerpPositionsRequest()
        request.project = project
        request.owner_address = owner_address
        request.account_address = account_address
        request.contracts = contracts

        return await self._unary_unary(
            "/api.Api/PostClosePerpPositions",
            request,
            PostClosePerpPositionsResponse,
        )

    async def get_perp_orderbook(
        self,
        *,
        contract: common.PerpContract = 0,
        limit: int = 0,
        project: "Project" = 0,
    ) -> GetPerpOrderbookResponse:
        """migrated to v2"""

        request = GetPerpOrderbookRequest()
        request.contract = contract
        request.limit = limit
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetPerpOrderbook",
            request,
            GetPerpOrderbookResponse,
        )

    async def post_create_user(
        self,
        *,
        owner_address: str = "",
        project: "Project" = 0,
        action: str = "",
        sub_account_i_d: int = 0,
        account_name: str = "",
    ) -> PostCreateUserResponse:
        """migrated to v2"""

        request = PostCreateUserRequest()
        request.owner_address = owner_address
        request.project = project
        request.action = action
        request.sub_account_i_d = sub_account_i_d
        request.account_name = account_name

        return await self._unary_unary(
            "/api.Api/PostCreateUser",
            request,
            PostCreateUserResponse,
        )

    async def get_user(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        project: "Project" = 0,
    ) -> GetUserResponse:
        """migrated to v2"""

        request = GetUserRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetUser",
            request,
            GetUserResponse,
        )

    async def post_manage_collateral(
        self,
        *,
        account_address: str = "",
        amount: float = 0,
        project: "Project" = 0,
        type: common.PerpCollateralType = 0,
        token: common.PerpCollateralToken = 0,
        to_account_address: str = "",
    ) -> PostManageCollateralResponse:
        """migrated to v2"""

        request = PostManageCollateralRequest()
        request.account_address = account_address
        request.amount = amount
        request.project = project
        request.type = type
        request.token = token
        request.to_account_address = to_account_address

        return await self._unary_unary(
            "/api.Api/PostManageCollateral",
            request,
            PostManageCollateralResponse,
        )

    async def post_settle_p_n_l(
        self,
        *,
        owner_address: str = "",
        settlee_account_address: str = "",
        contract: common.PerpContract = 0,
        project: "Project" = 0,
    ) -> PostSettlePNLResponse:
        """migrated to v2"""

        request = PostSettlePNLRequest()
        request.owner_address = owner_address
        request.settlee_account_address = settlee_account_address
        request.contract = contract
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostSettlePNL",
            request,
            PostSettlePNLResponse,
        )

    async def post_settle_p_n_ls(
        self,
        *,
        owner_address: str = "",
        settlee_account_addresses: List[str] = [],
        contract: common.PerpContract = 0,
        project: "Project" = 0,
    ) -> PostSettlePNLsResponse:
        """migrated to v2"""

        request = PostSettlePNLsRequest()
        request.owner_address = owner_address
        request.settlee_account_addresses = settlee_account_addresses
        request.contract = contract
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostSettlePNLs",
            request,
            PostSettlePNLsResponse,
        )

    async def get_assets(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        project: "Project" = 0,
    ) -> GetAssetsResponse:
        """migrated to v2"""

        request = GetAssetsRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetAssets",
            request,
            GetAssetsResponse,
        )

    async def get_perp_contracts(
        self, *, project: "Project" = 0
    ) -> GetPerpContractsResponse:
        """migrated to v2"""

        request = GetPerpContractsRequest()
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetPerpContracts",
            request,
            GetPerpContractsResponse,
        )

    async def post_liquidate_perp(
        self,
        *,
        owner_address: str = "",
        settlee_account_address: str = "",
        contract: common.PerpContract = 0,
        amount: float = 0,
        project: "Project" = 0,
    ) -> PostLiquidatePerpResponse:
        """migrated to v2"""

        request = PostLiquidatePerpRequest()
        request.owner_address = owner_address
        request.settlee_account_address = settlee_account_address
        request.contract = contract
        request.amount = amount
        request.project = project

        return await self._unary_unary(
            "/api.Api/PostLiquidatePerp",
            request,
            PostLiquidatePerpResponse,
        )

    async def get_open_perp_order(
        self,
        *,
        owner_address: str = "",
        account_address: str = "",
        order_i_d: int = 0,
        client_order_i_d: int = 0,
        project: "Project" = 0,
    ) -> GetOpenPerpOrderResponse:
        """migrated to v2"""

        request = GetOpenPerpOrderRequest()
        request.owner_address = owner_address
        request.account_address = account_address
        request.order_i_d = order_i_d
        request.client_order_i_d = client_order_i_d
        request.project = project

        return await self._unary_unary(
            "/api.Api/GetOpenPerpOrder",
            request,
            GetOpenPerpOrderResponse,
        )

    async def get_orderbooks_stream(
        self, *, markets: List[str] = [], limit: int = 0, project: "Project" = 0
    ) -> AsyncGenerator[GetOrderbooksStreamResponse, None]:
        """streaming endpoints"""

        request = GetOrderbooksRequest()
        request.markets = markets
        request.limit = limit
        request.project = project

        async for response in self._unary_stream(
            "/api.Api/GetOrderbooksStream",
            request,
            GetOrderbooksStreamResponse,
        ):
            yield response

    async def get_market_depths_stream(
        self, *, markets: List[str] = [], limit: int = 0, project: "Project" = 0
    ) -> AsyncGenerator[GetMarketDepthsStreamResponse, None]:
        request = GetMarketDepthsRequest()
        request.markets = markets
        request.limit = limit
        request.project = project

        async for response in self._unary_stream(
            "/api.Api/GetMarketDepthsStream",
            request,
            GetMarketDepthsStreamResponse,
        ):
            yield response

    async def get_tickers_stream(
        self, *, market: str = "", project: "Project" = 0
    ) -> AsyncGenerator[GetTickersStreamResponse, None]:
        request = GetTickersRequest()
        request.market = market
        request.project = project

        async for response in self._unary_stream(
            "/api.Api/GetTickersStream",
            request,
            GetTickersStreamResponse,
        ):
            yield response

    async def get_trades_stream(
        self, *, market: str = "", limit: int = 0, project: "Project" = 0
    ) -> AsyncGenerator[GetTradesStreamResponse, None]:
        request = GetTradesRequest()
        request.market = market
        request.limit = limit
        request.project = project

        async for response in self._unary_stream(
            "/api.Api/GetTradesStream",
            request,
            GetTradesStreamResponse,
        ):
            yield response

    async def get_order_status_stream(
        self, *, market: str = "", owner_address: str = "", project: "Project" = 0
    ) -> AsyncGenerator[GetOrderStatusStreamResponse, None]:
        request = GetOrderStatusStreamRequest()
        request.market = market
        request.owner_address = owner_address
        request.project = project

        async for response in self._unary_stream(
            "/api.Api/GetOrderStatusStream",
            request,
            GetOrderStatusStreamResponse,
        ):
            yield response

    async def get_recent_block_hash_stream(
        self,
    ) -> AsyncGenerator[GetRecentBlockHashResponse, None]:
        request = GetRecentBlockHashRequest()

        async for response in self._unary_stream(
            "/api.Api/GetRecentBlockHashStream",
            request,
            GetRecentBlockHashResponse,
        ):
            yield response

    async def get_block_stream(self) -> AsyncGenerator[GetBlockStreamResponse, None]:
        request = GetBlockStreamRequest()

        async for response in self._unary_stream(
            "/api.Api/GetBlockStream",
            request,
            GetBlockStreamResponse,
        ):
            yield response

    async def get_quotes_stream(
        self, *, projects: List["Project"] = [], token_pairs: List["TokenPair"] = []
    ) -> AsyncGenerator[GetQuotesStreamResponse, None]:
        request = GetQuotesStreamRequest()
        request.projects = projects
        if token_pairs is not None:
            request.token_pairs = token_pairs

        async for response in self._unary_stream(
            "/api.Api/GetQuotesStream",
            request,
            GetQuotesStreamResponse,
        ):
            yield response

    async def get_pool_reserves_stream(
        self, *, projects: List["Project"] = [], pair_or_address: str = ""
    ) -> AsyncGenerator[GetPoolReservesStreamResponse, None]:
        request = GetPoolReservesStreamRequest()
        request.projects = projects
        request.pair_or_address = pair_or_address

        async for response in self._unary_stream(
            "/api.Api/GetPoolReservesStream",
            request,
            GetPoolReservesStreamResponse,
        ):
            yield response

    async def get_prices_stream(
        self, *, projects: List["Project"] = [], tokens: List[str] = []
    ) -> AsyncGenerator[GetPricesStreamResponse, None]:
        request = GetPricesStreamRequest()
        request.projects = projects
        request.tokens = tokens

        async for response in self._unary_stream(
            "/api.Api/GetPricesStream",
            request,
            GetPricesStreamResponse,
        ):
            yield response

    async def get_new_raydium_pools_stream(
        self,
    ) -> AsyncGenerator[GetNewRaydiumPoolsResponse, None]:
        request = GetNewRaydiumPoolsRequest()

        async for response in self._unary_stream(
            "/api.Api/GetNewRaydiumPoolsStream",
            request,
            GetNewRaydiumPoolsResponse,
        ):
            yield response

    async def get_swaps_stream(
        self,
        *,
        projects: List["Project"] = [],
        pools: List[str] = [],
        include_failed: bool = False,
    ) -> AsyncGenerator[GetSwapsStreamResponse, None]:
        request = GetSwapsStreamRequest()
        request.projects = projects
        request.pools = pools
        request.include_failed = include_failed

        async for response in self._unary_stream(
            "/api.Api/GetSwapsStream",
            request,
            GetSwapsStreamResponse,
        ):
            yield response

    async def get_perp_orderbooks_stream(
        self,
        *,
        contracts: List[common.PerpContract] = [],
        limit: int = 0,
        project: "Project" = 0,
    ) -> AsyncGenerator[GetPerpOrderbooksStreamResponse, None]:
        """Perp streaming endpoints"""

        request = GetPerpOrderbooksRequest()
        request.contracts = contracts
        request.limit = limit
        request.project = project

        async for response in self._unary_stream(
            "/api.Api/GetPerpOrderbooksStream",
            request,
            GetPerpOrderbooksStreamResponse,
        ):
            yield response

    async def get_perp_trades_stream(
        self, *, contracts: List[common.PerpContract] = [], project: "Project" = 0
    ) -> AsyncGenerator[GetPerpTradesStreamResponse, None]:
        request = GetPerpTradesStreamRequest()
        request.contracts = contracts
        request.project = project

        async for response in self._unary_stream(
            "/api.Api/GetPerpTradesStream",
            request,
            GetPerpTradesStreamResponse,
        ):
            yield response
