quadrigacx 0.12.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +14 -0
- data/README.md +24 -11
- data/Rakefile +1 -1
- data/lib/quadrigacx.rb +1 -0
- data/lib/quadrigacx/client.rb +1 -1
- data/lib/quadrigacx/client/private.rb +41 -26
- data/lib/quadrigacx/client/public.rb +1 -1
- data/lib/quadrigacx/coin.rb +23 -0
- data/lib/quadrigacx/request.rb +7 -4
- data/lib/quadrigacx/version.rb +1 -1
- data/quadrigacx.gemspec +4 -3
- data/spec/client_spec.rb +73 -17
- data/spec/coin_spec.rb +15 -0
- data/spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/{_cancel → _cancel_order}/cancels_an_order.yml +0 -0
- data/spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/{_wallet_address/returns_a_wallet_address.yml → _deposit_address/valid_coin_type/success_in_retrieving_deposit_address_for_valid_coin_type.yml} +2 -1
- data/spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_lookup_order/looks_up_an_order.yml +65 -0
- data/spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_withdraw/{withdraws_bitcoins.yml → valid_coin_type/success_in_withdrawal.yml} +2 -1
- data/spec/spec_helper.rb +5 -4
- metadata +20 -15
- data/LICENSE.txt +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5a81826ca57d6b90285d391b7d25a7f499e0aec57206be2f3c8dace08091773e
|
4
|
+
data.tar.gz: da04524969be081183e4aae55b0102b8e1aee286fdd032cde6b644b6b4a6d50f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0ba56d452f0ce62aed82cc6d300de433c72e542e7b5456c1f24945df0fda3b0d5268ea8e3ffd0f5dc184fdfa02dd09e30ffc3ad4543fa9d2ec6d69319c06d79
|
7
|
+
data.tar.gz: 64ab4f1172d5417086fef4ec9e28c373135ebbce4951aa25c9305405fdc463e1835e3ae6caa185162223878a8e55ac504f62d84ef33480facf9547278cf71ef2
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/quadrigacx.svg)](https://badge.fury.io/rb/quadrigacx)
|
2
|
+
[![Build Status](https://travis-ci.org/mhluska/quadrigacx.svg?branch=master)](https://travis-ci.org/mhluska/quadrigacx)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/f0ec6c87254b1cfafe46/maintainability)](https://codeclimate.com/github/mhluska/quadrigacx/maintainability)
|
4
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/f0ec6c87254b1cfafe46/test_coverage)](https://codeclimate.com/github/mhluska/quadrigacx/test_coverage)
|
5
|
+
|
1
6
|
# Quadrigacx
|
2
7
|
|
3
8
|
Ruby wrapper for the QuadrigaCX API.
|
@@ -101,36 +106,44 @@ Place a market order. Returns JSON describing the order.
|
|
101
106
|
order = client.market_sell(amount: 0.01)
|
102
107
|
```
|
103
108
|
|
104
|
-
#### Cancel
|
109
|
+
#### Cancel Order
|
105
110
|
|
106
111
|
Cancel an order.
|
107
112
|
|
108
113
|
```ruby
|
109
|
-
client.
|
114
|
+
client.cancel_order(id: order.id)
|
110
115
|
```
|
111
116
|
|
112
|
-
####
|
117
|
+
#### Open Orders
|
113
118
|
|
114
|
-
|
119
|
+
Return a JSON list of open orders.
|
115
120
|
|
116
121
|
```ruby
|
117
|
-
response = client.
|
122
|
+
response = client.open_orders
|
118
123
|
```
|
119
124
|
|
120
|
-
####
|
125
|
+
#### Lookup Order
|
121
126
|
|
122
|
-
|
127
|
+
Returns a JSON list of details about 1 or more orders.
|
123
128
|
|
124
129
|
```ruby
|
125
|
-
response = client.
|
130
|
+
response = client.lookup_order(id: order.id)
|
131
|
+
```
|
132
|
+
|
133
|
+
#### Withdraw Coins
|
134
|
+
|
135
|
+
Withdraw coins (i.e., bitcoin).
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
response = client.withdraw(QuadrigaCX::Coin::BITCOIN, amount: 1, address: '1FAs1ywa3pqS6S5mvypXjCtHAzwCkymNUX')
|
126
139
|
```
|
127
140
|
|
128
|
-
####
|
141
|
+
#### Deposit Address
|
129
142
|
|
130
|
-
Return a
|
143
|
+
Return a deposit address (i.e., bitcoin).
|
131
144
|
|
132
145
|
```ruby
|
133
|
-
response = client.
|
146
|
+
response = client.deposit_address(QuadrigaCX::Coin::BITCOIN)
|
134
147
|
```
|
135
148
|
|
136
149
|
#### User Transactions
|
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
|
data/lib/quadrigacx.rb
CHANGED
data/lib/quadrigacx/client.rb
CHANGED
@@ -8,9 +8,9 @@ module QuadrigaCX
|
|
8
8
|
|
9
9
|
# Place a limit buy order. Returns JSON describing the order.
|
10
10
|
#
|
11
|
-
# amount - amount of major currency
|
12
|
-
# price - price to buy at
|
13
|
-
# book - optional, if not specified, will default to btc_cad
|
11
|
+
# amount - amount of major currency.
|
12
|
+
# price - price to buy at.
|
13
|
+
# book - optional, if not specified, will default to btc_cad.
|
14
14
|
def limit_buy params={}
|
15
15
|
raise ConfigurationError.new('No price specified for limit buy') unless params[:price]
|
16
16
|
request(:post, '/buy', params)
|
@@ -18,9 +18,9 @@ module QuadrigaCX
|
|
18
18
|
|
19
19
|
# Place a limit sell order. Returns JSON describing the order.
|
20
20
|
#
|
21
|
-
# amount - amount of major currency
|
22
|
-
# price - price to sell at
|
23
|
-
# book - optional, if not specified, will default to btc_cad
|
21
|
+
# amount - amount of major currency.
|
22
|
+
# price - price to sell at.
|
23
|
+
# book - optional, if not specified, will default to btc_cad.
|
24
24
|
def limit_sell params={}
|
25
25
|
raise ConfigurationError.new('No price specified for limit sell') unless params[:price]
|
26
26
|
request(:post, '/sell', params)
|
@@ -28,53 +28,68 @@ module QuadrigaCX
|
|
28
28
|
|
29
29
|
# Place a market order. Returns JSON describing the order.
|
30
30
|
#
|
31
|
-
# amount - amount of
|
32
|
-
# book - optional, if not specified, will default to btc_cad
|
31
|
+
# amount - amount of major currency to spend.
|
32
|
+
# book - optional, if not specified, will default to btc_cad.
|
33
33
|
def market_buy params={}
|
34
34
|
request(:post, '/buy', params)
|
35
35
|
end
|
36
36
|
|
37
37
|
# Place a market order. Returns JSON describing the order.
|
38
38
|
#
|
39
|
-
# amount - amount of
|
40
|
-
# book - optional, if not specified, will default to btc_cad
|
39
|
+
# amount - amount of major currency to sell.
|
40
|
+
# book - optional, if not specified, will default to btc_cad.
|
41
41
|
def market_sell params={}
|
42
42
|
request(:post, '/sell', params)
|
43
43
|
end
|
44
44
|
|
45
45
|
# Cancel an order.
|
46
46
|
#
|
47
|
-
# id – a 64 characters long hexadecimal string taken from the list of orders
|
48
|
-
def
|
47
|
+
# id – a 64 characters long hexadecimal string taken from the list of orders.
|
48
|
+
def cancel_order params={}
|
49
49
|
request(:post, '/cancel_order', params)
|
50
50
|
end
|
51
51
|
|
52
|
-
# Withdraw bitcoins.
|
53
|
-
#
|
54
|
-
# amount – The amount to withdraw
|
55
|
-
# address – The bitcoin address we will send the amount to
|
56
|
-
def withdraw params={}
|
57
|
-
request(:post, '/bitcoin_withdrawal', params)
|
58
|
-
end
|
59
|
-
|
60
52
|
# Return a JSON list of open orders.
|
61
53
|
#
|
62
|
-
# book - optional, if not specified, will default to btc_cad
|
54
|
+
# book - optional, if not specified, will default to btc_cad.
|
63
55
|
def open_orders params={}
|
64
56
|
request(:post, '/open_orders', params)
|
65
57
|
end
|
66
58
|
|
67
|
-
#
|
68
|
-
|
69
|
-
|
59
|
+
# Returns JSON list of details about 1 or more orders.
|
60
|
+
#
|
61
|
+
# id – a single or array of 64 characters long hexadecimal string taken from the list of orders.
|
62
|
+
def lookup_order params={}
|
63
|
+
request(:post, '/lookup_order', params)
|
70
64
|
end
|
71
65
|
|
66
|
+
# Withdrawal of the specified coin type.
|
67
|
+
#
|
68
|
+
# coin – The coin type
|
69
|
+
# amount – The amount to withdraw.
|
70
|
+
# address – The coin type's address we will send the amount to.
|
71
|
+
def withdraw coin, params={}
|
72
|
+
raise ConfigurationError.new('No coin type specified') unless coin
|
73
|
+
raise ConfigurationError.new('Invalid coin type specified') unless Coin.valid?(coin)
|
74
|
+
request(:post, "/#{coin}_withdrawal", params)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Return a deposit address for specific coin type.
|
78
|
+
#
|
79
|
+
# coin – The coin type
|
80
|
+
def deposit_address coin, params={}
|
81
|
+
raise ConfigurationError.new('No coin type specified') unless coin
|
82
|
+
raise ConfigurationError.new('Invalid coin type specified') unless Coin.valid?(coin)
|
83
|
+
request(:post, "/#{coin}_deposit_address", params)
|
84
|
+
end
|
85
|
+
|
86
|
+
|
72
87
|
# Return a list of user transactions.
|
73
88
|
#
|
74
89
|
# offset - optional, skip that many transactions before beginning to return results. Default: 0.
|
75
|
-
# limit - optional, limit result to that many transactions. Default:
|
90
|
+
# limit - optional, limit result to that many transactions. Default: 50.
|
76
91
|
# sort - optional, sorting by date and time (asc - ascending; desc - descending). Default: desc.
|
77
|
-
# book - optional, if not specified, will default to btc_cad
|
92
|
+
# book - optional, if not specified, will default to btc_cad.
|
78
93
|
def user_transactions params={}
|
79
94
|
request(:post, '/user_transactions', params).each { |t| t.id = t.id.to_s }
|
80
95
|
end
|
@@ -17,7 +17,7 @@ module QuadrigaCX
|
|
17
17
|
|
18
18
|
# Return descending JSON list of recent trades.
|
19
19
|
#
|
20
|
-
# book - optional, book to return orders for (default btc_cad)
|
20
|
+
# book - optional, book to return orders for (default btc_cad).
|
21
21
|
# time - optional, time frame for transaction export ("minute" - 1 minute, "hour" - 1 hour). Default: hour.
|
22
22
|
def transactions params={}
|
23
23
|
request(:get, '/transactions', params)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module QuadrigaCX
|
2
|
+
module Coin
|
3
|
+
BITCOIN = 'bitcoin'
|
4
|
+
BITCOIN_CASH = 'bitcoincash'
|
5
|
+
BITCOIN_GOLD = 'bitcoingold'
|
6
|
+
LITECOIN = 'litecoin'
|
7
|
+
ETHER = 'ether'
|
8
|
+
|
9
|
+
def self.valid? type
|
10
|
+
ALL_COINS.include?(type)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
ALL_COINS = [
|
16
|
+
BITCOIN,
|
17
|
+
BITCOIN_CASH,
|
18
|
+
BITCOIN_GOLD,
|
19
|
+
LITECOIN,
|
20
|
+
ETHER
|
21
|
+
]
|
22
|
+
end
|
23
|
+
end
|
data/lib/quadrigacx/request.rb
CHANGED
@@ -23,10 +23,13 @@ module QuadrigaCX
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def fix_json response
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
# This handles all responses that cannot be parsed as JSON
|
27
|
+
# Usually such responses are a single String of the form "..."; otherwise,
|
28
|
+
# the body is returned as a String
|
29
|
+
response_body = response.body
|
30
|
+
return true if response_body.strip == '"true"'
|
31
|
+
return false if response_body.strip == '"false"'
|
32
|
+
response_body[/"(.*)"/, 1] || response_body
|
30
33
|
end
|
31
34
|
|
32
35
|
def hmac_request http_method, path, body={}
|
data/lib/quadrigacx/version.rb
CHANGED
data/quadrigacx.gemspec
CHANGED
@@ -16,14 +16,15 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
spec.required_ruby_version = '>= 2.0.0'
|
20
21
|
|
21
22
|
spec.add_runtime_dependency 'json', '~> 1.8'
|
22
|
-
spec.add_runtime_dependency 'rest-client', '~>
|
23
|
+
spec.add_runtime_dependency 'rest-client', '~> 2.0.2'
|
23
24
|
|
24
25
|
spec.add_development_dependency 'byebug', '~> 5.0'
|
25
26
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
26
|
-
spec.add_development_dependency 'webmock', '~>
|
27
|
+
spec.add_development_dependency 'webmock', '~> 3.2.0'
|
27
28
|
spec.add_development_dependency 'vcr', '~> 2.9'
|
28
29
|
spec.add_development_dependency 'gem-release', '~> 0.7'
|
29
30
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
data/spec/client_spec.rb
CHANGED
@@ -37,7 +37,7 @@ describe QuadrigaCX::Client, :vcr do
|
|
37
37
|
|
38
38
|
context 'when using the group option' do
|
39
39
|
let!(:order) { safe_limit_buy }
|
40
|
-
after { subject.
|
40
|
+
after { subject.cancel_order(id: order.id) }
|
41
41
|
|
42
42
|
it 'does not group same price orders' do
|
43
43
|
ungrouped_bids = subject.order_book(group: 0).bids
|
@@ -93,7 +93,7 @@ describe QuadrigaCX::Client, :vcr do
|
|
93
93
|
let(:order_cad) { safe_limit_buy }
|
94
94
|
let(:order_usd) { safe_limit_buy(book: :btc_usd) }
|
95
95
|
|
96
|
-
after { subject.
|
96
|
+
after { subject.cancel_order(id: order_cad.id) && subject.cancel_order(id: order_usd.id) }
|
97
97
|
|
98
98
|
it 'places a limit buy order_cad' do
|
99
99
|
expect(order_cad.datetime).not_to be_nil
|
@@ -116,7 +116,7 @@ describe QuadrigaCX::Client, :vcr do
|
|
116
116
|
let(:order_cad) { safe_limit_sell }
|
117
117
|
let(:order_usd) { safe_limit_sell(book: :btc_usd) }
|
118
118
|
|
119
|
-
after { subject.
|
119
|
+
after { subject.cancel_order(id: order_cad.id) && subject.cancel_order(id: order_usd.id) }
|
120
120
|
|
121
121
|
it 'places a limit sell order' do
|
122
122
|
expect(order_cad.datetime).not_to be_nil
|
@@ -157,28 +157,21 @@ describe QuadrigaCX::Client, :vcr do
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
-
describe '#
|
160
|
+
describe '#cancel_order' do
|
161
161
|
let(:order) { safe_limit_buy }
|
162
162
|
|
163
163
|
it 'cancels an order' do
|
164
|
-
response = subject.
|
164
|
+
response = subject.cancel_order(id: order.id)
|
165
165
|
expect(response).to be true
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
169
|
-
describe '#withdraw' do
|
170
|
-
it 'withdraws bitcoins' do
|
171
|
-
response = subject.withdraw(amount: 0.01, address: '1DVLFma28jEgTCUjQ32FUYe12bRzvywAfr')
|
172
|
-
expect(response).to eq('ok')
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
169
|
describe '#open_orders' do
|
177
170
|
let(:open_orders_cad) { subject.open_orders }
|
178
171
|
let(:open_orders_usd) { subject.open_orders(book: :btc_usd) }
|
179
172
|
let!(:orders) { [safe_limit_buy, safe_limit_buy(book: :btc_usd)] }
|
180
173
|
|
181
|
-
after { orders.each { |order| subject.
|
174
|
+
after { orders.each { |order| subject.cancel_order(id: order.id) }}
|
182
175
|
|
183
176
|
it 'lists open orders' do
|
184
177
|
expect(open_orders_cad.first.datetime).not_to be_nil
|
@@ -191,10 +184,73 @@ describe QuadrigaCX::Client, :vcr do
|
|
191
184
|
end
|
192
185
|
end
|
193
186
|
|
194
|
-
describe '#
|
195
|
-
|
196
|
-
|
197
|
-
|
187
|
+
describe '#lookup_order' do
|
188
|
+
let(:lookup_order) { subject.lookup_order(id: '1na3tujn948erx1xlbfu8yw93f8y41vgja5if6zdegvwk8pcked34l48sh1or189') }
|
189
|
+
|
190
|
+
it 'looks up an order' do
|
191
|
+
expect(lookup_order.first.amount).to_not be_nil
|
192
|
+
expect(lookup_order.first.book).to_not be_nil
|
193
|
+
expect(lookup_order.first.created).to_not be_nil
|
194
|
+
expect(lookup_order.first.id).to_not be_nil
|
195
|
+
expect(lookup_order.first.price).to_not be_nil
|
196
|
+
expect(lookup_order.first.status).to_not be_nil
|
197
|
+
expect(lookup_order.first.type).to_not be_nil
|
198
|
+
expect(lookup_order.first.updated).to_not be_nil
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe '#withdraw' do
|
203
|
+
context 'valid coin type' do
|
204
|
+
it 'success in withdrawal' do
|
205
|
+
coin = QuadrigaCX::Coin::BITCOIN
|
206
|
+
response = subject.withdraw(coin, amount: 0.01, address: '1DVLFma28jEgTCUjQ32FUYe12bRzvywAfr')
|
207
|
+
expect(response).to eq('ok')
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
context 'no coin type' do
|
212
|
+
it 'failure in withdrawal' do
|
213
|
+
expect do
|
214
|
+
subject.withdraw(nil, amount: 0.01, address: '1DVLFma28jEgTCUjQ32FUYe12bRzvywAfr')
|
215
|
+
end.to raise_error(QuadrigaCX::ConfigurationError)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
context 'invalid coin type' do
|
220
|
+
it 'failure in withdrawal' do
|
221
|
+
coin = "DummyCoin"
|
222
|
+
expect do
|
223
|
+
subject.withdraw(coin, amount: 0.01, address: '1DVLFma28jEgTCUjQ32FUYe12bRzvywAfr')
|
224
|
+
end.to raise_error(QuadrigaCX::ConfigurationError)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
describe '#deposit_address' do
|
230
|
+
context 'valid coin type' do
|
231
|
+
it 'success in retrieving deposit address for valid coin type' do
|
232
|
+
coin = QuadrigaCX::Coin::BITCOIN
|
233
|
+
response = subject.deposit_address(coin)
|
234
|
+
expect(response.length).to be_between(26, 35)
|
235
|
+
expect(response.class).to eq(String)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
context 'invalid coin type' do
|
240
|
+
it 'failure in retrieving deposit address' do
|
241
|
+
expect do
|
242
|
+
subject.deposit_address(nil)
|
243
|
+
end.to raise_error(QuadrigaCX::ConfigurationError)
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
context 'invalid coin type' do
|
248
|
+
it 'failure in retrieving deposit address' do
|
249
|
+
coin = "DummyCoin"
|
250
|
+
expect do
|
251
|
+
subject.deposit_address(coin)
|
252
|
+
end.to raise_error(QuadrigaCX::ConfigurationError)
|
253
|
+
end
|
198
254
|
end
|
199
255
|
end
|
200
256
|
|
data/spec/coin_spec.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe QuadrigaCX::Coin do
|
4
|
+
describe '#valid?' do
|
5
|
+
it 'returns true for valid coin type' do
|
6
|
+
coin = QuadrigaCX::Coin::BITCOIN
|
7
|
+
expect(described_class.valid?(coin)).to be true
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'returns false for invalid coin type' do
|
11
|
+
coin = 'DummyCoin'
|
12
|
+
expect(described_class.valid?(coin)).to be false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
File without changes
|
data/spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_lookup_order/looks_up_an_order.yml
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.quadrigacx.com/v2/lookup_order
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"id":"1na3tujn948erx1xlbfu8yw93f8y41vgja5if6zdegvwk8pcked34l48sh1or189","key":"0000000000","nonce":"1516498144541","signature":"0000000000000000000000000000000000000000000000000000000000000000"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- rest-client/2.0.2 (darwin15.6.0 x86_64) ruby/2.3.1p112
|
16
|
+
Content-Type:
|
17
|
+
- application/json
|
18
|
+
Content-Length:
|
19
|
+
- '195'
|
20
|
+
Host:
|
21
|
+
- api.quadrigacx.com
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Date:
|
28
|
+
- Sun, 21 Jan 2018 01:29:05 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- '179'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Set-Cookie:
|
36
|
+
- __cfduid=d14a9326a9d2dd89098e08c9a00f3ed931516498144; expires=Mon, 21-Jan-19
|
37
|
+
01:29:04 GMT; path=/; domain=.quadrigacx.com; HttpOnly
|
38
|
+
Access-Control-Allow-Origin:
|
39
|
+
- "*"
|
40
|
+
Content-Encoding:
|
41
|
+
- gzip
|
42
|
+
Vary:
|
43
|
+
- Accept-Encoding
|
44
|
+
X-Content-Type-Options:
|
45
|
+
- nosniff
|
46
|
+
X-Frame-Options:
|
47
|
+
- SAMEORIGIN
|
48
|
+
X-Xss-Protection:
|
49
|
+
- 1; mode=block
|
50
|
+
Expect-Ct:
|
51
|
+
- max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
|
52
|
+
Server:
|
53
|
+
- cloudflare
|
54
|
+
Cf-Ray:
|
55
|
+
- 3e06801d1f475296-MIA
|
56
|
+
body:
|
57
|
+
encoding: ASCII-8BIT
|
58
|
+
string: !binary |-
|
59
|
+
H4sIAAAAAAAAA22OSQ7CIBiFr2JY24a/hQpcxRhDgdYOtoRCB413F1y7fN/L
|
60
|
+
G65vJJ9zmDwSCOcYUwwEMDqjep6HyGqv7krqCJQz0hsdWYGBZRiyAp/gIigV
|
61
|
+
v0CXLJhk6UM/ccKM22Ef6yawY+Nlww4Ca9tL2jXVS5t23QZm1WB0SUbClgfM
|
62
|
+
DhiPPdZ1yqQqyinJeUKLlz4saTkKf9hkp8lg9f9LlSAMfW5ffJhrC90AAAA=
|
63
|
+
http_version:
|
64
|
+
recorded_at: Sun, 21 Jan 2018 01:29:05 GMT
|
65
|
+
recorded_with: VCR 2.9.3
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'webmock/rspec'
|
1
2
|
require 'vcr'
|
2
3
|
require 'quadrigacx'
|
3
4
|
|
@@ -6,13 +7,13 @@ RSpec.configure do |config|
|
|
6
7
|
end
|
7
8
|
|
8
9
|
VCR.configure do |config|
|
9
|
-
config.cassette_library_dir =
|
10
|
+
config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
10
11
|
config.hook_into :webmock
|
11
12
|
config.configure_rspec_metadata!
|
12
13
|
end
|
13
14
|
|
14
15
|
QuadrigaCX.configure do |config|
|
15
|
-
config.client_id =
|
16
|
-
config.api_key =
|
17
|
-
config.api_secret =
|
16
|
+
config.client_id = 'client_id'
|
17
|
+
config.api_key = 'api_key'
|
18
|
+
config.api_secret = 'api_secret'
|
18
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quadrigacx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maros Hluska
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.0.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 2.0.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: byebug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 3.2.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 3.2.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: vcr
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,22 +143,25 @@ extensions: []
|
|
143
143
|
extra_rdoc_files: []
|
144
144
|
files:
|
145
145
|
- ".gitignore"
|
146
|
+
- ".travis.yml"
|
146
147
|
- Gemfile
|
147
148
|
- LICENSE
|
148
|
-
- LICENSE.txt
|
149
149
|
- README.md
|
150
150
|
- Rakefile
|
151
151
|
- lib/quadrigacx.rb
|
152
152
|
- lib/quadrigacx/client.rb
|
153
153
|
- lib/quadrigacx/client/private.rb
|
154
154
|
- lib/quadrigacx/client/public.rb
|
155
|
+
- lib/quadrigacx/coin.rb
|
155
156
|
- lib/quadrigacx/error.rb
|
156
157
|
- lib/quadrigacx/request.rb
|
157
158
|
- lib/quadrigacx/version.rb
|
158
159
|
- quadrigacx.gemspec
|
159
160
|
- spec/client_spec.rb
|
161
|
+
- spec/coin_spec.rb
|
160
162
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_balance/returns_all_account_balances.yml
|
161
|
-
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/
|
163
|
+
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_cancel_order/cancels_an_order.yml
|
164
|
+
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_deposit_address/valid_coin_type/success_in_retrieving_deposit_address_for_valid_coin_type.yml
|
162
165
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_buy/errors/throws_an_error_when_exceeding_available_balance.yml
|
163
166
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_buy/errors/throws_an_error_when_exceeding_balance.yml
|
164
167
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_buy/errors/throws_an_error_when_no_price_is_provided.yml
|
@@ -169,6 +172,7 @@ files:
|
|
169
172
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_sell/errors/throws_an_error_when_no_price_is_provided.yml
|
170
173
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_sell/places_a_USD_limit_sell_order.yml
|
171
174
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_sell/places_a_limit_sell_order.yml
|
175
|
+
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_lookup_order/looks_up_an_order.yml
|
172
176
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_market_buy/places_a_USD_market_buy_order.yml
|
173
177
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_market_buy/places_a_market_buy_order.yml
|
174
178
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_market_sell/places_a_USD_market_sell_order.yml
|
@@ -178,8 +182,7 @@ files:
|
|
178
182
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_user_transactions/returns_a_list_of_USD_transactions.yml
|
179
183
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_user_transactions/returns_a_list_of_limited_transactions.yml
|
180
184
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_user_transactions/returns_a_list_of_transactions.yml
|
181
|
-
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/
|
182
|
-
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_withdraw/withdraws_bitcoins.yml
|
185
|
+
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_withdraw/valid_coin_type/success_in_withdrawal.yml
|
183
186
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/public/_order_book/returns_a_USD_order_book.yml
|
184
187
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/public/_order_book/returns_a_list_of_all_open_orders.yml
|
185
188
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/public/_order_book/when_using_the_group_option/does_not_group_same_price_orders.yml
|
@@ -200,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
203
|
requirements:
|
201
204
|
- - ">="
|
202
205
|
- !ruby/object:Gem::Version
|
203
|
-
version:
|
206
|
+
version: 2.0.0
|
204
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
208
|
requirements:
|
206
209
|
- - ">="
|
@@ -208,14 +211,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
211
|
version: '0'
|
209
212
|
requirements: []
|
210
213
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.
|
214
|
+
rubygems_version: 2.7.3
|
212
215
|
signing_key:
|
213
216
|
specification_version: 4
|
214
217
|
summary: QuadrigaCX API wrapper
|
215
218
|
test_files:
|
216
219
|
- spec/client_spec.rb
|
220
|
+
- spec/coin_spec.rb
|
217
221
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_balance/returns_all_account_balances.yml
|
218
|
-
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/
|
222
|
+
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_cancel_order/cancels_an_order.yml
|
223
|
+
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_deposit_address/valid_coin_type/success_in_retrieving_deposit_address_for_valid_coin_type.yml
|
219
224
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_buy/errors/throws_an_error_when_exceeding_available_balance.yml
|
220
225
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_buy/errors/throws_an_error_when_exceeding_balance.yml
|
221
226
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_buy/errors/throws_an_error_when_no_price_is_provided.yml
|
@@ -226,6 +231,7 @@ test_files:
|
|
226
231
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_sell/errors/throws_an_error_when_no_price_is_provided.yml
|
227
232
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_sell/places_a_USD_limit_sell_order.yml
|
228
233
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_limit_sell/places_a_limit_sell_order.yml
|
234
|
+
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_lookup_order/looks_up_an_order.yml
|
229
235
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_market_buy/places_a_USD_market_buy_order.yml
|
230
236
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_market_buy/places_a_market_buy_order.yml
|
231
237
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_market_sell/places_a_USD_market_sell_order.yml
|
@@ -235,8 +241,7 @@ test_files:
|
|
235
241
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_user_transactions/returns_a_list_of_USD_transactions.yml
|
236
242
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_user_transactions/returns_a_list_of_limited_transactions.yml
|
237
243
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_user_transactions/returns_a_list_of_transactions.yml
|
238
|
-
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/
|
239
|
-
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_withdraw/withdraws_bitcoins.yml
|
244
|
+
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/private/_withdraw/valid_coin_type/success_in_withdrawal.yml
|
240
245
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/public/_order_book/returns_a_USD_order_book.yml
|
241
246
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/public/_order_book/returns_a_list_of_all_open_orders.yml
|
242
247
|
- spec/fixtures/vcr_cassettes/QuadrigaCX_Client/public/_order_book/when_using_the_group_option/does_not_group_same_price_orders.yml
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2015 Maros Hluska
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|