ccxt-rust 0.1.5

Cryptocurrency exchange trading library in Rust
Documentation
//! Binance Order Enhancement Example
//!
//! Note: Some order-related methods (fetch_order_trades, fetch_canceled_orders,
//! create_market_buy_order_with_cost) are not yet migrated to the new modular structure.
//! This is a placeholder example.

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

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    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 _exchange = Binance::new(config)?;

    println!("========================================");
    println!("Binance Order Enhancement Example");
    println!("========================================\n");

    // Note: The following methods are not yet migrated to the new modular structure:
    // - fetch_order_trades
    // - fetch_canceled_orders
    // - create_market_buy_order_with_cost

    println!("Note: Order enhancement 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#"
// Fetch order trades
let trades = exchange.fetch_order_trades(
    "12345678",    // Order ID
    "BTC/USDT",    // Symbol
    None,          // Since timestamp
    None,          // Limit
).await?;

// Fetch canceled orders
let orders = exchange.fetch_canceled_orders(
    "BTC/USDT",    // Symbol
    Some(10),      // Limit
    None,          // Optional parameters
).await?;

// Create market buy order with cost
let order = exchange.create_market_buy_order_with_cost(
    "BTC/USDT",    // Symbol
    100.0,         // Cost in quote currency
    None,          // Optional parameters
).await?;
"#
    );

    println!("\n========================================");
    println!("Example execution complete");
    println!("========================================");

    Ok(())
}