pub trait Position<const DECIMALS: u8>: PositionState<DECIMALS> {
type Market: PerpMarket<DECIMALS, Num = Self::Num, Signed = Self::Signed>;
// Required methods
fn market(&self) -> &Self::Market;
fn is_long(&self) -> bool;
fn is_collateral_token_long(&self) -> bool;
fn are_pnl_and_collateral_tokens_the_same(&self) -> bool;
fn on_validate(&self) -> Result<()>;
}
Expand description
Position with access to its market.
Required Associated Types§
Sourcetype Market: PerpMarket<DECIMALS, Num = Self::Num, Signed = Self::Signed>
type Market: PerpMarket<DECIMALS, Num = Self::Num, Signed = Self::Signed>
Market type.
Required Methods§
Sourcefn is_collateral_token_long(&self) -> bool
fn is_collateral_token_long(&self) -> bool
Returns whether the collateral token is the long token of the market.
Sourcefn are_pnl_and_collateral_tokens_the_same(&self) -> bool
fn are_pnl_and_collateral_tokens_the_same(&self) -> bool
Returns whether the pnl and collateral tokens are the same.
Sourcefn on_validate(&self) -> Result<()>
fn on_validate(&self) -> Result<()>
Called from validate_position
to add supplementary checks.