Skip to content

Commit

Permalink
MarketId::new and MarketId.is_spot()
Browse files Browse the repository at this point in the history
Bump deps in Cargo.lock
  • Loading branch information
jordy25519 committed Oct 29, 2024
1 parent a09391e commit 675a099
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ impl core::hash::Hash for MarketType {
}

impl MarketId {
/// Create a new `MarketId` from parts
pub fn new(index: u16, kind: MarketType) -> Self {
Self { index, kind }
}
/// `MarketId` for the USDC Spot Market
pub const QUOTE_SPOT: Self = Self {
index: 0,
Expand Down Expand Up @@ -148,6 +152,9 @@ impl MarketId {
pub fn is_perp(self) -> bool {
self.kind == MarketType::Perp
}
pub fn is_spot(self) -> bool {
self.kind == MarketType::Spot
}
}

impl std::fmt::Debug for MarketId {
Expand Down

0 comments on commit 675a099

Please sign in to comment.