Crates.io | les |
lib.rs | les |
version | 0.1.0-alpha.2 |
source | src |
created_at | 2022-12-28 20:01:52.843746 |
updated_at | 2022-12-30 12:37:39.420404 |
description | less is the crate provide binding for crypto network |
homepage | |
repository | https://github.com/crabby-ai/les |
max_upload_size | |
id | 746965 |
size | 148,705 |
An open source Rust high performance cryptocurrency trading API with support for multiple exchanges and language wrappers. written in rust(🦀) with ❤️. This library provides a simple interface for interacting with cryptocurrency exchanges from Rust. It supports a wide range of exchanges and makes it easy to access their APIs and perform common tasks such as getting account balances and placing orders.
To install the library, add the following to your Cargo.toml file:
Copy code
[dependencies]
les = "0.1
You can then use the library in your Rust code by adding the following to your main.rs or lib.rs file:
Copy code
extern crate les;
The following exchanges are currently supported by the library:
Exchange | Available |
---|---|
Binance | ✅ |
Coinbase | ⬜️ |
Bitfinex | ⬜️ |
Kraken | ⬜️ |
More exchanges will be added in future updates.
To use the library, you will need to create an instance of the Exchange struct, passing in the name of the exchange you want to use as a string. You will also need to provide your API key and secret key, which you can obtain from the exchange.
Copy code
let client = Binance::new(BinanceParameters {
credentials: Some(BinanceCredentials {
api_key: env::var("BINANCE_API_KEY").expect("Couldn't get environment variable"),
api_secret: env::var("BINANCE_API_SECRET").expect("Couldn't get environment variable"),
}),
..Default::default()
})
.await
.expect("Failed to create Client")
You can then use the exchange object to call various methods to access the exchange's API. For example, to get the current balance of your account:
Copy code
let params = TradeHistoryReq {
paginator: None,
symbol: String::from("BNBBTC"),
};
let binance_cli = client.inner_client().expect("Couldn't get inner time.");
let args = KlineParams{
symbol: "BNBBTC".to_string(),
interval: "1m".to_string(),
paginator: None,
};
let response = binance_cli.get_klines(&args).await.expect("Couldn't trade history.");
See the documentation for a full list of available methods and their usage.
Full documentation for the library can be found here.
We welcome contributions to the library! If you would like to contribute, please follow these steps:
Please make sure to follow the coding style and conventions used in the rest of the codebase, and make sure to test your changes thoroughly before submitting the pull request.
This library is released under the MIT License. See the LICENSE file for details.
I would like to thank the following individuals and organizations for their contributions to this project: