openxapi-binance 0.1.2

Rust client for Binance API
Documentation
# Rust client for Binance API

This package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project.

Please do not edit the generated code manually, but rather regenerate it from [OpenXAPI](https://github.com/openxapi/openxapi).

- API version: 0.1.2
- Package version: 0.1.2

## Requirements.

Rust 1.70+

## Installation & Usage

Install the package using cargo:

```bash
cargo add openxapi-binance
```

Or add the following to your `Cargo.toml`:

```toml
[dependencies]
openxapi-binance = { git = "https://github.com/openxapi/binance-rs" }
```

## Getting Started

In your own code, to use this library to connect and interact with `spot` and `umfutures`, you can run the following:

```rust
use binance::spot;
use binance::derivatives::umfutures;
use std::env;
use std::time::{SystemTime, UNIX_EPOCH};

async fn test_spot() {
    let auth = spot::BinanceAuth::new_with_private_key_path(
        env::var("BINANCE_API_KEY").unwrap().as_str(),
        "/path/to/your/private/key.pem",
        None
    ).unwrap();
    
    let mut config = spot::Configuration::new();
    config.binance_auth = Some(auth);

    match spot::account_api::spot_get_account_v3(
        &config,
        spot::account_api::SpotGetAccountV3Params {
            timestamp: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as i64,
            ..Default::default()
        }
    ).await {
        Ok(response) => {
            println!("Spot account information:");
            println!("{:#?}", response);
        }
        Err(e) => {
            println!("Error calling spot_get_account_v3: {:?}", e);
        }
    }
}

async fn test_umfutures() {
    let auth = spot::BinanceAuth::new_with_secret_key(
        env::var("BINANCE_API_KEY").unwrap().as_str(),
        env::var("BINANCE_SECRET_KEY").unwrap().as_str()
    ).unwrap();
    
    let mut config = umfutures::Configuration::new();
    config.binance_auth = Some(auth);

    match umfutures::market_data_api::umfutures_get_klines_v1(
        &config,
        umfutures::market_data_api::UmfuturesGetKlinesV1Params {
            symbol: "BTCUSDT".to_string(),
            interval: "1h".to_string(),
            ..Default::default()
        }
    ).await {
        Ok(response) => {
            println!("UMFutures klines:");
            println!("{:#?}", response);
        }
        Err(e) => {
            println!("Error calling umfutures_get_klines_v1: {:?}", e);
        }
    }
}

fn main() {
    trpl::run(async {
        test_spot().await;
        test_umfutures().await;
    });
}
```

## Supported APIs

| Product | Supported | Module | Documentation |
|---------|:-----------:|--------|---------------|
| Spot || binance::spot | [Spot API]docs/spot/README.md |
| USD-M Futures || binance::derivatives::umfutures | [USD-M Futures API]docs/derivatives/umfutures/README.md |
| COIN-M Futures || binance::derivatives::cmfutures | [COIN-M Futures API]docs/derivatives/cmfutures/README.md |
| Options || binance::derivatives::options | [Options API]docs/derivatives/options/README.md |
| Porfolio Margin || binance::derivatives::pmargin | [Portfolio Margin API]docs/derivatives/pmargin/README.md |
| Porfolio Margin Pro || binance::derivatives::pmarginpro | [Portfolio Margin Pro API]docs/derivatives/pmarginpro/README.md |
| Futures Data || binance.derivatives.futuresdata | [Futures Data API]docs/derivatives/futuresdata/README.md |
| Margin || binance::margin | [Margin API]docs/margin/README.md |
| Algo || binance::algo | [Algo API]docs/algo/README.md |
| Wallet || binance::wallet | [Wallet API]docs/wallet/README.md |
| Copy Trading || binance::copytrading | [Copy Trading API]docs/copytrading/README.md |
| Sub-Account || binance::subaccount | [Sub-Account API]docs/subaccount/README.md |