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
class Side(enum.IntEnum):
 6class Side(IntEnum):
 7    """
 8    Side of the orderbook to trade
 9    """
10    BUY = 0
11    SELL = 1

Side of the orderbook to trade

BUY = <Side.BUY: 0>
SELL = <Side.SELL: 1>
Inherited Members
enum.Enum
name
value
builtins.int
conjugate
bit_length
to_bytes
from_bytes
as_integer_ratio
real
imag
numerator
denominator
class OrderType(enum.IntEnum):
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.

LIMIT = <OrderType.LIMIT: 0>
IOC = <OrderType.IOC: 1>
KILL_OR_FILL = <OrderType.KILL_OR_FILL: 2>
POST_ONLY = <OrderType.POST_ONLY: 3>
Inherited Members
enum.Enum
name
value
builtins.int
conjugate
bit_length
to_bytes
from_bytes
as_integer_ratio
real
imag
numerator
denominator
class SelfTradeBehavior(enum.IntEnum):
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

DECREMENT_TAKE = <SelfTradeBehavior.DECREMENT_TAKE: 0>
CANCEL_PROVIDE = <SelfTradeBehavior.CANCEL_PROVIDE: 1>
ABORT_TRANSACTION = <SelfTradeBehavior.ABORT_TRANSACTION: 2>
Inherited Members
enum.Enum
name
value
builtins.int
conjugate
bit_length
to_bytes
from_bytes
as_integer_ratio
real
imag
numerator
denominator
class MarketStatus(enum.IntEnum):
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

UNINITIALIZED = <MarketStatus.UNINITIALIZED: 0>
INITIALIZED = <MarketStatus.INITIALIZED: 1>
ACTIVE_PRE_EVENT = <MarketStatus.ACTIVE_PRE_EVENT: 2>
ACTIVE_IN_PLAY = <MarketStatus.ACTIVE_IN_PLAY: 3>
HALTED_PRE_EVENT = <MarketStatus.HALTED_PRE_EVENT: 4>
HALTED_IN_PLAY = <MarketStatus.HALTED_IN_PLAY: 5>
TRADING_CEASED = <MarketStatus.TRADING_CEASED: 6>
CEASED_CRANKED_CLOSED = <MarketStatus.CEASED_CRANKED_CLOSED: 7>
RESOLVED = <MarketStatus.RESOLVED: 8>
VOIDED = <MarketStatus.VOIDED: 9>
Inherited Members
enum.Enum
name
value
builtins.int
conjugate
bit_length
to_bytes
from_bytes
as_integer_ratio
real
imag
numerator
denominator
class TransactionType(enum.IntEnum):
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

INIT_MARKET = <TransactionType.INIT_MARKET: 0>
CHANGE_MARKET_STATUS = <TransactionType.CHANGE_MARKET_STATUS: 1>
ATTEMPT_RESOLUTION = <TransactionType.ATTEMPT_RESOLUTION: 2>
SWEEP_FEES = <TransactionType.SWEEP_FEES: 3>
CLOSE_AOB = <TransactionType.CLOSE_AOB: 4>
CONSUME_EVENTS_CRANK = <TransactionType.CONSUME_EVENTS_CRANK: 5>
MAKER_FILL = <TransactionType.MAKER_FILL: 6>
OUT = <TransactionType.OUT: 7>
INIT_USER_MARKET = <TransactionType.INIT_USER_MARKET: 8>
DEPOSIT = <TransactionType.DEPOSIT: 9>
WITHDRAW = <TransactionType.WITHDRAW: 10>
PLACE_ORDER = <TransactionType.PLACE_ORDER: 11>
TAKER_FILL = <TransactionType.TAKER_FILL: 12>
CANCEL_ORDER = <TransactionType.CANCEL_ORDER: 13>
COLLECT = <TransactionType.COLLECT: 14>
CLOSE_USER_MARKET = <TransactionType.CLOSE_USER_MARKET: 15>
COLLECT_CLOSE_CRANK = <TransactionType.COLLECT_CLOSE_CRANK: 16>
Inherited Members
enum.Enum
name
value
builtins.int
conjugate
bit_length
to_bytes
from_bytes
as_integer_ratio
real
imag
numerator
denominator
class FeeTier(enum.Enum):
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

BASE = <FeeTier.BASE: 'base'>
AVER1 = <FeeTier.AVER1: 'aver1'>
AVER2 = <FeeTier.AVER2: 'aver2'>
AVER3 = <FeeTier.AVER3: 'aver3'>
AVER4 = <FeeTier.AVER4: 'aver4'>
AVER5 = <FeeTier.AVER5: 'aver5'>
FREE = <FeeTier.FREE: 'free'>
Inherited Members
enum.Enum
name
value
class SizeFormat(enum.IntEnum):
 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).

PAYOUT = <SizeFormat.PAYOUT: 0>
STAKE = <SizeFormat.STAKE: 1>
Inherited Members
enum.Enum
name
value
builtins.int
conjugate
bit_length
to_bytes
from_bytes
as_integer_ratio
real
imag
numerator
denominator
class SolanaNetwork(builtins.str, enum.Enum):
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

DEVNET = <SolanaNetwork.DEVNET: 'devnet'>
MAINNET = <SolanaNetwork.MAINNET: 'mainnet-beta'>
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
class Fill(typing.NamedTuple):
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.

Fill( taker_side: pyaver.enums.Side, maker_order_id: int, quote_size: int, base_size: int, maker_user_market: solana.publickey.PublicKey, taker_user_market: solana.publickey.PublicKey, maker_fee_tier: int, taker_fee_tier: int)

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)

taker_side: pyaver.enums.Side

Alias for field number 0

maker_order_id: int

Alias for field number 1

quote_size: int

Alias for field number 2

base_size: int

Alias for field number 3

maker_user_market: solana.publickey.PublicKey

Alias for field number 4

taker_user_market: solana.publickey.PublicKey

Alias for field number 5

maker_fee_tier: int

Alias for field number 6

taker_fee_tier: int

Alias for field number 7

Inherited Members
builtins.tuple
index
count
class Out(typing.NamedTuple):
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)

Out( side: pyaver.enums.Side, order_id: int, base_size: int, delete: bool, user_market: solana.publickey.PublicKey, fee_tier: int)

Create new instance of Out(side, order_id, base_size, delete, user_market, fee_tier)

Alias for field number 0

order_id: int

Alias for field number 1

base_size: int

Alias for field number 2

delete: bool

Alias for field number 3

user_market: solana.publickey.PublicKey

Alias for field number 4

fee_tier: int

Alias for field number 5

Inherited Members
builtins.tuple
index
count