TradeEvent

Struct TradeEvent 

Source
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§authority: Pubkey§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: EventTradeOutputAmounts

Implementations§

Source§

impl TradeEvent

Source

pub fn get_flag(&self, flag: TradeFlag) -> bool

Available on crate features utils and store and gmsol-utils only.

Get trade data flag.

Source

pub fn is_long(&self) -> bool

Available on crate features utils and store and gmsol-utils only.

Return whether the position side is long.

Source

pub fn is_collateral_long(&self) -> bool

Available on crate features utils and store and gmsol-utils only.

Return whether the collateral side is long.

Source

pub fn to_position(&self, meta: &impl HasMarketMeta) -> Position

Available on crate features utils and store and gmsol-utils only.

Create position from this event.

Trait Implementations§

Source§

impl BorshDeserialize for TradeEvent

Source§

fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>

Source§

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>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSerialize for TradeEvent

Source§

fn serialize<W: Write>(&self, writer: &mut W) -> Result<(), Error>

Source§

fn try_to_vec(&self) -> Result<Vec<u8>, Error>

Serialize this instance into a vector of bytes.
Source§

impl Clone for TradeEvent

Source§

fn clone(&self) -> TradeEvent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TradeEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Discriminator for TradeEvent

Source§

const DISCRIMINATOR: &'static [u8]

Discriminator slice. Read more
Source§

impl Event for TradeEvent

Source§

fn data(&self) -> Vec<u8>

Source§

impl Copy for TradeEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V