Skip to content
/ ccxt-rs Public
forked from ccxt/ccxt

Transpilation of the popular ccxt library into Rust

License

Notifications You must be signed in to change notification settings

kizzx2/ccxt-rs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ccxt-rs

A transpilation of the CCXT library into Rust with proper parsing.

This is a proof of concept and work in progress, fetch_balance, fetch_order_book and create_order have been tested to work with Binance.

The rust diredctory has been put into a separate repository for easy inclusion into Cargo.toml, you can use it like this:

ccxt = { git = "https://github.com/kizzx2/ccxt-rs-lib" }

Help wanted

As mentioned above this is a work in progress, if you bump into any issues in your use case please feel free to reach out by creating a GitHub issue and I can help you get up to speed on the code and working on a patch.

Example usage

use ccxt::exchange::{Exchange, Value, normalize};
use ccxt::binance::{Binance, BinanceImpl};

use serde_json::json;

const UNDEFINED: Value = Value::Undefined;

#[tokio::main]
async fn main() {
    let mut b = BinanceImpl::new(Value::Json(json!({
        "apiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    })));
    // b.set_sandbox_mode(true);

    let rv = Binance::fetch_order_book(&mut b, "BTC/USDT".into(), UNDEFINED, UNDEFINED).await;
    println!("{}", normalize(&rv).unwrap());

    let rv = Binance::fetch_balance(&mut b, UNDEFINED).await;
    println!("{}", normalize(&rv).unwrap());

    let rv = Binance::create_order(&mut b, "BTC/USDT".into(), "limit".into(), "buy".into(), 0.001.into(), 16789.2.into(), UNDEFINED).await;
    println!("{}", normalize(&rv).unwrap());
}

About

Transpilation of the popular ccxt library into Rust

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 49.6%
  • JavaScript 17.9%
  • PHP 16.8%
  • Python 15.7%
  • Shell 0.0%
  • Dockerfile 0.0%