@@ -9,24 +9,27 @@ use zaif_api::public_api::*;
99use zaif_api:: trade_api:: * ;
1010
1111fn main ( ) {
12- let api = CurrenciesBuilder :: new ( ) . name ( "btc" ) . finalize ( ) ;
12+ let api = CurrenciesBuilder :: new ( ) . name ( "btc" . to_string ( ) ) . finalize ( ) ;
1313 println ! ( "{}" , api. exec( ) . unwrap( ) ) ;
1414
1515 let api = CurrencyPairsBuilder :: new ( ) . finalize ( ) ;
1616 println ! ( "{}" , api. exec( ) . unwrap( ) ) ;
1717
18- let api = LastPriceBuilder :: new ( ) . currency_pair ( "btc_jpy" ) . finalize ( ) ;
18+ let api = LastPriceBuilder :: new ( ) . currency_pair ( "btc_jpy" . to_string ( ) ) . finalize ( ) ;
1919 println ! ( "{}" , api. exec( ) . unwrap( ) ) ;
2020
21- let api = DepthBuilder :: new ( ) . currency_pair ( "btc_jpy" ) . finalize ( ) ;
21+ let api = DepthBuilder :: new ( ) . currency_pair ( "btc_jpy" . to_string ( ) ) . finalize ( ) ;
2222 println ! ( "{}" , api. exec( ) . unwrap( ) ) ;
2323
2424 let access_key = AccessKey :: new ( "YOUR_API_KEY" , "YOUR_API_SECRET" ) ;
25- let api = GetInfo2Builder :: new ( access_key. clone ( ) ) . finalize ( ) ;
25+ let api = GetInfo2Builder :: new ( )
26+ . access_key ( access_key. clone ( ) )
27+ . finalize ( ) ;
2628 println ! ( "{}" , api. exec( ) . unwrap( ) ) ;
2729
28- let api = TradeBuilder :: new ( access_key. clone ( ) )
29- . currency_pair ( "zaif_jpy" )
30+ let api = TradeBuilder :: new ( )
31+ . access_key ( access_key. clone ( ) )
32+ . currency_pair ( "zaif_jpy" . to_string ( ) )
3033 . action ( TradeAction :: Bid )
3134 . price ( 1.0 )
3235 . amount ( 0.1 )
@@ -36,9 +39,10 @@ fn main() {
3639 println ! ( "{}" , res) ;
3740 let json: Value = serde_json:: from_str ( res. as_str ( ) ) . unwrap ( ) ;
3841 let order_id = json[ "return" ] [ "order_id" ] . as_u64 ( ) . unwrap ( ) ;
39- let api = CancelOrderBuilder :: new ( access_key. clone ( ) )
42+ let api = CancelOrderBuilder :: new ( )
43+ . access_key ( access_key. clone ( ) )
4044 . order_id ( order_id)
41- . currency_pair ( "zaif_jpy" )
45+ . currency_pair ( Some ( "zaif_jpy" . to_string ( ) ) )
4246 . finalize ( ) ;
4347 let wait_time = time:: Duration :: from_secs ( 5 ) ;
4448 thread:: sleep ( wait_time) ;
@@ -47,8 +51,9 @@ fn main() {
4751 _ => return ,
4852 }
4953
50- let api = ActiveOrdersBuilder :: new ( access_key. clone ( ) )
51- . currency_pair ( "zaif_jpy" )
54+ let api = ActiveOrdersBuilder :: new ( )
55+ . access_key ( access_key. clone ( ) )
56+ . currency_pair ( Some ( "zaif_jpy" . to_string ( ) ) )
5257 . finalize ( ) ;
5358 println ! ( "{}" , api. exec( ) . unwrap( ) ) ;
5459}
0 commit comments