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: StringExchange-specific market ID
symbol: StringUnified 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: StringBase currency code (e.g., “BTC”)
quote: StringQuote 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: MarketTypeMarket type (spot, futures, swap, option)
active: boolIs market active for trading
margin: boolIs 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: MarketPrecisionPrecision settings
limits: MarketLimitsLimits 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
impl Market
Sourcepub fn new_spot(
id: String,
symbol: String,
base: String,
quote: String,
) -> Market
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.
Sourcepub fn new_futures(
id: String,
symbol: String,
base: String,
quote: String,
settle: String,
contract_size: Decimal,
) -> Market
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.
Sourcepub fn new_swap(
id: String,
symbol: String,
base: String,
quote: String,
settle: String,
contract_size: Decimal,
) -> Market
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.
Sourcepub fn parse_symbol(&mut self) -> bool
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.
Sourcepub fn set_parsed_symbol(&mut self, parsed: ParsedSymbol)
pub fn set_parsed_symbol(&mut self, parsed: ParsedSymbol)
Set the parsed symbol directly
Sourcepub fn get_parsed_symbol(&self) -> Option<&ParsedSymbol>
pub fn get_parsed_symbol(&self) -> Option<&ParsedSymbol>
Get the parsed symbol if available
Sourcepub fn is_futures(&self) -> bool
pub fn is_futures(&self) -> bool
Check if market is a futures market
Sourcepub fn is_contract(&self) -> bool
pub fn is_contract(&self) -> bool
Check if market is a contract (futures/swap/option)
Sourcepub fn is_linear(&self) -> bool
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)
Sourcepub fn is_inverse(&self) -> bool
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)
Sourcepub fn settlement_currency(&self) -> &str
pub fn settlement_currency(&self) -> &str
Get the settlement currency