Skip to content

Commit

Permalink
Merge pull request #32 from yajamon/release/v/0.3.0
Browse files Browse the repository at this point in the history
Release/v/0.3.0
  • Loading branch information
yajamon authored Jan 29, 2018
2 parents 8458b0b + 2c8ddf4 commit e3b8abc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zaif-api"
version = "0.2.0"
version = "0.3.0"
authors = ["yajamon <[email protected]>"]

license = "MIT"
Expand Down
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,31 @@ use zaif_api::public_api::*;
use zaif_api::trade_api::*;

fn main() {
let api = public_api::DepthBuilder::new().currency_pair("btc_jpy").finalize();
println!("{}", api.exec().unwrap());
let api = CurrenciesBuilder::new().name("btc".to_string()).finalize();
for currency in api.exec().unwrap() {
println!("name: {} is_token: {}", currency.name, currency.is_token);
}

let access_key = AccessKey::new("YOUR_API_KEY", "YOUR_API_SECRET");

let api = TradeBuilder::new(access_key.clone())
.currency_pair("zaif_jpy")
let api = TradeBuilder::new()
.access_key(access_key.clone())
.currency_pair("zaif_jpy".to_string())
.action(TradeAction::Bid)
.price(1.0)
.amount(0.1)
.finalize();
println!("{}", api.exec().unwrap());
let _ = api.exec().and_then(|res| {
println!(
"received: {}, remains: {}, order_id: {}",
res.received,
res.remains,
res.order_id
);
if res.order_id == 0 {
panic!("Complete trade.");
}
Ok(res.order_id)
});
}
```

0 comments on commit e3b8abc

Please sign in to comment.