Struct mango_v4::state::OpenbookV2Orders
source · #[repr(C)]pub struct OpenbookV2Orders {Show 15 fields
pub open_orders: Pubkey,
pub base_borrows_without_fee: u64,
pub quote_borrows_without_fee: u64,
pub highest_placed_bid_inv: f64,
pub lowest_placed_ask: f64,
pub potential_base_tokens: u64,
pub potential_quote_tokens: u64,
pub lowest_placed_bid_inv: f64,
pub highest_placed_ask: f64,
pub quote_lot_size: i64,
pub base_lot_size: i64,
pub market_index: OpenbookV2MarketIndex,
pub base_token_index: TokenIndex,
pub quote_token_index: TokenIndex,
pub reserved: [u8; 162],
}
Fields§
§open_orders: Pubkey
§base_borrows_without_fee: u64
Tracks the amount of borrows that have flowed into the open orders account. These borrows did not have the loan origination fee applied, and that may happen later (in openbook_v2_settle_funds) if we can guarantee that the funds were used. In particular a place-on-book, cancel, settle should not cost fees.
quote_borrows_without_fee: u64
§highest_placed_bid_inv: f64
Track something like the highest open bid / lowest open ask, in native/native units.
Tracking it exactly isn’t possible since we don’t see fills. So instead track the min/max of the placed bids and asks.
The value is reset in openbook_v2_place_order when a new order is placed without an existing one on the book.
0 is a special “unset” state.
lowest_placed_ask: f64
§potential_base_tokens: u64
An overestimate of the amount of tokens that might flow out of the open orders account.
The bank still considers these amounts user deposits (see Bank::potential_openbook_tokens) and that value needs to be updated in conjunction with these numbers.
This estimation is based on the amount of tokens in the open orders account (see update_bank_potential_tokens() in openbook_v2_place_order and settle)
potential_quote_tokens: u64
§lowest_placed_bid_inv: f64
Track lowest bid/highest ask, same way as for highest bid/lowest ask.
0 is a special “unset” state.
highest_placed_ask: f64
§quote_lot_size: i64
Stores the market’s lot sizes
Needed because the obv2 open orders account tells us about reserved amounts in lots and we want to be able to compute health without also loading the obv2 market.
base_lot_size: i64
§market_index: OpenbookV2MarketIndex
§base_token_index: TokenIndex
Store the base/quote token index, so health computations don’t need to get passed the static SerumMarket to find which tokens a market uses and look up the correct oracles.
quote_token_index: TokenIndex
§reserved: [u8; 162]
Implementations§
source§impl OpenbookV2Orders
impl OpenbookV2Orders
pub fn is_active(&self) -> bool
pub fn is_active_for_market(&self, market_index: OpenbookV2MarketIndex) -> bool
Trait Implementations§
source§impl BorshDeserialize for OpenbookV2Orderswhere
Pubkey: BorshDeserialize,
u64: BorshDeserialize,
f64: BorshDeserialize,
i64: BorshDeserialize,
OpenbookV2MarketIndex: BorshDeserialize,
TokenIndex: BorshDeserialize,
[u8; 162]: BorshDeserialize,
impl BorshDeserialize for OpenbookV2Orderswhere Pubkey: BorshDeserialize, u64: BorshDeserialize, f64: BorshDeserialize, i64: BorshDeserialize, OpenbookV2MarketIndex: BorshDeserialize, TokenIndex: BorshDeserialize, [u8; 162]: BorshDeserialize,
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where R: Read,
source§impl BorshSerialize for OpenbookV2Orderswhere
Pubkey: BorshSerialize,
u64: BorshSerialize,
f64: BorshSerialize,
i64: BorshSerialize,
OpenbookV2MarketIndex: BorshSerialize,
TokenIndex: BorshSerialize,
[u8; 162]: BorshSerialize,
impl BorshSerialize for OpenbookV2Orderswhere Pubkey: BorshSerialize, u64: BorshSerialize, f64: BorshSerialize, i64: BorshSerialize, OpenbookV2MarketIndex: BorshSerialize, TokenIndex: BorshSerialize, [u8; 162]: BorshSerialize,
source§impl Clone for OpenbookV2Orders
impl Clone for OpenbookV2Orders
source§fn clone(&self) -> OpenbookV2Orders
fn clone(&self) -> OpenbookV2Orders
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for OpenbookV2Orders
impl Debug for OpenbookV2Orders
source§impl Default for OpenbookV2Orders
impl Default for OpenbookV2Orders
source§impl PartialEq<OpenbookV2Orders> for OpenbookV2Orders
impl PartialEq<OpenbookV2Orders> for OpenbookV2Orders
source§fn eq(&self, other: &OpenbookV2Orders) -> bool
fn eq(&self, other: &OpenbookV2Orders) -> bool
self
and other
values to be equal, and is used
by ==
.impl Copy for OpenbookV2Orders
impl Pod for OpenbookV2Orders
impl StructuralPartialEq for OpenbookV2Orders
Auto Trait Implementations§
impl RefUnwindSafe for OpenbookV2Orders
impl Send for OpenbookV2Orders
impl Sync for OpenbookV2Orders
impl Unpin for OpenbookV2Orders
impl UnwindSafe for OpenbookV2Orders
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.