pub struct SymbolParser;Expand description
Symbol parser for unified symbol strings
Provides methods to parse and validate unified symbol strings into
ParsedSymbol structures.
Implementations§
Source§impl SymbolParser
impl SymbolParser
Sourcepub fn parse(symbol: &str) -> Result<ParsedSymbol, SymbolError>
pub fn parse(symbol: &str) -> Result<ParsedSymbol, SymbolError>
Parse a unified symbol string into a ParsedSymbol
§Arguments
symbol- The unified symbol string to parse
§Returns
Returns Ok(ParsedSymbol) if parsing succeeds, or Err(SymbolError) if the
symbol format is invalid.
§Examples
use ccxt_core::symbol::SymbolParser;
// Spot symbol
let spot = SymbolParser::parse("BTC/USDT").unwrap();
assert_eq!(spot.base, "BTC");
assert_eq!(spot.quote, "USDT");
assert!(spot.settle.is_none());
// Swap symbol
let swap = SymbolParser::parse("ETH/USDT:USDT").unwrap();
assert_eq!(swap.settle, Some("USDT".to_string()));
// Futures symbol
let futures = SymbolParser::parse("BTC/USDT:USDT-241231").unwrap();
assert!(futures.expiry.is_some());Auto Trait Implementations§
impl Freeze for SymbolParser
impl RefUnwindSafe for SymbolParser
impl Send for SymbolParser
impl Sync for SymbolParser
impl Unpin for SymbolParser
impl UnsafeUnpin for SymbolParser
impl UnwindSafe for SymbolParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more