pub struct Account { /* private fields */ }Expand description
Exchange account.
Implementations§
Source§impl Account
impl Account
Sourcepub fn instant(&self) -> StateInstant
pub fn instant(&self) -> StateInstant
Instant the account state is consistent with or was last updated at.
Sourcepub fn balance(&self) -> UD128
pub fn balance(&self) -> UD128
The current balance of collateral tokens in this account, not including any open positions.
Sourcepub fn locked_balance(&self) -> UD128
pub fn locked_balance(&self) -> UD128
The balance of collateral tokens locked by existing orders for this
account.
If this value exceeds Self::balance, new Open* orders cannot be
placed.
Sourcepub fn available_balance(&self) -> UD128
pub fn available_balance(&self) -> UD128
The balance of collateral tokens available for trading.
Sourcepub fn unrealized_pnl(&self) -> D256
pub fn unrealized_pnl(&self) -> D256
Total unrealized PnL of all positions of the account.
Sourcepub fn fee_tier(&self) -> Option<FeeTier>
pub fn fee_tier(&self) -> Option<FeeTier>
Fee tier of the account, indexing the
Perpetual::fee_schedule of every contract it trades. Tier 0 is the
base rate.
None when the tier was never observed: contracts before v1.1.7.4 have
no per-account tiers, and accounts tracked via
SnapshotBuilder::with_all_positions are not snapshotted - such an
account reports a tier only once AccountFeeTierSet is observed for it.
Sourcepub fn positions(&self) -> &HashMap<PerpetualId, Position>
pub fn positions(&self) -> &HashMap<PerpetualId, Position>
Positions the account has, up to one per each perpetual contract.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Account
impl RefUnwindSafe for Account
impl Send for Account
impl Sync for Account
impl Unpin for Account
impl UnsafeUnpin for Account
impl UnwindSafe for Account
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.