kublai 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -16
- data/lib/kublai.rb +2 -2
- data/lib/kublai/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c86cea2ada4ea23f7aaa08883ba8891a452094ca
|
4
|
+
data.tar.gz: 3f4dd6080c1456242462b92ce9c840e07b478dbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
[](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
|
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
|
-
|
44
|
-
|
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
|
-
|
48
|
-
|
51
|
+
kublai.current_price
|
52
|
+
=> 4855.995
|
49
53
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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,
|
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,
|
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]
|
data/lib/kublai/version.rb
CHANGED