ruby_bitbankcc 0.1.1 → 0.1.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 83c5904ec30f3a5760f557ae8ebbe4c534d99e0b
4
- data.tar.gz: 309f554bb0ec6a2cd427559e88294aeea4eee52f
2
+ SHA256:
3
+ metadata.gz: 6baf2878dabf6542abcc44e916e02e75ed8467ac22ff901db933ca4735eff4f9
4
+ data.tar.gz: 012d545d48de257cf012988d73a9ef422fceda6ba12b324e03937c22ad71bca4
5
5
  SHA512:
6
- metadata.gz: 0eb7338654f06af393fc1e4c36ea40f615cf46cdd12fb212ef6aa8e73d776ebd9ad0b853ced2aceb6b1542207f344d01eb49665ad827962e02973fd67c92a48d
7
- data.tar.gz: f106d267a0b69d7ee0b48070ed19cc982618af178a5ea21267cbd921c7d778175a103fc5d397aad114f436e7446138c3848347397eb9fc5f5271338af936857b
6
+ metadata.gz: 13174e7c7493d2f62a9e3807685c13f1fb6962bb269a23a9ec03047c04635bdda839aa46104209a05e74d68a3d01cab693250984a535511499a45ada1e0ad7fa
7
+ data.tar.gz: 4ef526834b8fd227dee92a6e77c64b5929048439c64939224fed604112a734bb22c0d96a4d20f972a70344a3f3286bab3e25920d07382b4d0d9013e0a5ee700a
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  /Gemfile.lock
2
2
  /vendor/bundler
3
3
  /.bundle/*
4
+ /pkg
data/Gemfile CHANGED
@@ -2,6 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in ruby_bitbankcc.gemspec
4
4
  gemspec
5
- gem 'rspec'
6
5
  gem 'activesupport'
7
6
  gem 'rest-client'
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
- bbcc.create_order('btc_jpy', "0.001", 130000, 'buy', 'limit')
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
- https.use_ssl = true
86
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
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
 
@@ -1,3 +1,3 @@
1
1
  module RubyBitbankcc
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.5"
3
3
  end
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.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: 2017-04-24 00:00:00.000000000 Z
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
- rubyforge_project:
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