quadrigacx 0.1.0 → 0.2.0

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
2
  SHA1:
3
- metadata.gz: 7466cb111935394690ea7070e276d56ca2c5e28b
4
- data.tar.gz: e9fe03190ac303a491ec9dce6282b18f444e4397
3
+ metadata.gz: f0b7ec3af2cf03eb0b5c8bf0a4c1a6e3622f4baa
4
+ data.tar.gz: 433c6e60a3c4cabc0bbee89be191c2bef8c29dd3
5
5
  SHA512:
6
- metadata.gz: 1e9443a91170fef6cd62e65a857c67327012a4829d17e95cb71c751c28c1b7fe060ba801bcd9307ff586c5ed919caa0dce3e641c89464891cdf12904b666c542
7
- data.tar.gz: 483529f455a9a96d1d3879dbf3bd5ec1d6bda40119508c010db88377cf61d38fd046a58d2f5568c10d3bf7230afd62a226999da824a83ce9d06cf73724f53515
6
+ metadata.gz: adf8015e44ce0ed3f57adba665584b7f953ea5bbfcebedb3db29405deb3a231654136d74763397495adc3cfb5ea294a54e9f042be6804c3d3ac21e0ad4507a33
7
+ data.tar.gz: 3a345dd6201f4cdf6e534bb0c7d027d7fbb6396f85b977b26df086c1a5a7715e64f588d576d1ebd528afd2e53c33edc70071c07f47f13a2e555fb8b6ad1c749d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quadrigacx (0.0.4)
4
+ quadrigacx (0.1.0)
5
5
  hashie (~> 3.3)
6
6
  json (~> 1.8)
7
7
  rest-client (~> 1.7)
@@ -6,7 +6,7 @@ module QuadrigaCX
6
6
  request(:post, '/balance')
7
7
  end
8
8
 
9
- # Places a limit order. Returns JSON describing the order
9
+ # Places a limit buy order. Returns JSON describing the order
10
10
  #
11
11
  # amount - amount of major currency
12
12
  # price - price to buy at
@@ -16,6 +16,16 @@ module QuadrigaCX
16
16
  request(:post, '/buy', params)
17
17
  end
18
18
 
19
+ # Places a limit sell order. Returns JSON describing the order
20
+ #
21
+ # amount - amount of major currency
22
+ # price - price to sell at
23
+ # book - optional, if not specified, will default to btc_cad
24
+ def limit_sell params={}
25
+ raise ConfigurationError.new('No price specified for limit sell') unless params[:price]
26
+ request(:post, '/sell', params)
27
+ end
28
+
19
29
  # Places a market order. Returns JSON describing the order
20
30
  #
21
31
  # amount - amount of minor currency to spend
@@ -1,5 +1,5 @@
1
1
  module QuadrigaCX
2
2
  unless defined?(QuadrigaCX::VERSION)
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -48,6 +48,21 @@ describe QuadrigaCX::Client do
48
48
  end
49
49
  end
50
50
 
51
+ describe '#limit_sell' do
52
+ it 'throws an error when no price is provided' do
53
+ expect { client.limit_sell }.to raise_error(QuadrigaCX::ConfigurationError)
54
+ end
55
+
56
+ it 'places a limit sell order' do
57
+ VCR.use_cassette('limit_sell') do
58
+ response = client.limit_sell(price: '240', amount: '0.01') # 0.01 BTC
59
+
60
+ expect(response.datetime).not_to be_nil
61
+ expect(response.id).not_to be_nil
62
+ end
63
+ end
64
+ end
65
+
51
66
  describe '#market_buy' do
52
67
  it 'places a market buy order' do
53
68
  VCR.use_cassette('market_buy') do
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.quadrigacx.com/v2/sell
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"price":"240","amount":"0.01","key":"kOnVDjfPPh","nonce":"1421691283730","signature":"25d144ecbe94189688629ecd77b917d58ffdcdc4046172613dcb864b5471840d"}'
9
+ headers:
10
+ Accept:
11
+ - application/json
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ Content-Type:
15
+ - application/json
16
+ Content-Length:
17
+ - '153'
18
+ User-Agent:
19
+ - Ruby
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Server:
26
+ - cloudflare-nginx
27
+ Date:
28
+ - Mon, 19 Jan 2015 18:14:43 GMT
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ Transfer-Encoding:
32
+ - chunked
33
+ Connection:
34
+ - keep-alive
35
+ Set-Cookie:
36
+ - __cfduid=de027c5215a86a12b6e35021f295df4a31421691281; expires=Tue, 19-Jan-16
37
+ 18:14:41 GMT; path=/; domain=.quadrigacx.com; HttpOnly
38
+ - ci_session=CzJTZ1E1UGpUewB%2FBWBTYgNnAT5cfldxWTwMew4sUG4AM1BvUA4LbVtnBipSOAd0BGoLNFA9UmhbLQVhD2xRNQI3BTZWMw8%2BDmVTYFdjXWoLYVNtUTNQNlQyADkFO1NrAzEBMlxoVzpZbQw%2BDmtQYwBtUDdQZQs8W2UGKlI4B3QEags2UD9SaFstBWkPf1FbAmMFZVZjDyoON1NxVyVdcAtoUy5ROlBhVDMANgV4U2IDYAE8XHJXNFlqDCYOblAzAHJQM1BgCzJbIQYzUnAHPQRhCzdQNVJwW3oFcw9qUXYCXQVgVmAPPQ48U3ZXdF1pCyBTZ1E0UGpUIgBeBS9TMQMuASZcZ1dxWWMMOQ5sUD0AflBtUDALd1t3BldSYgdkBCQLblB5UjtbewV5Dy1RPwJrBTtWNg9sDmBTM1dgXWsLYlNvUThQYVQ7AH8FYFNqA20BJlwpV3FZPAx6DgBQYwA9UHVQMAsmWzgGe1I5BzcEagslUC1SaVty;
39
+ expires=Mon, 19-Jan-2015 20:14:41 GMT; Max-Age=7200; path=/
40
+ X-Frame-Options:
41
+ - SAMEORIGIN
42
+ Cf-Ray:
43
+ - 1ab5036b6473052e-YYZ
44
+ Content-Encoding:
45
+ - gzip
46
+ body:
47
+ encoding: ASCII-8BIT
48
+ string: !binary |-
49
+ H4sIAAAAAAAAAxyOQQqDMBQFr1LeOsr/okFzmWKMjdFag/6gUnr3orOdxcwX
50
+ 7bykj8CAcmK6gYJdlgkGVrpn1zoouFZ6CXMPg4K4yogzbh7cGC5NyVAIDga6
51
+ prRJXcRh9FrsYU+ZHPnZpXX4LDodOkY6tviy+l2FcfCukH70q6tr3vs9QSGu
52
+ obsrJeX3yiatpO0ahIKc8ZKM3x8AAP//AwCepF4GugAAAA==
53
+ http_version:
54
+ recorded_at: Mon, 19 Jan 2015 18:14:46 GMT
55
+ recorded_with: VCR 2.9.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quadrigacx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maros Hluska
@@ -133,6 +133,7 @@ files:
133
133
  - spec/fixtures/vcr_cassettes/balance.yml
134
134
  - spec/fixtures/vcr_cassettes/cancel_order.yml
135
135
  - spec/fixtures/vcr_cassettes/limit_buy.yml
136
+ - spec/fixtures/vcr_cassettes/limit_sell.yml
136
137
  - spec/fixtures/vcr_cassettes/market_buy.yml
137
138
  - spec/fixtures/vcr_cassettes/order_book.yml
138
139
  - spec/fixtures/vcr_cassettes/withdraw.yml
@@ -166,6 +167,7 @@ test_files:
166
167
  - spec/fixtures/vcr_cassettes/balance.yml
167
168
  - spec/fixtures/vcr_cassettes/cancel_order.yml
168
169
  - spec/fixtures/vcr_cassettes/limit_buy.yml
170
+ - spec/fixtures/vcr_cassettes/limit_sell.yml
169
171
  - spec/fixtures/vcr_cassettes/market_buy.yml
170
172
  - spec/fixtures/vcr_cassettes/order_book.yml
171
173
  - spec/fixtures/vcr_cassettes/withdraw.yml