Skip to main content

Market

Enum Market 

Source
pub enum Market {
    Hyperliquid(HyperliquidMarket),
}
Expand description

Unified market configuration — replaces scattered config fields.

This is the canonical representation of “where to trade”. All exchange/market-type-specific details are encapsulated here.

Variants§

§

Hyperliquid(HyperliquidMarket)

Hyperliquid exchange markets

Implementations§

Source§

impl Market

Source

pub fn instrument_id(&self) -> InstrumentId

Get the canonical instrument ID for engine use.

Source

pub fn market_index(&self) -> MarketIndex

Get the exchange-specific market index.

Source

pub fn is_spot(&self) -> bool

Check if this is a spot market.

Source

pub fn is_spot_like(&self) -> bool

Check if this market settles like spot with no margin/leverage.

Source

pub fn uses_margin(&self) -> bool

Check if this market uses margin/leverage.

Source

pub fn base(&self) -> &str

Get the base asset (e.g., “BTC”, “HYPE”).

Source

pub fn quote(&self) -> &str

Get the quote asset (e.g., “USDC”, “USDE”).

Source

pub fn base_asset(&self) -> AssetId

Get the base asset ID.

Source

pub fn quote_asset(&self) -> AssetId

Get the quote asset ID.

Source

pub fn instrument_kind(&self) -> InstrumentKind

Get the instrument kind (Spot, Perp, or Outcome).

Source

pub fn is_outcome(&self) -> bool

Check if this is a prediction market (outcome).

Source

pub fn outcome_params(&self) -> Option<(u32, u8, String)>

Get outcome parameters (outcome_id, side, name) if this is an Outcome market.

Source

pub fn exchange_instance(&self, environment: Environment) -> ExchangeInstance

Get the exchange instance for this market.

Source

pub fn effective_asset_id(&self) -> u32

Get the effective asset ID for order placement (Hyperliquid-specific).

Source

pub fn spot_coin(&self) -> Option<String>

Get the spot coin name for alias resolution (e.g., “@107” -> “HYPE”).

Source

pub fn spot_market_index(&self) -> Option<u32>

Get the spot market index for price lookups (e.g., 10107 for HYPE).

Source

pub fn hip3_config(&self) -> Option<Hip3MarketConfig>

Get HIP-3 configuration if this is a HIP-3 market.

Source

pub fn instrument_meta(&self) -> Option<&InstrumentMetaConfig>

Get instrument metadata if configured.

Source

pub fn price_bounds(&self) -> Option<(Decimal, Decimal)>

Optional exclusive price bounds for markets with bounded price domains.

Source

pub fn validation_errors(&self) -> Vec<String>

Validate market-specific invariants.

Trait Implementations§

Source§

impl Clone for Market

Source§

fn clone(&self) -> Market

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Market

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Market

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Market

Source§

fn schema_name() -> String

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn is_referenceable() -> bool

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for Market

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.