use crate::markets::perps::meta::{Meta, PerpAsset};
pub use crate::trade::{FLAT_TABLES_BELOW, MarginTable, MarginTier};
impl Meta {
#[must_use]
pub fn margin_table(&self, id: u32) -> Option<MarginTable> {
MarginTable::by_id(id, &self.margin_tables)
}
#[must_use]
pub fn table_of(&self, perp: &PerpAsset) -> Option<MarginTable> {
match perp.margin_table_id {
Some(id) => self.margin_table(id),
None => Some(MarginTable::flat(perp.max_leverage)),
}
}
}