pub enum HyperliquidMarket {
Perp {
base: String,
quote: String,
index: u32,
instrument_meta: Option<InstrumentMetaConfig>,
},
Spot {
base: String,
quote: String,
index: u32,
instrument_meta: Option<InstrumentMetaConfig>,
},
Hip3 {
base: String,
quote: String,
dex: String,
dex_index: u32,
asset_index: u32,
instrument_meta: Option<InstrumentMetaConfig>,
},
Outcome {
name: String,
outcome_id: u32,
side: u8,
instrument_meta: Option<InstrumentMetaConfig>,
},
}Expand description
Hyperliquid market types — Perp, Spot, HIP-3, or Outcome.
Variants§
Perp
Standard perpetual contract on main Hyperliquid.
Fields
instrument_meta: Option<InstrumentMetaConfig>Instrument metadata (tick/lot sizes)
Spot
Spot market on Hyperliquid.
Fields
instrument_meta: Option<InstrumentMetaConfig>Instrument metadata (tick/lot sizes)
Hip3
HIP-3 builder-deployed perpetual DEX.
Fields
instrument_meta: Option<InstrumentMetaConfig>Instrument metadata (tick/lot sizes)
Outcome
Prediction market outcome.
Outcomes trade like spot but use asset ID = 100_000_000 + encoding, where encoding = 10 * outcome_id + side. Live outcome books quote in USDH.
Implementations§
Source§impl HyperliquidMarket
impl HyperliquidMarket
Sourcepub fn outcome_encoding(outcome_id: u32, side: u8) -> u32
pub fn outcome_encoding(outcome_id: u32, side: u8) -> u32
Calculate the encoding for an outcome: 10 * outcome_id + side.
Sourcepub fn instrument_id(&self) -> InstrumentId
pub fn instrument_id(&self) -> InstrumentId
Get the canonical instrument ID.
Sourcepub fn market_index(&self) -> MarketIndex
pub fn market_index(&self) -> MarketIndex
Get the market index.
Sourcepub fn is_spot_like(&self) -> bool
pub fn is_spot_like(&self) -> bool
Check if this market settles like spot with no margin/leverage.
Sourcepub fn is_outcome(&self) -> bool
pub fn is_outcome(&self) -> bool
Check if this is a prediction market outcome.
Sourcepub fn effective_asset_id(&self) -> u32
pub fn effective_asset_id(&self) -> u32
Get the effective asset ID for order placement.
- Perp: returns the index directly
- Spot: returns the index directly (e.g., 10107)
- Hip3: calculates 110000 + ((dex_index-1) * 10000) + asset_index
- Outcome: returns 100_000_000 + encoding
Sourcepub fn coin_name(&self) -> Option<String>
pub fn coin_name(&self) -> Option<String>
Get the coin name used in allMids/fills lookups.
- Outcome:
#<encoding>(e.g.,#5160) - Spot: base coin name (e.g.,
HYPE) - Others: None (uses standard name)
Sourcepub fn spot_coin(&self) -> Option<String>
pub fn spot_coin(&self) -> Option<String>
Get the spot coin name for @tokenId alias resolution.
Sourcepub fn spot_market_index(&self) -> Option<u32>
pub fn spot_market_index(&self) -> Option<u32>
Get the spot market index for price lookups.
Sourcepub fn hip3_config(&self) -> Option<Hip3MarketConfig>
pub fn hip3_config(&self) -> Option<Hip3MarketConfig>
Get HIP-3 configuration if applicable.
Sourcepub fn uses_alternate_collateral(&self) -> bool
pub fn uses_alternate_collateral(&self) -> bool
Check if this HIP-3 market uses non-USDC collateral.
Sourcepub fn instrument_meta(&self) -> Option<&InstrumentMetaConfig>
pub fn instrument_meta(&self) -> Option<&InstrumentMetaConfig>
Get instrument metadata if configured.
Sourcepub fn price_bounds(&self) -> Option<(Decimal, Decimal)>
pub fn price_bounds(&self) -> Option<(Decimal, Decimal)>
Optional exclusive price bounds for markets with bounded price domains.
Sourcepub fn validation_errors(&self) -> Vec<String>
pub fn validation_errors(&self) -> Vec<String>
Validate Hyperliquid market-specific invariants.
Trait Implementations§
Source§impl Clone for HyperliquidMarket
impl Clone for HyperliquidMarket
Source§fn clone(&self) -> HyperliquidMarket
fn clone(&self) -> HyperliquidMarket
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HyperliquidMarket
impl Debug for HyperliquidMarket
Source§impl<'de> Deserialize<'de> for HyperliquidMarket
impl<'de> Deserialize<'de> for HyperliquidMarket
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>,
Source§impl JsonSchema for HyperliquidMarket
impl JsonSchema for HyperliquidMarket
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more