Module default_type

Module default_type 

Source
Expand description

Default type configuration for exchange operations Default Type Definitions for Exchange Configuration

This module provides type-safe configuration for selecting which market type (spot, swap, futures, margin, option) an exchange client should use by default when calling generic API methods.

§Overview

The types in this module enable:

  • DefaultType: Primary market type configuration (spot, swap, futures, margin, option)
  • DefaultSubType: Secondary configuration for contract settlement (linear, inverse)

§Example

use ccxt_core::types::default_type::{DefaultType, DefaultSubType};
use std::str::FromStr;

// Create default types
let spot = DefaultType::Spot;
let swap = DefaultType::Swap;

// Parse from string (case-insensitive)
let futures = DefaultType::from_str("FUTURES").unwrap();
let margin = DefaultType::from_str("margin").unwrap();

// Display as lowercase
assert_eq!(spot.to_string(), "spot");
assert_eq!(swap.to_string(), "swap");

// Check market characteristics
assert!(!spot.is_derivative());
assert!(swap.is_derivative());
assert!(futures.is_contract());

Enums§

DefaultSubType
Contract settlement type for derivatives
DefaultType
Default market type for exchange operations
DefaultTypeError
Error type for DefaultType parsing

Functions§

resolve_market_type
Resolves the effective market type for an API call