carbon-drift-v2-decoder 2.0.0

Drift v2 Decoder
Documentation
//! This code was AUTOGENERATED using the Codama library.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
pub struct PerpPosition {
    /// The perp market's last cumulative funding rate. Used to calculate the
    /// funding payment owed to user precision: FUNDING_RATE_PRECISION
    pub last_cumulative_funding_rate: i64,
    /// the size of the users perp position
    /// precision: BASE_PRECISION
    pub base_asset_amount: i64,
    /// Used to calculate the users pnl. Upon entry, is equal to
    /// base_asset_amount * avg entry price - fees Updated when the user
    /// open/closes position or settles pnl. Includes fees/funding
    /// precision: QUOTE_PRECISION
    pub quote_asset_amount: i64,
    /// The amount of quote the user would need to exit their position at to
    /// break even Updated when the user open/closes position or settles
    /// pnl. Includes fees/funding precision: QUOTE_PRECISION
    pub quote_break_even_amount: i64,
    /// The amount quote the user entered the position with. Equal to base asset
    /// amount * avg entry price Updated when the user open/closes position.
    /// Excludes fees/funding precision: QUOTE_PRECISION
    pub quote_entry_amount: i64,
    /// The amount of non reduce only trigger orders the user has open
    /// precision: BASE_PRECISION
    pub open_bids: i64,
    /// The amount of non reduce only trigger orders the user has open
    /// precision: BASE_PRECISION
    pub open_asks: i64,
    /// The amount of pnl settled in this market since opening the position
    /// precision: QUOTE_PRECISION
    pub settled_pnl: i64,
    /// The number of lp (liquidity provider) shares the user has in this perp
    /// market LP shares allow users to provide liquidity via the AMM
    /// precision: BASE_PRECISION
    pub lp_shares: u64,
    /// The scaled balance of the isolated position
    /// precision: SPOT_BALANCE_PRECISION
    pub isolated_position_scaled_balance: u64,
    /// The last quote asset amount per lp the amm had
    /// Used to settle the users lp position
    /// precision: QUOTE_PRECISION
    pub last_quote_asset_amount_per_lp: i64,
    pub padding: [u8; 2],
    pub max_margin_ratio: u16,
    /// The market index for the perp market
    pub market_index: u16,
    /// The number of open orders
    pub open_orders: u8,
    pub position_flag: u8,
}