kublai 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a69a7cc814a4e8e4006e19be8c3886b769f14e0b
4
- data.tar.gz: 660915f65724a1c7ef67285f6b17cc1ad08a274f
3
+ metadata.gz: c86cea2ada4ea23f7aaa08883ba8891a452094ca
4
+ data.tar.gz: 3f4dd6080c1456242462b92ce9c840e07b478dbd
5
5
  SHA512:
6
- metadata.gz: 1862bd0d5cf727f543acd2b352e26e4e6b06d680e8b90878f4c452cd904b40d598605104ca733395ef34a9e250d37542978625fecef04700595ebb19811799ab
7
- data.tar.gz: 4c2e3d34fa60022be5eda104a56fe3f174efdcba50cbdefbbb1ccea78356ce28ab821a2902087471d93b080112dafc83b6568c6c1cdeaff4787f99fa7420c879
6
+ metadata.gz: 266100866e768828ec1be0b73a5342ad2c85d325da236f1ea515a5d06e9c6d939fcdfe5220740804ba6e36017d8bb4bd787180773b7872b1e7d7638c96089b4f
7
+ data.tar.gz: d2837f49f6a0d4607bd21291f25a7d6144e94464bc721eb24b8d6bcd0d76e7759c43edf471f8da9d8523bc0c859e8db04f8aa1c20353522f5b78132dec578e9d
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  Kublai - BTCChina API Wrapper
2
2
  ======
3
+ [![Gem Version](https://badge.fury.io/rb/kublai.png)](http://badge.fury.io/rb/kublai)
3
4
 
4
5
  What
5
6
  ==========
@@ -11,7 +12,7 @@ JSON Request
11
12
  {"method":"requestWithdrawal","params":["BTC",0.1],"id":1}
12
13
 
13
14
  def request_withdrawal(amount)
14
- amount = amount.to_f.round(8)
15
+ amount = cut_off(amount, 8)
15
16
  post_data = initial_post_data
16
17
  post_data['method']='requestWithdrawal'
17
18
  post_data['params']=['BTC', amount]
@@ -39,25 +40,25 @@ Or install it yourself as:
39
40
  $ gem install kublai
40
41
 
41
42
  ## Usage
43
+ ```
44
+ access_key = "20c0bc14-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
45
+ secret_key = "66d218e5-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
46
+ kublai = Kublai::BTCChina.new(access_key, secret_key )
42
47
 
43
- access_key = "20c0bc14-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
44
- secret_key = "66d218e5-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
45
- kublai = Kublai::BTCChina.new(access_key, secret_key )
48
+ kublai.ticker
49
+ => {"high"=>"5999.00", "low"=>"3821.13", "buy"=>"4978.96", "sell"=>"4990.00", "last"=>"4978.96", "vol"=>"149135.77100000"}
46
50
 
47
- kublai.ticker
48
- => {"high"=>"5999.00", "low"=>"3821.13", "buy"=>"4978.96", "sell"=>"4990.00", "last"=>"4978.96", "vol"=>"149135.77100000"}
51
+ kublai.current_price
52
+ => 4855.995
49
53
 
50
- kublai.current_price
51
- => 4855.995
52
-
53
- kublai.buy(4856, 6)
54
- Error Code: -32003
55
- Error Message: Insufficient CNY balance
56
- => false
57
-
58
- kublai.buy(4856, 1.001339102)
59
- => true
54
+ kublai.buy(4856, 6)
55
+ Error Code: -32003
56
+ Error Message: Insufficient CNY balance
57
+ => false
60
58
 
59
+ kublai.buy(4856, 1.001339102)
60
+ => true
61
+ ```
61
62
 
62
63
  ## Contributing
63
64
 
data/lib/kublai.rb CHANGED
@@ -35,7 +35,7 @@ module Kublai
35
35
 
36
36
  def buy(price, amount)
37
37
  price = cut_off(price, 5)
38
- amount = cut_off(amount, 5)
38
+ amount = cut_off(amount, 8)
39
39
  post_data = initial_post_data
40
40
  post_data['method']='buyOrder'
41
41
  post_data['params']=[price, amount]
@@ -44,7 +44,7 @@ module Kublai
44
44
 
45
45
  def sell(price, amount)
46
46
  price = cut_off(price, 5)
47
- amount = cut_off(amount, 5)
47
+ amount = cut_off(amount, 8)
48
48
  post_data = initial_post_data
49
49
  post_data['method']='sellOrder'
50
50
  post_data['params']=[price, amount]
@@ -1,3 +1,3 @@
1
1
  module Kublai
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kublai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lewis Clayton