pub struct MarginTable {
pub description: String,
pub margin_tiers: Vec<MarginTier>,
}Fields§
§description: Stringtiered 40x; empty on some.
margin_tiers: Vec<MarginTier>Lowest first.
Implementations§
Source§impl MarginTable
impl MarginTable
Sourcepub fn flat(max_leverage: u32) -> MarginTable
pub fn flat(max_leverage: u32) -> MarginTable
One tier, from nothing on: what an id under FLAT_TABLES_BELOW is.
Sourcepub fn by_id(id: u32, listed: &[(u32, MarginTable)]) -> Option<MarginTable>
pub fn by_id(id: u32, listed: &[(u32, MarginTable)]) -> Option<MarginTable>
A table by its id: flat under FLAT_TABLES_BELOW, else one of
listed, a meta’s marginTables. No perp is on table 0.
Sourcepub fn max_leverage_at(&self, notional: Dec) -> Option<u32>
pub fn max_leverage_at(&self, notional: Dec) -> Option<u32>
The most leverage a position of notional may take: the tier with the
highest lower bound at or under it. A short’s notional counts as its
size. The docs do not say which tier a notional exactly on a bound
falls in; here it is the higher one, the bound being its lower.
Trait Implementations§
Source§impl Clone for MarginTable
impl Clone for MarginTable
Source§impl Debug for MarginTable
impl Debug for MarginTable
Source§impl<'de> Deserialize<'de> for MarginTable
impl<'de> Deserialize<'de> for MarginTable
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for MarginTable
Source§impl PartialEq for MarginTable
impl PartialEq for MarginTable
impl StructuralPartialEq for MarginTable
Auto Trait Implementations§
impl Freeze for MarginTable
impl RefUnwindSafe for MarginTable
impl Send for MarginTable
impl Sync for MarginTable
impl Unpin for MarginTable
impl UnsafeUnpin for MarginTable
impl UnwindSafe for MarginTable
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
Mutably borrows from an owned value. Read more
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
Compare self to
key and return true if they are equal.