ccxt-rust 0.1.5

Cryptocurrency exchange trading library in Rust
Documentation
//! Binance Futures Margin Example
//!
//! Note: Futures margin methods are not yet migrated to the new modular structure.
//! This is a placeholder example.
//!
//! # Running the Example
//!
//! ```bash
//! cargo run --example binance_futures_margin_example
//! ```

use ccxt_core::ExchangeConfig;
use ccxt_exchanges::binance::Binance;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    println!("=================================");
    println!("Binance Futures Margin Example");
    println!("=================================\n");

    let config = ExchangeConfig {
        api_key: std::env::var("BINANCE_API_KEY")
            .ok()
            .map(ccxt_core::SecretString::new),
        secret: std::env::var("BINANCE_API_SECRET")
            .ok()
            .map(ccxt_core::SecretString::new),
        ..Default::default()
    };

    let _binance = Binance::new(config)?;

    // Note: Futures margin methods are not yet migrated to the new modular structure:
    // - modify_isolated_position_margin
    // - fetch_position_risk
    // - fetch_leverage_bracket

    println!("Note: Futures margin methods are not yet migrated to the new modular structure.");
    println!("      See rest_old.rs for the original implementations.\n");

    println!("Code examples (not executable until methods are migrated):");
    println!(
        r#"
// Modify isolated position margin
let result = binance.modify_isolated_position_margin(
    "BTC/USDT:USDT",  // Symbol
    100.0,            // Amount
    1,                // Type: 1 = add, 2 = reduce
    None,             // Optional parameters
).await?;

// Fetch position risk
let risks = binance.fetch_position_risk("BTC/USDT:USDT", None).await?;

// Fetch leverage bracket
let brackets = binance.fetch_leverage_bracket("BTC/USDT:USDT", None).await?;
"#
    );

    println!("\n=================================");
    println!("Example completed!");
    println!("=================================");

    Ok(())
}