pub struct TradeEvent {Show 23 fields
pub flags: u8,
pub padding_0: [u8; 7],
pub trade_id: u64,
pub authority: Pubkey,
pub store: Pubkey,
pub market_token: Pubkey,
pub user: Pubkey,
pub position: Pubkey,
pub order: Pubkey,
pub final_output_token: Pubkey,
pub ts: i64,
pub slot: u64,
pub before: EventPositionState,
pub after: EventPositionState,
pub transfer_out: EventTransferOut,
pub padding_1: [u8; 8],
pub prices: EventTradePrices,
pub execution_price: u128,
pub price_impact_value: i128,
pub price_impact_diff: u128,
pub pnl: EventTradePnl,
pub fees: EventTradeFees,
pub output_amounts: EventTradeOutputAmounts,
}Expand description
Trade event.
Fields§
§flags: u8§padding_0: [u8; 7]§trade_id: u64§store: Pubkey§market_token: Pubkey§user: Pubkey§position: Pubkey§order: Pubkey§final_output_token: Pubkey§ts: i64§slot: u64§before: EventPositionState§after: EventPositionState§transfer_out: EventTransferOut§padding_1: [u8; 8]§prices: EventTradePrices§execution_price: u128§price_impact_value: i128§price_impact_diff: u128§pnl: EventTradePnl§fees: EventTradeFees§output_amounts: EventTradeOutputAmountsImplementations§
Source§impl TradeEvent
impl TradeEvent
Sourcepub fn get_flag(&self, flag: TradeFlag) -> bool
Available on crate features utils and store and gmsol-utils only.
pub fn get_flag(&self, flag: TradeFlag) -> bool
utils and store and gmsol-utils only.Get trade data flag.
Sourcepub fn is_long(&self) -> bool
Available on crate features utils and store and gmsol-utils only.
pub fn is_long(&self) -> bool
utils and store and gmsol-utils only.Return whether the position side is long.
Sourcepub fn is_collateral_long(&self) -> bool
Available on crate features utils and store and gmsol-utils only.
pub fn is_collateral_long(&self) -> bool
utils and store and gmsol-utils only.Return whether the collateral side is long.
Sourcepub fn to_position(&self, meta: &impl HasMarketMeta) -> Position
Available on crate features utils and store and gmsol-utils only.
pub fn to_position(&self, meta: &impl HasMarketMeta) -> Position
utils and store and gmsol-utils only.Create position from this event.
Trait Implementations§
Source§impl BorshDeserialize for TradeEventwhere
u8: BorshDeserialize,
[u8; 7]: BorshDeserialize,
u64: BorshDeserialize,
Pubkey: BorshDeserialize,
i64: BorshDeserialize,
EventPositionState: BorshDeserialize,
EventTransferOut: BorshDeserialize,
[u8; 8]: BorshDeserialize,
EventTradePrices: BorshDeserialize,
u128: BorshDeserialize,
i128: BorshDeserialize,
EventTradePnl: BorshDeserialize,
EventTradeFees: BorshDeserialize,
EventTradeOutputAmounts: BorshDeserialize,
impl BorshDeserialize for TradeEventwhere
u8: BorshDeserialize,
[u8; 7]: BorshDeserialize,
u64: BorshDeserialize,
Pubkey: BorshDeserialize,
i64: BorshDeserialize,
EventPositionState: BorshDeserialize,
EventTransferOut: BorshDeserialize,
[u8; 8]: BorshDeserialize,
EventTradePrices: BorshDeserialize,
u128: BorshDeserialize,
i128: BorshDeserialize,
EventTradePnl: BorshDeserialize,
EventTradeFees: BorshDeserialize,
EventTradeOutputAmounts: BorshDeserialize,
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Deserializes this instance from a given slice of bytes.
Updates the buffer to point at the remaining bytes.
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for TradeEventwhere
u8: BorshSerialize,
[u8; 7]: BorshSerialize,
u64: BorshSerialize,
Pubkey: BorshSerialize,
i64: BorshSerialize,
EventPositionState: BorshSerialize,
EventTransferOut: BorshSerialize,
[u8; 8]: BorshSerialize,
EventTradePrices: BorshSerialize,
u128: BorshSerialize,
i128: BorshSerialize,
EventTradePnl: BorshSerialize,
EventTradeFees: BorshSerialize,
EventTradeOutputAmounts: BorshSerialize,
impl BorshSerialize for TradeEventwhere
u8: BorshSerialize,
[u8; 7]: BorshSerialize,
u64: BorshSerialize,
Pubkey: BorshSerialize,
i64: BorshSerialize,
EventPositionState: BorshSerialize,
EventTransferOut: BorshSerialize,
[u8; 8]: BorshSerialize,
EventTradePrices: BorshSerialize,
u128: BorshSerialize,
i128: BorshSerialize,
EventTradePnl: BorshSerialize,
EventTradeFees: BorshSerialize,
EventTradeOutputAmounts: BorshSerialize,
Source§impl Clone for TradeEvent
impl Clone for TradeEvent
Source§fn clone(&self) -> TradeEvent
fn clone(&self) -> TradeEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TradeEvent
impl Debug for TradeEvent
Source§impl Discriminator for TradeEvent
impl Discriminator for TradeEvent
Source§const DISCRIMINATOR: &'static [u8]
const DISCRIMINATOR: &'static [u8]
Discriminator slice. Read more
impl Copy for TradeEvent
Auto Trait Implementations§
impl Freeze for TradeEvent
impl RefUnwindSafe for TradeEvent
impl Send for TradeEvent
impl Sync for TradeEvent
impl Unpin for TradeEvent
impl UnwindSafe for TradeEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more