Market

Struct Market 

Source
pub struct Market {
Show 28 fields pub id: String, pub symbol: String, pub parsed_symbol: Option<ParsedSymbol>, pub base: String, pub quote: String, pub settle: Option<String>, pub base_id: Option<String>, pub quote_id: Option<String>, pub settle_id: Option<String>, pub market_type: MarketType, pub active: bool, pub margin: bool, pub contract: Option<bool>, pub linear: Option<bool>, pub inverse: Option<bool>, pub contract_size: Option<Decimal>, pub expiry: Option<i64>, pub expiry_datetime: Option<String>, pub strike: Option<Decimal>, pub option_type: Option<String>, pub precision: MarketPrecision, pub limits: MarketLimits, pub maker: Option<Decimal>, pub taker: Option<Decimal>, pub percentage: Option<bool>, pub tier_based: Option<bool>, pub fee_side: Option<String>, pub info: HashMap<String, Value>,
}
Expand description

Market structure representing a trading pair

This corresponds to Go’s MarketInterface struct and contains all metadata about a trading pair including symbols, currencies, precision, limits, and exchange-specific information.

Fields§

§id: String

Exchange-specific market ID

§symbol: String

Unified symbol (e.g., “BTC/USDT”)

§parsed_symbol: Option<ParsedSymbol>

Parsed symbol structure with all components This provides structured access to base, quote, settle, and expiry

§base: String

Base currency code (e.g., “BTC”)

§quote: String

Quote currency code (e.g., “USDT”)

§settle: Option<String>

Settle currency code (for futures/swaps)

§base_id: Option<String>

Base currency ID on exchange

§quote_id: Option<String>

Quote currency ID on exchange

§settle_id: Option<String>

Settle currency ID on exchange

§market_type: MarketType

Market type (spot, futures, swap, option)

§active: bool

Is market active for trading

§margin: bool

Is margin trading allowed

§contract: Option<bool>

Contract type (inverse, linear, etc.)

§linear: Option<bool>

Is linear contract

§inverse: Option<bool>

Is inverse contract

§contract_size: Option<Decimal>

Contract size (for futures/swaps)

§expiry: Option<i64>

Expiry timestamp (for futures/options)

§expiry_datetime: Option<String>

Expiry datetime string

§strike: Option<Decimal>

Strike price (for options)

§option_type: Option<String>

Option type (call/put)

§precision: MarketPrecision

Precision settings

§limits: MarketLimits

Limits for orders

§maker: Option<Decimal>

Maker fee rate

§taker: Option<Decimal>

Taker fee rate

§percentage: Option<bool>

Percentage (true) or fixed (false) fees

§tier_based: Option<bool>

Tier-based fees

§fee_side: Option<String>

Fee side (get/give/base/quote)

§info: HashMap<String, Value>

Raw exchange info

Implementations§

Source§

impl Market

Source

pub fn new_spot( id: String, symbol: String, base: String, quote: String, ) -> Market

Create a new spot market

The symbol is automatically parsed to populate the parsed_symbol field. If parsing fails, parsed_symbol will be None.

Source

pub fn new_futures( id: String, symbol: String, base: String, quote: String, settle: String, contract_size: Decimal, ) -> Market

Create a new futures market

The symbol is automatically parsed to populate the parsed_symbol field. If parsing fails, parsed_symbol will be None.

Source

pub fn new_swap( id: String, symbol: String, base: String, quote: String, settle: String, contract_size: Decimal, ) -> Market

Create a new swap (perpetual) market

The symbol is automatically parsed to populate the parsed_symbol field. If parsing fails, parsed_symbol will be None.

Source

pub fn parse_symbol(&mut self) -> bool

Set the parsed symbol from the symbol string

This method attempts to parse the current symbol string and update the parsed_symbol field. Returns true if parsing succeeded.

Source

pub fn set_parsed_symbol(&mut self, parsed: ParsedSymbol)

Set the parsed symbol directly

Source

pub fn get_parsed_symbol(&self) -> Option<&ParsedSymbol>

Get the parsed symbol if available

Source

pub fn is_spot(&self) -> bool

Check if market is a spot market

Source

pub fn is_futures(&self) -> bool

Check if market is a futures market

Source

pub fn is_swap(&self) -> bool

Check if market is a swap/perpetual market

Source

pub fn is_option(&self) -> bool

Check if market is an options market

Source

pub fn is_contract(&self) -> bool

Check if market is a contract (futures/swap/option)

Source

pub fn is_linear(&self) -> bool

Check if market is a linear contract (settled in quote currency) Linear contracts: USDT-margined futures/swaps (e.g., BTC/USDT:USDT)

Source

pub fn is_inverse(&self) -> bool

Check if market is an inverse contract (settled in base currency) Inverse contracts: Coin-margined futures/swaps (e.g., BTC/USD:BTC)

Source

pub fn settlement_currency(&self) -> &str

Get the settlement currency

Trait Implementations§

Source§

impl Clone for Market

Source§

fn clone(&self) -> Market

Returns a duplicate of the value. Read more
1.0.0 · 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<(), Error>

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

impl Default for Market

Source§

fn default() -> Market

Returns the “default value” for a type. Read more
Source§

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

Source§

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

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

impl Serialize for Market

Source§

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Market

§

impl RefUnwindSafe for Market

§

impl Send for Market

§

impl Sync for Market

§

impl Unpin for Market

§

impl UnwindSafe for Market

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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