A work-in-progress.
Please read the license. This software is by no means production ready and use of it is at your own risk!
In your Cargo.toml
include:
toml
[dependencies]
luno = "0.1.0"
Documentation can be found here.
Examples of calls can be found in the examples/
directory. Clone this repository and run a specific example, such as get-trades.rs
with:
bash
cargo run --example get-trades
Example with get_trades()
:
```rust use luno::{LunoClient, TradingPair};
fn main() { let key = String::from("LUNOAPIKEY"); let secret = String::from("LUNOAPISECRET");
let client = LunoClient::new(key, secret);
match client.get_trades(TradingPair::XBTZAR) {
Err(e) => eprintln!("{:?}", e),
Ok(result) => {
if let Some(trade) = result.trades {
println!("{:?}", trade);
}
}
}
} ```
Results:
Trade { volume: "0.005686", timestamp: 1561918948454, price: "173001.00", is_buy: false }
Trade { volume: "0.007", timestamp: 1561918942586, price: "173002.00", is_buy: true }
Trade { volume: "0.006936", timestamp: 1561918937500, price: "173002.00", is_buy: true }
Trade { volume: "0.006345", timestamp: 1561918911780, price: "173378.00", is_buy: true }
Trade { volume: "0.0005", timestamp: 1561918878415, price: "173585.00", is_buy: false }
Trade { volume: "0.00577", timestamp: 1561918867525, price: "173590.00", is_buy: false }
...
At the moment, all implemented calls are synchronous and return a Result<T, reqwest::Error>
. We aim to implement async functionality and streams when we are async.