pyaver.enums
1from enum import IntEnum, Enum 2from typing import NamedTuple 3from solana.publickey import PublicKey 4 5class Side(IntEnum): 6 """ 7 Side of the orderbook to trade 8 """ 9 BUY = 0 10 SELL = 1 11 12class OrderType(IntEnum): 13 """ 14 Type of order 15 16 LIMIT = a Limit order, will attempt to fill against existing opposing orders and post any or all residual order to the orderbook 17 IOC ('Immediate-or-Cancel') = will fill as much as available against existing opposing orders. Any residual unmatched part of the order will not be posted to the orderbook 18 KILL_OR_FILL = The entire order will be aborted if it cannot be immediately matched with existing opposing orders 19 POST_ONLY = The entire order will be aborted if it would have resulted in some or all of the order being filled against existing opposing orders. 20 """ 21 22 LIMIT = 0 23 IOC = 1 24 KILL_OR_FILL = 2 25 POST_ONLY = 3 26 27 28class SelfTradeBehavior(IntEnum): 29 """ 30 Behavior when a user's trade is matched with themselves 31 32 DECREMENT_TAKE = Reduces the size of the new order 33 CANCEL_PROVIDE = Reduces the size of the existing (opposing) order 34 ABORT_TRANSACTION = Cancels the whole transaction if some or all of it would self-trade 35 """ 36 DECREMENT_TAKE = 0 37 CANCEL_PROVIDE = 1 38 ABORT_TRANSACTION = 2 39 40class MarketStatus(IntEnum): 41 """ 42 Status of a market 43 """ 44 UNINITIALIZED = 0 45 INITIALIZED = 1 46 ACTIVE_PRE_EVENT = 2 47 ACTIVE_IN_PLAY = 3 48 HALTED_PRE_EVENT = 4 49 HALTED_IN_PLAY = 5 50 TRADING_CEASED = 6 51 CEASED_CRANKED_CLOSED = 7 52 RESOLVED = 8 53 VOIDED = 9 54 55class TransactionType(IntEnum): 56 """ 57 Type of transaction 58 """ 59 INIT_MARKET = 0 60 CHANGE_MARKET_STATUS = 1 61 ATTEMPT_RESOLUTION = 2 62 SWEEP_FEES = 3 63 CLOSE_AOB = 4 64 CONSUME_EVENTS_CRANK = 5 65 MAKER_FILL = 6 66 OUT = 7 67 INIT_USER_MARKET = 8 68 DEPOSIT = 9 69 WITHDRAW = 10 70 PLACE_ORDER = 11 71 TAKER_FILL = 12 72 CANCEL_ORDER = 13 73 COLLECT = 14 74 CLOSE_USER_MARKET = 15 75 COLLECT_CLOSE_CRANK = 16 76 77class FeeTier(Enum): 78 """ 79 Level of fees paid 80 81 This is determined by the number of AVER tokens held 82 """ 83 BASE = 'base' 84 AVER1 = 'aver1' 85 AVER2 = 'aver2' 86 AVER3 = 'aver3' 87 AVER4 = 'aver4' 88 AVER5 = 'aver5' 89 FREE = 'free' 90 91class SizeFormat(IntEnum): 92 """ 93 Order size format 94 95 Payout is the total amount paid out if a bet is won (stake + profit). 96 Stake is the total amount at risk for a user (payout - profit). 97 """ 98 PAYOUT = 0 99 STAKE = 1 100 101class SolanaNetwork(str, Enum): 102 """ 103 Solana Network 104 105 Currently only DEVNET and MAINNET are available 106 """ 107 DEVNET = 'devnet' 108 MAINNET = 'mainnet-beta' 109 110class Fill(NamedTuple): 111 """ 112 A Fill event describes a matched trade between a maker and a taker, and contains all of the necessary information to facilitate update of the maker’s UserMarket account to reflect the trade. 113 """ 114 taker_side: Side 115 maker_order_id: int 116 quote_size: int 117 base_size: int 118 maker_user_market: PublicKey 119 taker_user_market: PublicKey 120 maker_fee_tier: int 121 taker_fee_tier: int 122 123class Out(NamedTuple): 124 """ 125 An Out event describes the removal of an order from the orderbook, and contains all of the necessary information to facilitate updating the order owner’s UserMarket account to reflect that this order (or residual part of an order) is no longer being offered. (i.e. unlocked positions previously locked to back the order) 126 """ 127 side: Side 128 order_id: int 129 base_size: int 130 delete: bool 131 user_market: PublicKey 132 fee_tier: int
Side of the orderbook to trade
Inherited Members
- enum.Enum
- name
- value
- builtins.int
- conjugate
- bit_length
- to_bytes
- from_bytes
- as_integer_ratio
- real
- imag
- numerator
- denominator
13class OrderType(IntEnum): 14 """ 15 Type of order 16 17 LIMIT = a Limit order, will attempt to fill against existing opposing orders and post any or all residual order to the orderbook 18 IOC ('Immediate-or-Cancel') = will fill as much as available against existing opposing orders. Any residual unmatched part of the order will not be posted to the orderbook 19 KILL_OR_FILL = The entire order will be aborted if it cannot be immediately matched with existing opposing orders 20 POST_ONLY = The entire order will be aborted if it would have resulted in some or all of the order being filled against existing opposing orders. 21 """ 22 23 LIMIT = 0 24 IOC = 1 25 KILL_OR_FILL = 2 26 POST_ONLY = 3
Type of order
LIMIT = a Limit order, will attempt to fill against existing opposing orders and post any or all residual order to the orderbook IOC ('Immediate-or-Cancel') = will fill as much as available against existing opposing orders. Any residual unmatched part of the order will not be posted to the orderbook KILL_OR_FILL = The entire order will be aborted if it cannot be immediately matched with existing opposing orders POST_ONLY = The entire order will be aborted if it would have resulted in some or all of the order being filled against existing opposing orders.
Inherited Members
- enum.Enum
- name
- value
- builtins.int
- conjugate
- bit_length
- to_bytes
- from_bytes
- as_integer_ratio
- real
- imag
- numerator
- denominator
29class SelfTradeBehavior(IntEnum): 30 """ 31 Behavior when a user's trade is matched with themselves 32 33 DECREMENT_TAKE = Reduces the size of the new order 34 CANCEL_PROVIDE = Reduces the size of the existing (opposing) order 35 ABORT_TRANSACTION = Cancels the whole transaction if some or all of it would self-trade 36 """ 37 DECREMENT_TAKE = 0 38 CANCEL_PROVIDE = 1 39 ABORT_TRANSACTION = 2
Behavior when a user's trade is matched with themselves
DECREMENT_TAKE = Reduces the size of the new order CANCEL_PROVIDE = Reduces the size of the existing (opposing) order ABORT_TRANSACTION = Cancels the whole transaction if some or all of it would self-trade
Inherited Members
- enum.Enum
- name
- value
- builtins.int
- conjugate
- bit_length
- to_bytes
- from_bytes
- as_integer_ratio
- real
- imag
- numerator
- denominator
41class MarketStatus(IntEnum): 42 """ 43 Status of a market 44 """ 45 UNINITIALIZED = 0 46 INITIALIZED = 1 47 ACTIVE_PRE_EVENT = 2 48 ACTIVE_IN_PLAY = 3 49 HALTED_PRE_EVENT = 4 50 HALTED_IN_PLAY = 5 51 TRADING_CEASED = 6 52 CEASED_CRANKED_CLOSED = 7 53 RESOLVED = 8 54 VOIDED = 9
Status of a market
Inherited Members
- enum.Enum
- name
- value
- builtins.int
- conjugate
- bit_length
- to_bytes
- from_bytes
- as_integer_ratio
- real
- imag
- numerator
- denominator
56class TransactionType(IntEnum): 57 """ 58 Type of transaction 59 """ 60 INIT_MARKET = 0 61 CHANGE_MARKET_STATUS = 1 62 ATTEMPT_RESOLUTION = 2 63 SWEEP_FEES = 3 64 CLOSE_AOB = 4 65 CONSUME_EVENTS_CRANK = 5 66 MAKER_FILL = 6 67 OUT = 7 68 INIT_USER_MARKET = 8 69 DEPOSIT = 9 70 WITHDRAW = 10 71 PLACE_ORDER = 11 72 TAKER_FILL = 12 73 CANCEL_ORDER = 13 74 COLLECT = 14 75 CLOSE_USER_MARKET = 15 76 COLLECT_CLOSE_CRANK = 16
Type of transaction
Inherited Members
- enum.Enum
- name
- value
- builtins.int
- conjugate
- bit_length
- to_bytes
- from_bytes
- as_integer_ratio
- real
- imag
- numerator
- denominator
78class FeeTier(Enum): 79 """ 80 Level of fees paid 81 82 This is determined by the number of AVER tokens held 83 """ 84 BASE = 'base' 85 AVER1 = 'aver1' 86 AVER2 = 'aver2' 87 AVER3 = 'aver3' 88 AVER4 = 'aver4' 89 AVER5 = 'aver5' 90 FREE = 'free'
Level of fees paid
This is determined by the number of AVER tokens held
Inherited Members
- enum.Enum
- name
- value
92class SizeFormat(IntEnum): 93 """ 94 Order size format 95 96 Payout is the total amount paid out if a bet is won (stake + profit). 97 Stake is the total amount at risk for a user (payout - profit). 98 """ 99 PAYOUT = 0 100 STAKE = 1
Order size format
Payout is the total amount paid out if a bet is won (stake + profit). Stake is the total amount at risk for a user (payout - profit).
Inherited Members
- enum.Enum
- name
- value
- builtins.int
- conjugate
- bit_length
- to_bytes
- from_bytes
- as_integer_ratio
- real
- imag
- numerator
- denominator
102class SolanaNetwork(str, Enum): 103 """ 104 Solana Network 105 106 Currently only DEVNET and MAINNET are available 107 """ 108 DEVNET = 'devnet' 109 MAINNET = 'mainnet-beta'
Solana Network
Currently only DEVNET and MAINNET are available
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
111class Fill(NamedTuple): 112 """ 113 A Fill event describes a matched trade between a maker and a taker, and contains all of the necessary information to facilitate update of the maker’s UserMarket account to reflect the trade. 114 """ 115 taker_side: Side 116 maker_order_id: int 117 quote_size: int 118 base_size: int 119 maker_user_market: PublicKey 120 taker_user_market: PublicKey 121 maker_fee_tier: int 122 taker_fee_tier: int
A Fill event describes a matched trade between a maker and a taker, and contains all of the necessary information to facilitate update of the maker’s UserMarket account to reflect the trade.
Create new instance of Fill(taker_side, maker_order_id, quote_size, base_size, maker_user_market, taker_user_market, maker_fee_tier, taker_fee_tier)
Inherited Members
- builtins.tuple
- index
- count
124class Out(NamedTuple): 125 """ 126 An Out event describes the removal of an order from the orderbook, and contains all of the necessary information to facilitate updating the order owner’s UserMarket account to reflect that this order (or residual part of an order) is no longer being offered. (i.e. unlocked positions previously locked to back the order) 127 """ 128 side: Side 129 order_id: int 130 base_size: int 131 delete: bool 132 user_market: PublicKey 133 fee_tier: int
An Out event describes the removal of an order from the orderbook, and contains all of the necessary information to facilitate updating the order owner’s UserMarket account to reflect that this order (or residual part of an order) is no longer being offered. (i.e. unlocked positions previously locked to back the order)
Create new instance of Out(side, order_id, base_size, delete, user_market, fee_tier)
Inherited Members
- builtins.tuple
- index
- count