coinnect 0.2.0

A Rust library to connect to various crypto-currencies exchanges.
Documentation

Coinnect

crates.io doc.rs MIT licensed

Coinnect is a Rust library aiming to provide a complete access to REST APIs for various crypto-currencies exchanges (see below for a list of supported exchanges). All methods consume HTTPS api. The purpose of this crate is not to stream data (you should use websocket/FIX in that case).

WARNING: This library is highly experimental at the moment. Please do not invest what you can't afford to loose. This is a personal project, I can not be held responsible for the library malfunction, which can lead to a loss of money.

The project is licensed under the terms of the MIT License.

Exchange support:

Exchange Raw API supported Generic API supported Note
Bitstamp X Not every method are implemented for now.
Kraken X X Generic API supports only Ticker for now.
Poloniex X

Feel free to make a PR to add support to your favorite exchange ;)

Documentation

Usage

Add this to your Cargo.toml:

[dependencies]
coinnect = "0.2"

and this to your crate root:

extern crate coinnect;

For optional parameters, most methods require an empty str ("") if you don't want to specify them.

Since 0.2, you have access to a generic API to communicate across exchanges in the same way. Note that this functionality is under active development, changes constantly and not every Exchange is supported for now. For more info, look at ExchangeApi trait doc.

Example

The example below shows you how to connect to Poloniex

extern crate coinnect;

use coinnect::poloniex::PoloniexApi;

fn main() {
    // We create a PoloniexApi by providing API key/secret
    // You can give an empty str if you only use public methods
    let mut my_api = PoloniexApi::new("api_key", "api_secret");

    // Let's look at the ticker!
    let list_coins = my_api.return_ticker().unwrap();

    for coin in list_coins {
        // please visit Poloniex API documentation to know how the data is returned
        // or look at the coinnect documentation
        let name = coin.0;
        let price = coin.1.as_object().unwrap().get("last").unwrap().as_str().unwrap();

        println!("Coin {} has price : {}", name, price);
    }
}

For more examples, please see examples.

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.

Disclaimer

This SOFTWARE PRODUCT is provided by THE PROVIDER "as is" and "with all faults." THE PROVIDER makes no representations or warranties of any kind concerning the safety, suitability, lack of viruses, inaccuracies, typographical errors, or other harmful components of this SOFTWARE PRODUCT. There are inherent dangers in the use of any software, and you are solely responsible for determining whether this SOFTWARE PRODUCT is compatible with your equipment and other software installed on your equipment. You are also solely responsible for the protection of your equipment and backup of your data, and THE PROVIDER will not be liable for any damages you may suffer in connection with using, modifying, or distributing this SOFTWARE PRODUCT.