ruby_bitbankcc 0.1.1 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/Gemfile +0 -1
- data/README.md +7 -1
- data/lib/ruby_bitbankcc/bitbankcc.rb +50 -6
- data/lib/ruby_bitbankcc/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6baf2878dabf6542abcc44e916e02e75ed8467ac22ff901db933ca4735eff4f9
|
4
|
+
data.tar.gz: 012d545d48de257cf012988d73a9ef422fceda6ba12b324e03937c22ad71bca4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13174e7c7493d2f62a9e3807685c13f1fb6962bb269a23a9ec03047c04635bdda839aa46104209a05e74d68a3d01cab693250984a535511499a45ada1e0ad7fa
|
7
|
+
data.tar.gz: 4ef526834b8fd227dee92a6e77c64b5929048439c64939224fed604112a734bb22c0d96a4d20f972a70344a3f3286bab3e25920d07382b4d0d9013e0a5ee700a
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -30,7 +30,13 @@ bbcc.read_ticker('btc_jpy')
|
|
30
30
|
bbcc.read_order_books('btc_jpy')
|
31
31
|
bbcc.read_balance()
|
32
32
|
bbcc.read_active_orders('btc_jpy')
|
33
|
-
|
33
|
+
# you can omit last post_only (omit means false)
|
34
|
+
bbcc.create_order('btc_jpy', "0.001", 130000, 'buy', 'limit', false)
|
35
|
+
# you can omit last trigger_price (omit means nil)
|
36
|
+
bbcc.create_order('btc_jpy', "0.001", 130000, 'buy', 'stop_limit', false, 140000)
|
34
37
|
bbcc.cancel_order('btc_jpy', order_id)
|
38
|
+
bbcc.read_trade_history('btc_jpy')
|
39
|
+
bbcc.read_withdrawal_account('btc')
|
40
|
+
bbcc.request_withdrawal('btc', 'ACCOUNT UUID', '0.001', 'OTP TOKEN', 'SMS TOKEN')
|
35
41
|
JSON.parse(response.body)
|
36
42
|
```
|
@@ -12,7 +12,7 @@ class Bitbankcc
|
|
12
12
|
@@base_public_url = "https://public.bitbank.cc"
|
13
13
|
@@ssl = true
|
14
14
|
|
15
|
-
def initialize(key, secret, params = {})
|
15
|
+
def initialize(key = nil, secret = nil, params = {})
|
16
16
|
@key = key
|
17
17
|
@secret = secret
|
18
18
|
if !params[:base_url].nil?
|
@@ -29,7 +29,6 @@ class Bitbankcc
|
|
29
29
|
request_for_get(path, nonce)
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
32
|
def read_active_orders(pair, count = nil, from_id = nil, end_id = nil, since = nil, _end = nil)
|
34
33
|
path = "/v1/user/spot/active_orders"
|
35
34
|
nonce = Time.now.to_i.to_s
|
@@ -44,7 +43,7 @@ class Bitbankcc
|
|
44
43
|
request_for_get(path, nonce, params)
|
45
44
|
end
|
46
45
|
|
47
|
-
def create_order(pair, amount, price, side, type)
|
46
|
+
def create_order(pair, amount, price, side, type, post_only = false, trigger_price = nil)
|
48
47
|
path = "/v1/user/spot/order"
|
49
48
|
nonce = Time.now.to_i.to_s
|
50
49
|
body = {
|
@@ -52,7 +51,9 @@ class Bitbankcc
|
|
52
51
|
amount: amount,
|
53
52
|
price: price,
|
54
53
|
side: side,
|
55
|
-
type: type
|
54
|
+
type: type,
|
55
|
+
post_only: post_only,
|
56
|
+
trigger_price: trigger_price
|
56
57
|
}.to_json
|
57
58
|
request_for_post(path, nonce, body)
|
58
59
|
end
|
@@ -67,6 +68,44 @@ class Bitbankcc
|
|
67
68
|
request_for_post(path, nonce, body)
|
68
69
|
end
|
69
70
|
|
71
|
+
def read_trade_history(pair, count = nil, order_id = nil, since = nil, _end = nil, order = nil)
|
72
|
+
path = "/v1/user/spot/trade_history"
|
73
|
+
nonce = Time.now.to_i.to_s
|
74
|
+
params = {
|
75
|
+
pair: pair,
|
76
|
+
count: count,
|
77
|
+
order_id: order_id,
|
78
|
+
since: since,
|
79
|
+
end: _end,
|
80
|
+
order: order
|
81
|
+
}.compact
|
82
|
+
|
83
|
+
request_for_get(path, nonce, params)
|
84
|
+
end
|
85
|
+
|
86
|
+
def read_withdrawal_account(asset)
|
87
|
+
path = "/v1/user/withdrawal_account"
|
88
|
+
nonce = Time.now.to_i.to_s
|
89
|
+
params = {
|
90
|
+
asset: asset
|
91
|
+
}.compact
|
92
|
+
|
93
|
+
request_for_get(path, nonce, params)
|
94
|
+
end
|
95
|
+
|
96
|
+
def request_withdrawal(asset, uuid, amount, otp_token = nil, sms_token = nil)
|
97
|
+
path = "/v1/user/request_withdrawal"
|
98
|
+
nonce = Time.now.to_i.to_s
|
99
|
+
body = {
|
100
|
+
asset: asset,
|
101
|
+
uuid: uuid,
|
102
|
+
amount: amount,
|
103
|
+
otp_token: otp_token,
|
104
|
+
sms_token: sms_token
|
105
|
+
}.compact.to_json
|
106
|
+
request_for_post(path, nonce, body)
|
107
|
+
end
|
108
|
+
|
70
109
|
def read_ticker(pair)
|
71
110
|
RestClient.get @@base_public_url + "/#{pair}/ticker"
|
72
111
|
end
|
@@ -82,11 +121,16 @@ class Bitbankcc
|
|
82
121
|
private
|
83
122
|
def http_request(uri, request)
|
84
123
|
https = Net::HTTP.new(uri.host, uri.port)
|
85
|
-
|
86
|
-
|
124
|
+
|
125
|
+
if @@ssl
|
126
|
+
https.use_ssl = true
|
127
|
+
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
128
|
+
end
|
129
|
+
|
87
130
|
response = https.start do |h|
|
88
131
|
h.request(request)
|
89
132
|
end
|
133
|
+
# XXX: I think we should JSON.parse it, but it makes backward incompatibility. What do you think, code wanderers?
|
90
134
|
response.body
|
91
135
|
end
|
92
136
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_bitbankcc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bitbankcc
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -116,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
|
120
|
-
rubygems_version: 2.4.5
|
119
|
+
rubygems_version: 3.0.3
|
121
120
|
signing_key:
|
122
121
|
specification_version: 4
|
123
122
|
summary: This is ruby client of bitbankcc api
|