pub struct Standing {
pub mode: Option<Abstraction>,
pub dexes: Vec<DexState>,
pub spot: Option<SpotState>,
pub heard: Option<u64>,
}Expand description
One account as last read: its mode, each dex it was read on, and spot.
Fields§
§mode: Option<Abstraction>None until a read or the socket says.
dexes: Vec<DexState>§spot: Option<SpotState>§heard: Option<u64>When it was last told anything, in milliseconds.
Implementations§
Source§impl Standing
impl Standing
pub fn dex(&self, dex: &str) -> Option<&PerpState>
pub fn keeping(&self) -> Keeping
Sourcepub fn pools(&self) -> bool
pub fn pools(&self) -> bool
Whether perp margin is drawn from spot, so a dex’s value is already inside the spot balances.
Sourcepub fn free(&self, token: u32) -> Dec
pub fn free(&self, token: u32) -> Dec
A spot token less what orders hold of it, never below nothing.
Sourcepub fn balances(&self, collateral: &Collateral) -> Vec<Balance>
pub fn balances(&self, collateral: &Collateral) -> Vec<Balance>
Every balance an order can draw on, by what it pays for. Spot counts
USDC and the dexes’ collateral tokens: USDC always, another only when
held. Any other token is a holding, not a balance
(crate::account::worth::holdings).
Sourcepub fn usable(
&self,
surface: Surface<'_>,
collateral: &Collateral,
price: impl Fn(&str) -> Option<Dec>,
) -> Usable
pub fn usable( &self, surface: Surface<'_>, collateral: &Collateral, price: impl Fn(&str) -> Option<Dec>, ) -> Usable
What this account can put on surface. price is a spot token’s
price in USDC by its name, which only portfolio margin’s lending reads.
A figure past what a Dec counts reads as nothing, never as more.
Sourcepub fn borrowable(&self, price: &impl Fn(&str) -> Option<Dec>) -> Dec
pub fn borrowable(&self, price: &impl Fn(&str) -> Option<Dec>) -> Dec
What portfolio margin would lend in USDC now: each eligible token’s total at price and its
loan-to-value (the row’s own ltv, else LTV), less what is owed already, at most what USDC
has free after maintenance where the venue says, and nothing once liquidatable. Nothing on any
other mode.
Trait Implementations§
impl Eq for Standing
impl StructuralPartialEq for Standing
Auto Trait Implementations§
impl Freeze for Standing
impl RefUnwindSafe for Standing
impl Send for Standing
impl Sync for Standing
impl Unpin for Standing
impl UnsafeUnpin for Standing
impl UnwindSafe for Standing
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.