# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: portfolio.proto, redeemable.proto, market.proto, market-type.proto, market-group.proto, market-settled.proto, orders-cancelled.proto, side.proto, order.proto, trade.proto, order-created.proto, transfer.proto, request-failed.proto, out.proto, account.proto, redeem.proto, orders.proto, trades.proto, auction.proto, auction-settled.proto, market-positions.proto, server-message.proto, make-transfer.proto, create-market.proto, create-market-type.proto, delete-market-type.proto, create-market-group.proto, create-auction.proto, settle-market.proto, edit-market.proto, settle-auction.proto, edit-auction.proto, create-order.proto, buy-auction.proto, client-message.proto
# plugin: python-betterproto
from dataclasses import dataclass
from datetime import datetime
from typing import List

import betterproto


class MarketStatus(betterproto.Enum):
    MARKET_STATUS_OPEN = 0
    MARKET_STATUS_SEMI_PAUSED = 1
    MARKET_STATUS_PAUSED = 2


class Side(betterproto.Enum):
    UNKNOWN = 0
    BID = 1
    OFFER = 2


@dataclass
class Portfolio(betterproto.Message):
    account_id: int = betterproto.int64_field(1)
    total_balance: float = betterproto.double_field(2)
    available_balance: float = betterproto.double_field(3)
    market_exposures: List["PortfolioMarketExposure"] = betterproto.message_field(4)
    owner_credits: List["PortfolioOwnerCredit"] = betterproto.message_field(5)


@dataclass
class PortfolioMarketExposure(betterproto.Message):
    market_id: int = betterproto.int64_field(1)
    position: float = betterproto.double_field(2)
    total_bid_size: float = betterproto.double_field(3)
    total_offer_size: float = betterproto.double_field(4)
    total_bid_value: float = betterproto.double_field(5)
    total_offer_value: float = betterproto.double_field(6)


@dataclass
class PortfolioOwnerCredit(betterproto.Message):
    owner_id: int = betterproto.int64_field(1)
    credit: float = betterproto.double_field(2)


@dataclass
class Redeemable(betterproto.Message):
    constituent_id: int = betterproto.int64_field(1)
    multiplier: int = betterproto.sint64_field(2)


@dataclass
class Market(betterproto.Message):
    id: int = betterproto.int64_field(1)
    name: str = betterproto.string_field(2)
    description: str = betterproto.string_field(3)
    owner_id: int = betterproto.int64_field(10)
    transaction_id: int = betterproto.int64_field(12)
    transaction_timestamp: datetime = betterproto.message_field(13)
    min_settlement: float = betterproto.double_field(6)
    max_settlement: float = betterproto.double_field(7)
    redeemable_for: List["Redeemable"] = betterproto.message_field(4)
    redeem_fee: float = betterproto.double_field(11)
    visible_to: List[int] = betterproto.int64_field(14)
    pinned: bool = betterproto.bool_field(15)
    type_id: int = betterproto.int64_field(16)
    group_id: int = betterproto.int64_field(17)
    status: "MarketStatus" = betterproto.enum_field(18)
    open: "MarketOpen" = betterproto.message_field(8, group="market_state")
    closed: "MarketClosed" = betterproto.message_field(9, group="market_state")


@dataclass
class MarketOpen(betterproto.Message):
    pass


@dataclass
class MarketClosed(betterproto.Message):
    settle_price: float = betterproto.double_field(1)
    transaction_id: int = betterproto.int64_field(2)
    transaction_timestamp: datetime = betterproto.message_field(3)


@dataclass
class MarketType(betterproto.Message):
    id: int = betterproto.int64_field(1)
    name: str = betterproto.string_field(2)
    description: str = betterproto.string_field(3)
    public: bool = betterproto.bool_field(4)


@dataclass
class MarketGroup(betterproto.Message):
    id: int = betterproto.int64_field(1)
    name: str = betterproto.string_field(2)
    description: str = betterproto.string_field(3)
    type_id: int = betterproto.int64_field(4)


@dataclass
class MarketSettled(betterproto.Message):
    id: int = betterproto.int64_field(1)
    settle_price: float = betterproto.double_field(2)
    transaction_id: int = betterproto.int64_field(4)
    transaction_timestamp: datetime = betterproto.message_field(5)


@dataclass
class OrdersCancelled(betterproto.Message):
    order_ids: List[int] = betterproto.int64_field(1)
    market_id: int = betterproto.int64_field(2)
    transaction_id: int = betterproto.int64_field(4)
    transaction_timestamp: datetime = betterproto.message_field(5)


@dataclass
class Order(betterproto.Message):
    id: int = betterproto.int64_field(1)
    market_id: int = betterproto.int64_field(2)
    owner_id: int = betterproto.int64_field(9)
    transaction_id: int = betterproto.int64_field(4)
    transaction_timestamp: datetime = betterproto.message_field(10)
    price: float = betterproto.double_field(5)
    size: float = betterproto.double_field(6)
    side: "Side" = betterproto.enum_field(7)
    sizes: List["Size"] = betterproto.message_field(8)


@dataclass
class Size(betterproto.Message):
    transaction_id: int = betterproto.int64_field(1)
    transaction_timestamp: datetime = betterproto.message_field(3)
    size: float = betterproto.double_field(2)


@dataclass
class Trade(betterproto.Message):
    id: int = betterproto.int64_field(1)
    market_id: int = betterproto.int64_field(2)
    transaction_id: int = betterproto.int64_field(3)
    transaction_timestamp: datetime = betterproto.message_field(10)
    price: float = betterproto.double_field(4)
    size: float = betterproto.double_field(5)
    buyer_id: int = betterproto.int64_field(8)
    seller_id: int = betterproto.int64_field(9)
    buyer_is_taker: bool = betterproto.bool_field(11)


@dataclass
class OrderCreated(betterproto.Message):
    market_id: int = betterproto.int64_field(1)
    account_id: int = betterproto.int64_field(2)
    order: "Order" = betterproto.message_field(3, group="_order")
    fills: List["OrderCreatedOrderFill"] = betterproto.message_field(4)
    trades: List["Trade"] = betterproto.message_field(5)
    transaction_id: int = betterproto.int64_field(7)
    transaction_timestamp: datetime = betterproto.message_field(8)


@dataclass
class OrderCreatedOrderFill(betterproto.Message):
    id: int = betterproto.int64_field(1)
    market_id: int = betterproto.int64_field(2)
    owner_id: int = betterproto.int64_field(8)
    size_filled: float = betterproto.double_field(4)
    size_remaining: float = betterproto.double_field(5)
    price: float = betterproto.double_field(6)
    side: "Side" = betterproto.enum_field(7)


@dataclass
class Transfer(betterproto.Message):
    id: int = betterproto.int64_field(1)
    initiator_id: int = betterproto.int64_field(2)
    from_account_id: int = betterproto.int64_field(3)
    to_account_id: int = betterproto.int64_field(4)
    transaction_id: int = betterproto.int64_field(8)
    transaction_timestamp: datetime = betterproto.message_field(9)
    amount: float = betterproto.double_field(6)
    note: str = betterproto.string_field(7)


@dataclass
class RequestFailed(betterproto.Message):
    request_details: "RequestFailedRequestDetails" = betterproto.message_field(1)
    error_details: "RequestFailedErrorDetails" = betterproto.message_field(2)


@dataclass
class RequestFailedRequestDetails(betterproto.Message):
    kind: str = betterproto.string_field(1)


@dataclass
class RequestFailedErrorDetails(betterproto.Message):
    message: str = betterproto.string_field(1)


@dataclass
class Out(betterproto.Message):
    market_id: int = betterproto.int64_field(1, group="_market_id")
    side: "Side" = betterproto.enum_field(2, group="_side")


@dataclass
class Account(betterproto.Message):
    id: int = betterproto.int64_field(1)
    name: str = betterproto.string_field(2)
    is_user: bool = betterproto.bool_field(3)


@dataclass
class Redeem(betterproto.Message):
    fund_id: int = betterproto.int64_field(1)
    amount: float = betterproto.double_field(2)


@dataclass
class Redeemed(betterproto.Message):
    transaction_id: int = betterproto.int64_field(5)
    transaction_timestamp: datetime = betterproto.message_field(6)
    account_id: int = betterproto.int64_field(2)
    fund_id: int = betterproto.int64_field(3)
    amount: float = betterproto.double_field(4)


@dataclass
class Orders(betterproto.Message):
    market_id: int = betterproto.int64_field(1)
    orders: List["Order"] = betterproto.message_field(2)
    has_full_history: bool = betterproto.bool_field(3)


@dataclass
class Trades(betterproto.Message):
    market_id: int = betterproto.int64_field(1)
    trades: List["Trade"] = betterproto.message_field(2)
    has_full_history: bool = betterproto.bool_field(3)


@dataclass
class Auction(betterproto.Message):
    id: int = betterproto.int64_field(1)
    name: str = betterproto.string_field(2)
    description: str = betterproto.string_field(3)
    owner_id: int = betterproto.int64_field(4)
    transaction_id: int = betterproto.int64_field(5)
    transaction_timestamp: datetime = betterproto.message_field(6)
    open: "AuctionOpen" = betterproto.message_field(7, group="status")
    closed: "AuctionClosed" = betterproto.message_field(8, group="status")
    image_url: str = betterproto.string_field(9, group="_image_url")
    bin_price: float = betterproto.double_field(10, group="_bin_price")
    buyer_id: int = betterproto.int64_field(11)


@dataclass
class AuctionOpen(betterproto.Message):
    pass


@dataclass
class AuctionClosed(betterproto.Message):
    settle_price: float = betterproto.double_field(1)


@dataclass
class AuctionSettled(betterproto.Message):
    id: int = betterproto.int64_field(1)
    settle_price: float = betterproto.double_field(2)
    transaction_id: int = betterproto.int64_field(3)
    transaction_timestamp: datetime = betterproto.message_field(4)
    buyer_id: int = betterproto.int64_field(5)


@dataclass
class GetMarketPositions(betterproto.Message):
    market_id: int = betterproto.int64_field(1)


@dataclass
class MarketPositions(betterproto.Message):
    market_id: int = betterproto.int64_field(1)
    positions: List["ParticipantPosition"] = betterproto.message_field(2)


@dataclass
class ParticipantPosition(betterproto.Message):
    account_id: int = betterproto.int64_field(1)
    gross: float = betterproto.double_field(2)
    net: float = betterproto.double_field(3)
    avg_buy_price: float = betterproto.double_field(4, group="_avg_buy_price")
    avg_sell_price: float = betterproto.double_field(5, group="_avg_sell_price")


@dataclass
class ServerMessage(betterproto.Message):
    request_id: str = betterproto.string_field(19)
    portfolio_updated: "Portfolio" = betterproto.message_field(1, group="message")
    portfolios: "Portfolios" = betterproto.message_field(2, group="message")
    market: "Market" = betterproto.message_field(3, group="message")
    market_settled: "MarketSettled" = betterproto.message_field(4, group="message")
    order_created: "OrderCreated" = betterproto.message_field(5, group="message")
    orders_cancelled: "OrdersCancelled" = betterproto.message_field(6, group="message")
    transfers: "Transfers" = betterproto.message_field(7, group="message")
    transfer_created: "Transfer" = betterproto.message_field(8, group="message")
    out: "Out" = betterproto.message_field(9, group="message")
    authenticated: "Authenticated" = betterproto.message_field(10, group="message")
    request_failed: "RequestFailed" = betterproto.message_field(11, group="message")
    account_created: "Account" = betterproto.message_field(12, group="message")
    accounts: "Accounts" = betterproto.message_field(13, group="message")
    acting_as: "ActingAs" = betterproto.message_field(14, group="message")
    ownership_given: "OwnershipGiven" = betterproto.message_field(17, group="message")
    redeemed: "Redeemed" = betterproto.message_field(18, group="message")
    orders: "Orders" = betterproto.message_field(20, group="message")
    trades: "Trades" = betterproto.message_field(21, group="message")
    auction: "Auction" = betterproto.message_field(22, group="message")
    auction_settled: "AuctionSettled" = betterproto.message_field(23, group="message")
    auction_deleted: "AuctionDeleted" = betterproto.message_field(24, group="message")
    ownership_revoked: "OwnershipRevoked" = betterproto.message_field(
        25, group="message"
    )
    market_type: "MarketType" = betterproto.message_field(26, group="message")
    market_types: "MarketTypes" = betterproto.message_field(27, group="message")
    market_type_deleted: "MarketTypeDeleted" = betterproto.message_field(
        28, group="message"
    )
    market_group: "MarketGroup" = betterproto.message_field(29, group="message")
    market_groups: "MarketGroups" = betterproto.message_field(30, group="message")
    market_positions: "MarketPositions" = betterproto.message_field(31, group="message")
    sudo_status: "SudoStatus" = betterproto.message_field(32, group="message")


@dataclass
class MarketTypeDeleted(betterproto.Message):
    market_type_id: int = betterproto.int64_field(1)


@dataclass
class Authenticated(betterproto.Message):
    account_id: int = betterproto.int64_field(1)


@dataclass
class ActingAs(betterproto.Message):
    account_id: int = betterproto.int64_field(1)


@dataclass
class Portfolios(betterproto.Message):
    portfolios: List["Portfolio"] = betterproto.message_field(1)
    are_new_ownerships: bool = betterproto.bool_field(2)


@dataclass
class OwnershipGiven(betterproto.Message):
    pass


@dataclass
class Transfers(betterproto.Message):
    transfers: List["Transfer"] = betterproto.message_field(1)


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


@dataclass
class AuctionDeleted(betterproto.Message):
    auction_id: int = betterproto.int64_field(1)


@dataclass
class OwnershipRevoked(betterproto.Message):
    pass


@dataclass
class MarketTypes(betterproto.Message):
    market_types: List["MarketType"] = betterproto.message_field(1)


@dataclass
class MarketGroups(betterproto.Message):
    market_groups: List["MarketGroup"] = betterproto.message_field(1)


@dataclass
class SudoStatus(betterproto.Message):
    enabled: bool = betterproto.bool_field(1)


@dataclass
class MakeTransfer(betterproto.Message):
    from_account_id: int = betterproto.int64_field(1)
    to_account_id: int = betterproto.int64_field(2)
    amount: float = betterproto.double_field(3)
    note: str = betterproto.string_field(4)


@dataclass
class CreateMarket(betterproto.Message):
    name: str = betterproto.string_field(1)
    description: str = betterproto.string_field(2)
    min_settlement: float = betterproto.double_field(3)
    max_settlement: float = betterproto.double_field(4)
    redeemable_for: List["Redeemable"] = betterproto.message_field(5)
    redeem_fee: float = betterproto.double_field(6)
    hide_account_ids: bool = betterproto.bool_field(7)
    visible_to: List[int] = betterproto.int64_field(8)
    type_id: int = betterproto.int64_field(9)
    group_id: int = betterproto.int64_field(10)


@dataclass
class CreateMarketType(betterproto.Message):
    name: str = betterproto.string_field(1)
    description: str = betterproto.string_field(2)
    public: bool = betterproto.bool_field(3)


@dataclass
class DeleteMarketType(betterproto.Message):
    market_type_id: int = betterproto.int64_field(1)


@dataclass
class CreateMarketGroup(betterproto.Message):
    name: str = betterproto.string_field(1)
    description: str = betterproto.string_field(2)
    type_id: int = betterproto.int64_field(3)


@dataclass
class CreateAuction(betterproto.Message):
    name: str = betterproto.string_field(1)
    description: str = betterproto.string_field(2)
    image_filename: str = betterproto.string_field(3)
    bin_price: float = betterproto.double_field(4, group="_bin_price")


@dataclass
class SettleMarket(betterproto.Message):
    market_id: int = betterproto.int64_field(1)
    settle_price: float = betterproto.double_field(2)


@dataclass
class EditMarket(betterproto.Message):
    id: int = betterproto.int64_field(1)
    name: str = betterproto.string_field(2, group="_name")
    description: str = betterproto.string_field(3, group="_description")
    pinned: bool = betterproto.bool_field(4, group="_pinned")
    redeemable_settings: "RedeemableSettings" = betterproto.message_field(
        5, group="_redeemable_settings"
    )
    hide_account_ids: bool = betterproto.bool_field(6, group="_hide_account_ids")
    update_visible_to: bool = betterproto.bool_field(7, group="_update_visible_to")
    visible_to: List[int] = betterproto.int64_field(8)
    status: "MarketStatus" = betterproto.enum_field(9)


@dataclass
class RedeemableSettings(betterproto.Message):
    redeemable_for: List["Redeemable"] = betterproto.message_field(1)
    redeem_fee: float = betterproto.double_field(2)


@dataclass
class SettleAuction(betterproto.Message):
    auction_id: int = betterproto.int64_field(1)
    buyer_id: int = betterproto.int64_field(2)
    settle_price: float = betterproto.double_field(3)


@dataclass
class EditAuction(betterproto.Message):
    id: int = betterproto.int64_field(1)
    name: str = betterproto.string_field(2, group="_name")
    description: str = betterproto.string_field(3, group="_description")
    image_filename: str = betterproto.string_field(4, group="_image_filename")
    bin_price: float = betterproto.double_field(5, group="_bin_price")


@dataclass
class CreateOrder(betterproto.Message):
    market_id: int = betterproto.int64_field(2)
    price: float = betterproto.double_field(5)
    size: float = betterproto.double_field(6)
    side: "Side" = betterproto.enum_field(7)


@dataclass
class BuyAuction(betterproto.Message):
    auction_id: int = betterproto.int64_field(1)


@dataclass
class ClientMessage(betterproto.Message):
    request_id: str = betterproto.string_field(14)
    create_market: "CreateMarket" = betterproto.message_field(1, group="message")
    settle_market: "SettleMarket" = betterproto.message_field(2, group="message")
    create_order: "CreateOrder" = betterproto.message_field(3, group="message")
    cancel_order: "CancelOrder" = betterproto.message_field(4, group="message")
    out: "Out" = betterproto.message_field(5, group="message")
    make_transfer: "MakeTransfer" = betterproto.message_field(6, group="message")
    authenticate: "Authenticate" = betterproto.message_field(7, group="message")
    act_as: "ActAs" = betterproto.message_field(8, group="message")
    create_account: "CreateAccount" = betterproto.message_field(9, group="message")
    share_ownership: "ShareOwnership" = betterproto.message_field(10, group="message")
    get_full_order_history: "GetFullOrderHistory" = betterproto.message_field(
        11, group="message"
    )
    get_full_trade_history: "GetFullTradeHistory" = betterproto.message_field(
        12, group="message"
    )
    redeem: "Redeem" = betterproto.message_field(13, group="message")
    create_auction: "CreateAuction" = betterproto.message_field(15, group="message")
    settle_auction: "SettleAuction" = betterproto.message_field(16, group="message")
    delete_auction: "DeleteAuction" = betterproto.message_field(17, group="message")
    edit_market: "EditMarket" = betterproto.message_field(18, group="message")
    edit_auction: "EditAuction" = betterproto.message_field(25, group="message")
    revoke_ownership: "RevokeOwnership" = betterproto.message_field(19, group="message")
    buy_auction: "BuyAuction" = betterproto.message_field(20, group="message")
    create_market_type: "CreateMarketType" = betterproto.message_field(
        21, group="message"
    )
    delete_market_type: "DeleteMarketType" = betterproto.message_field(
        22, group="message"
    )
    create_market_group: "CreateMarketGroup" = betterproto.message_field(
        23, group="message"
    )
    get_market_positions: "GetMarketPositions" = betterproto.message_field(
        24, group="message"
    )
    set_sudo: "SetSudo" = betterproto.message_field(26, group="message")


@dataclass
class GetFullOrderHistory(betterproto.Message):
    market_id: int = betterproto.int64_field(1)


@dataclass
class GetFullTradeHistory(betterproto.Message):
    market_id: int = betterproto.int64_field(1)


@dataclass
class CancelOrder(betterproto.Message):
    id: int = betterproto.int64_field(1)


@dataclass
class Authenticate(betterproto.Message):
    jwt: str = betterproto.string_field(1)
    id_jwt: str = betterproto.string_field(2)
    act_as: int = betterproto.int64_field(4)


@dataclass
class ActAs(betterproto.Message):
    account_id: int = betterproto.int64_field(1)


@dataclass
class CreateAccount(betterproto.Message):
    owner_id: int = betterproto.int64_field(1)
    name: str = betterproto.string_field(2)


@dataclass
class ShareOwnership(betterproto.Message):
    of_account_id: int = betterproto.int64_field(1)
    to_account_id: int = betterproto.int64_field(2)


@dataclass
class RevokeOwnership(betterproto.Message):
    of_account_id: int = betterproto.int64_field(1)
    from_account_id: int = betterproto.int64_field(2)


@dataclass
class DeleteAuction(betterproto.Message):
    auction_id: int = betterproto.int64_field(1)


@dataclass
class SetSudo(betterproto.Message):
    enabled: bool = betterproto.bool_field(1)
