cointrader.net 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cointrader.net.gemspec +1 -0
- data/lib/cointrader.net/client.rb +2 -0
- data/lib/cointrader.net/client/order.rb +13 -0
- data/lib/cointrader.net/client/request.rb +11 -14
- data/lib/cointrader.net/client/stats.rb +0 -10
- data/lib/cointrader.net/version.rb +1 -1
- data/spec/client_spec.rb +24 -0
- data/spec/fixtures/vcr_cassettes/balance.yml +38 -31
- data/spec/fixtures/vcr_cassettes/limit_buy.yml +64 -0
- data/spec/fixtures/vcr_cassettes/limit_sell.yml +57 -0
- data/spec/fixtures/vcr_cassettes/orders.yml +24 -18
- data/spec/fixtures/vcr_cassettes/stats_24h.yml +17 -7
- data/spec/fixtures/vcr_cassettes/stats_7d.yml +17 -7
- data/spec/fixtures/vcr_cassettes/symbol.yml +17 -7
- data/spec/spec_helper.rb +1 -1
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8575e7c9f0de7154ecdc863dbc3f390bee560167
|
4
|
+
data.tar.gz: 2ad987767fe51b17caa6cf8b74e5b3d26facc962
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76966b48d1d9048caa625bc65a9f00bb2bb045b6ba00cb5e1c71a88c357b17b97856a9a8adebf8b04db5f5d08cf129cbcbff7893d362b17583c66d4193857af6
|
7
|
+
data.tar.gz: fe2b70ccb10511e8c086a80f44ceb506e7d359893a1adf94a1ae57cacc299af5e626b44c3ee462b121151f707cb8266b075a0d2e030ded41419bd989342f2688
|
data/cointrader.net.gemspec
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require_relative 'client/request'
|
2
2
|
require_relative 'client/stats'
|
3
3
|
require_relative 'client/account'
|
4
|
+
require_relative 'client/order'
|
4
5
|
|
5
6
|
module Cointrader
|
6
7
|
class Client
|
7
8
|
include Cointrader::Request
|
8
9
|
include Cointrader::Stats
|
9
10
|
include Cointrader::Account
|
11
|
+
include Cointrader::Order
|
10
12
|
end
|
11
13
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Cointrader
|
2
|
+
module Order
|
3
|
+
def limit_buy params={}
|
4
|
+
params = get_defaults(params)
|
5
|
+
request(:post, "/order/#{params[:currency_pair]}/buy")
|
6
|
+
end
|
7
|
+
|
8
|
+
def limit_sell params={}
|
9
|
+
params = get_defaults(params)
|
10
|
+
request(:post, "/order/#{params[:currency_pair]}/sell")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -12,22 +12,19 @@ module Cointrader
|
|
12
12
|
protected
|
13
13
|
|
14
14
|
def join_params params, *names
|
15
|
-
names.map { |name| params[name] }.compact.join('/')
|
15
|
+
names.map { |name| params[name] }.compact.join('/')
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
response.gsub!(/}}(?!$)/, '},') # Replace bracket with comma not at the end.
|
26
|
-
response.gsub!('},}', '}}') # Remove trailing comma.
|
27
|
-
response.gsub!(/}}$/, '}}}') # Add a bracket at the end.
|
28
|
-
end
|
18
|
+
def get_defaults params
|
19
|
+
params.merge({
|
20
|
+
currency_pair: 'BTCUSD',
|
21
|
+
book: 'all',
|
22
|
+
limit: 20
|
23
|
+
})
|
24
|
+
end
|
29
25
|
|
30
|
-
|
26
|
+
def request(method, path, body={})
|
27
|
+
JSON.parse(hmac_request(method, path, body))
|
31
28
|
end
|
32
29
|
|
33
30
|
def hmac_request method, path, body={}
|
@@ -36,7 +33,7 @@ module Cointrader
|
|
36
33
|
base = Cointrader.configuration.api_url || API_URL
|
37
34
|
url = base + path
|
38
35
|
|
39
|
-
if method == :get
|
36
|
+
if method == :get && !body.empty?
|
40
37
|
url += '?' + URI.encode_www_form(body)
|
41
38
|
else
|
42
39
|
api_key = Cointrader.configuration.api_key
|
@@ -23,15 +23,5 @@ module Cointrader
|
|
23
23
|
path = join_params(params, :currency_pair, :book, :limit)
|
24
24
|
request(:get, "/stats/orders/#{path}")
|
25
25
|
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def get_defaults params
|
30
|
-
params.merge({
|
31
|
-
currency_pair: 'BTCUSD',
|
32
|
-
book: 'all',
|
33
|
-
limit: 20
|
34
|
-
})
|
35
|
-
end
|
36
26
|
end
|
37
27
|
end
|
data/spec/client_spec.rb
CHANGED
@@ -56,4 +56,28 @@ describe Cointrader::Client do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
60
|
+
describe 'order' do
|
61
|
+
describe '#limit_buy' do
|
62
|
+
it 'returns an order' do
|
63
|
+
VCR.use_cassette('limit_buy') do
|
64
|
+
response = subject.limit_buy
|
65
|
+
|
66
|
+
expect_success(response)
|
67
|
+
expect(response['data']['id']).not_to be_nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '#limit_sell' do
|
73
|
+
it 'returns an order' do
|
74
|
+
VCR.use_cassette('limit_sell') do
|
75
|
+
response = subject.limit_sell
|
76
|
+
|
77
|
+
expect_success(response)
|
78
|
+
expect(response['data']['id']).not_to be_nil
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
59
83
|
end
|
@@ -2,10 +2,10 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri: https://private-anon-
|
5
|
+
uri: https://private-anon-e01e290b7-cointrader.apiary-mock.com/api4/account/balance
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"secret":"
|
8
|
+
string: '{"secret":"l33lpBPqrNazDz5bgOpQkaerFtpOBqw8wjLTK3sbEcSK","t":"1432344743245"}'
|
9
9
|
headers:
|
10
10
|
Accept:
|
11
11
|
- "*/*; q=0.5, application/xml"
|
@@ -14,9 +14,9 @@ http_interactions:
|
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
16
|
X-Auth:
|
17
|
-
-
|
17
|
+
- hCkVvzR4Nuc6dbuN0biMFSqMqSfc1f1grhXqoaQAlq1y
|
18
18
|
X-Auth-Hash:
|
19
|
-
-
|
19
|
+
- 21d30bb9d6005490ecfe110946b2ccbd07be749242ecaadc8bbd52c327d67d25
|
20
20
|
Content-Length:
|
21
21
|
- '77'
|
22
22
|
User-Agent:
|
@@ -33,11 +33,17 @@ http_interactions:
|
|
33
33
|
X-Apiary-Ratelimit-Limit:
|
34
34
|
- '120'
|
35
35
|
X-Apiary-Ratelimit-Remaining:
|
36
|
-
- '
|
36
|
+
- '115'
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Methods:
|
40
|
+
- OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT
|
41
|
+
Access-Control-Max-Age:
|
42
|
+
- '10'
|
37
43
|
X-Apiary-Transaction-Id:
|
38
|
-
-
|
44
|
+
- 555fd7f53edda90300f69c0d
|
39
45
|
Date:
|
40
|
-
-
|
46
|
+
- Sat, 23 May 2015 01:29:25 GMT
|
41
47
|
Transfer-Encoding:
|
42
48
|
- chunked
|
43
49
|
Via:
|
@@ -45,30 +51,31 @@ http_interactions:
|
|
45
51
|
body:
|
46
52
|
encoding: UTF-8
|
47
53
|
string: |2-
|
48
|
-
{
|
49
|
-
"success":true,
|
50
|
-
"message":"Account Balances",
|
51
|
-
"data":
|
52
54
|
{
|
53
|
-
|
54
|
-
|
55
|
-
"
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
55
|
+
"success":true,
|
56
|
+
"message":"Account Balances",
|
57
|
+
"data":
|
58
|
+
{
|
59
|
+
"BTC":
|
60
|
+
{
|
61
|
+
"available":"5.26240216",
|
62
|
+
"on_hold":"0.00000000",
|
63
|
+
"total":"5.26240216"
|
64
|
+
},
|
65
|
+
"USD":
|
66
|
+
{
|
67
|
+
"available":"0.35",
|
68
|
+
"on_hold":"0.00",
|
69
|
+
"total":"0.35"
|
70
|
+
},
|
71
|
+
"CAD":
|
72
|
+
{
|
73
|
+
"available":"1.41",
|
74
|
+
"on_hold":"0.00",
|
75
|
+
"total":"1.41"
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
72
79
|
http_version:
|
73
|
-
recorded_at:
|
80
|
+
recorded_at: Sat, 23 May 2015 01:32:23 GMT
|
74
81
|
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,64 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://private-anon-e01e290b7-cointrader.apiary-mock.com/api4/order/BTCUSD/buy
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"secret":"l33lpBPqrNazDz5bgOpQkaerFtpOBqw8wjLTK3sbEcSK","t":"1432344743535"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
X-Auth:
|
17
|
+
- hCkVvzR4Nuc6dbuN0biMFSqMqSfc1f1grhXqoaQAlq1y
|
18
|
+
X-Auth-Hash:
|
19
|
+
- 898a1b605277783216c31b089458e2e0d33b3423bd09cb7f742ee09fc041e30b
|
20
|
+
Content-Length:
|
21
|
+
- '77'
|
22
|
+
User-Agent:
|
23
|
+
- Ruby
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 200
|
27
|
+
message: OK
|
28
|
+
headers:
|
29
|
+
Server:
|
30
|
+
- Cowboy
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
X-Apiary-Ratelimit-Limit:
|
34
|
+
- '120'
|
35
|
+
X-Apiary-Ratelimit-Remaining:
|
36
|
+
- '114'
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Methods:
|
40
|
+
- OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT
|
41
|
+
Access-Control-Max-Age:
|
42
|
+
- '10'
|
43
|
+
X-Apiary-Transaction-Id:
|
44
|
+
- 555fd7f6d00c360300317ef7
|
45
|
+
Date:
|
46
|
+
- Sat, 23 May 2015 01:29:26 GMT
|
47
|
+
Transfer-Encoding:
|
48
|
+
- chunked
|
49
|
+
Via:
|
50
|
+
- 1.1 vegur
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: |-
|
54
|
+
{
|
55
|
+
"success":true,
|
56
|
+
"message":"Buy Order Created",
|
57
|
+
"data":
|
58
|
+
{
|
59
|
+
"id":"2222321"
|
60
|
+
}
|
61
|
+
}
|
62
|
+
http_version:
|
63
|
+
recorded_at: Sat, 23 May 2015 01:32:24 GMT
|
64
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://private-anon-e01e290b7-cointrader.apiary-mock.com/api4/order/BTCUSD/sell
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"secret":"l33lpBPqrNazDz5bgOpQkaerFtpOBqw8wjLTK3sbEcSK","t":"1432344744396"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Type:
|
15
|
+
- application/json
|
16
|
+
X-Auth:
|
17
|
+
- hCkVvzR4Nuc6dbuN0biMFSqMqSfc1f1grhXqoaQAlq1y
|
18
|
+
X-Auth-Hash:
|
19
|
+
- dd528bcedd43c83c6dac7e36d73853dfc8d45ab4145f50e981e0645d4a0d5c79
|
20
|
+
Content-Length:
|
21
|
+
- '77'
|
22
|
+
User-Agent:
|
23
|
+
- Ruby
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 200
|
27
|
+
message: OK
|
28
|
+
headers:
|
29
|
+
Server:
|
30
|
+
- Cowboy
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
X-Apiary-Ratelimit-Limit:
|
34
|
+
- '120'
|
35
|
+
X-Apiary-Ratelimit-Remaining:
|
36
|
+
- '113'
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Methods:
|
40
|
+
- OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT
|
41
|
+
Access-Control-Max-Age:
|
42
|
+
- '10'
|
43
|
+
X-Apiary-Transaction-Id:
|
44
|
+
- 555fd7f63edda90300f69c0e
|
45
|
+
Date:
|
46
|
+
- Sat, 23 May 2015 01:29:26 GMT
|
47
|
+
Transfer-Encoding:
|
48
|
+
- chunked
|
49
|
+
Via:
|
50
|
+
- 1.1 vegur
|
51
|
+
body:
|
52
|
+
encoding: UTF-8
|
53
|
+
string: "{\n \"success\":true,\n \"message\":\"Sell Order Created\",\n
|
54
|
+
\ \"data\":\n {\n \"id\":\"2221132\"\n }\n} "
|
55
|
+
http_version:
|
56
|
+
recorded_at: Sat, 23 May 2015 01:32:24 GMT
|
57
|
+
recorded_with: VCR 2.9.3
|
@@ -2,10 +2,10 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://private-anon-
|
5
|
+
uri: https://private-anon-e01e290b7-cointrader.apiary-mock.com/api4/stats/orders/BTCUSD/all/20
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: "
|
8
|
+
string: '{"secret":"l33lpBPqrNazDz5bgOpQkaerFtpOBqw8wjLTK3sbEcSK","t":"1432344742945"}'
|
9
9
|
headers:
|
10
10
|
Accept:
|
11
11
|
- "*/*; q=0.5, application/xml"
|
@@ -13,8 +13,12 @@ http_interactions:
|
|
13
13
|
- gzip, deflate
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
X-Auth:
|
17
|
+
- hCkVvzR4Nuc6dbuN0biMFSqMqSfc1f1grhXqoaQAlq1y
|
18
|
+
X-Auth-Hash:
|
19
|
+
- 811a6ee04698a68e320e4bd089e1d805de446f2ca15955869095aaa83d7a4a1a
|
16
20
|
Content-Length:
|
17
|
-
- '
|
21
|
+
- '77'
|
18
22
|
User-Agent:
|
19
23
|
- Ruby
|
20
24
|
response:
|
@@ -29,15 +33,15 @@ http_interactions:
|
|
29
33
|
X-Apiary-Ratelimit-Limit:
|
30
34
|
- '120'
|
31
35
|
X-Apiary-Ratelimit-Remaining:
|
32
|
-
- '
|
36
|
+
- '116'
|
33
37
|
Content-Type:
|
34
38
|
- text/html; charset=utf-8
|
35
39
|
Content-Length:
|
36
|
-
- '
|
40
|
+
- '2660'
|
37
41
|
Etag:
|
38
|
-
- W/"
|
42
|
+
- W/"zVuw45vE0DsxkZqn5802FQ=="
|
39
43
|
Date:
|
40
|
-
-
|
44
|
+
- Sat, 23 May 2015 01:29:25 GMT
|
41
45
|
Via:
|
42
46
|
- 1.1 vegur
|
43
47
|
body:
|
@@ -90,17 +94,19 @@ http_interactions:
|
|
90
94
|
cn0vYnV5PC9saT4KICAgICAgICAgICAgICAgICAgPGxpPjxiPlBPU1Q8L2I+
|
91
95
|
IC9hcGk0L29yZGVyL3tjdXJyZW5jeV9wYWlyfS9zZWxsPC9saT4KICAgICAg
|
92
96
|
ICAgICAgICAgICAgPGxpPjxiPlBPU1Q8L2I+IC9hcGk0L29yZGVyL3tjdXJy
|
93
|
-
|
94
|
-
|
97
|
+
ZW5jeV9wYWlyfS9zdGF0dXM8L2xpPgogICAgICAgICAgICAgICAgICA8bGk+
|
98
|
+
PGI+UE9TVDwvYj4gL2FwaTQvb3JkZXIve2N1cnJlbmN5X3BhaXJ9L2xpc3Q8
|
95
99
|
L2xpPgogICAgICAgICAgICAgICAgICA8bGk+PGI+UE9TVDwvYj4gL2FwaTQv
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
100
|
+
b3JkZXIve2N1cnJlbmN5X3BhaXJ9L2NhbmNlbDwvbGk+CiAgICAgICAgICAg
|
101
|
+
ICAgICAgIDxsaT48Yj5QT1NUPC9iPiAvYXBpNC9vcmRlci97Y3VycmVuY3lf
|
102
|
+
cGFpcn0vY2FuY2VsYWxsPC9saT4KICAgICAgICAgICAgICAgICAgPGxpPjxi
|
103
|
+
PlBPU1Q8L2I+IC9hcGk0L29yZGVyL3tjdXJyZW5jeV9wYWlyfS9tYXJrZXRi
|
104
|
+
dXk8L2xpPgogICAgICAgICAgICAgICAgICA8bGk+PGI+UE9TVDwvYj4gL2Fw
|
105
|
+
aTQvb3JkZXIve2N1cnJlbmN5X3BhaXJ9L21hcmtldHNlbGw8L2xpPgogICAg
|
106
|
+
ICAgICAgICAgICAgICA8bGk+PGI+UE9TVDwvYj4gL2FwaTQvYWNjb3VudC90
|
107
|
+
cmFkZWhpc3Rvcnkve2N1cnJlbmN5X3BhaXJ9PC9saT4KICAgICAgICAgICAg
|
108
|
+
ICA8L3NlY3Rpb24+CiAgICAgIDwvb2w+CiAgPC9kaXY+CjwvYm9keT4KPC9o
|
109
|
+
dG1sPgo=
|
104
110
|
http_version:
|
105
|
-
recorded_at:
|
111
|
+
recorded_at: Sat, 23 May 2015 01:32:23 GMT
|
106
112
|
recorded_with: VCR 2.9.3
|
@@ -2,10 +2,10 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://private-anon-
|
5
|
+
uri: https://private-anon-e01e290b7-cointrader.apiary-mock.com/api4/stats/daily/BTCUSD
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: "
|
8
|
+
string: '{"secret":"l33lpBPqrNazDz5bgOpQkaerFtpOBqw8wjLTK3sbEcSK","t":"1432344742275"}'
|
9
9
|
headers:
|
10
10
|
Accept:
|
11
11
|
- "*/*; q=0.5, application/xml"
|
@@ -13,8 +13,12 @@ http_interactions:
|
|
13
13
|
- gzip, deflate
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
X-Auth:
|
17
|
+
- hCkVvzR4Nuc6dbuN0biMFSqMqSfc1f1grhXqoaQAlq1y
|
18
|
+
X-Auth-Hash:
|
19
|
+
- 73d263f1ab089f5a8320103593bb0d6fa41b3e75b094fd4fe26454d65156d074
|
16
20
|
Content-Length:
|
17
|
-
- '
|
21
|
+
- '77'
|
18
22
|
User-Agent:
|
19
23
|
- Ruby
|
20
24
|
response:
|
@@ -29,11 +33,17 @@ http_interactions:
|
|
29
33
|
X-Apiary-Ratelimit-Limit:
|
30
34
|
- '120'
|
31
35
|
X-Apiary-Ratelimit-Remaining:
|
32
|
-
- '
|
36
|
+
- '118'
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Methods:
|
40
|
+
- OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT
|
41
|
+
Access-Control-Max-Age:
|
42
|
+
- '10'
|
33
43
|
X-Apiary-Transaction-Id:
|
34
|
-
-
|
44
|
+
- 555fd7f4759c2d0300169fa8
|
35
45
|
Date:
|
36
|
-
-
|
46
|
+
- Sat, 23 May 2015 01:29:24 GMT
|
37
47
|
Transfer-Encoding:
|
38
48
|
- chunked
|
39
49
|
Via:
|
@@ -59,5 +69,5 @@ http_interactions:
|
|
59
69
|
}
|
60
70
|
}
|
61
71
|
http_version:
|
62
|
-
recorded_at:
|
72
|
+
recorded_at: Sat, 23 May 2015 01:32:22 GMT
|
63
73
|
recorded_with: VCR 2.9.3
|
@@ -2,10 +2,10 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://private-anon-
|
5
|
+
uri: https://private-anon-e01e290b7-cointrader.apiary-mock.com/api4/stats/weekly/BTCUSD
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: "
|
8
|
+
string: '{"secret":"l33lpBPqrNazDz5bgOpQkaerFtpOBqw8wjLTK3sbEcSK","t":"1432344742653"}'
|
9
9
|
headers:
|
10
10
|
Accept:
|
11
11
|
- "*/*; q=0.5, application/xml"
|
@@ -13,8 +13,12 @@ http_interactions:
|
|
13
13
|
- gzip, deflate
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
X-Auth:
|
17
|
+
- hCkVvzR4Nuc6dbuN0biMFSqMqSfc1f1grhXqoaQAlq1y
|
18
|
+
X-Auth-Hash:
|
19
|
+
- 5a17dd87ba728e522fbabb8852657de00f50da63b74c5e886611baf3e71affa4
|
16
20
|
Content-Length:
|
17
|
-
- '
|
21
|
+
- '77'
|
18
22
|
User-Agent:
|
19
23
|
- Ruby
|
20
24
|
response:
|
@@ -29,11 +33,17 @@ http_interactions:
|
|
29
33
|
X-Apiary-Ratelimit-Limit:
|
30
34
|
- '120'
|
31
35
|
X-Apiary-Ratelimit-Remaining:
|
32
|
-
- '
|
36
|
+
- '117'
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Methods:
|
40
|
+
- OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT
|
41
|
+
Access-Control-Max-Age:
|
42
|
+
- '10'
|
33
43
|
X-Apiary-Transaction-Id:
|
34
|
-
-
|
44
|
+
- 555fd7f5759c2d0300169fa9
|
35
45
|
Date:
|
36
|
-
-
|
46
|
+
- Sat, 23 May 2015 01:29:25 GMT
|
37
47
|
Transfer-Encoding:
|
38
48
|
- chunked
|
39
49
|
Via:
|
@@ -59,5 +69,5 @@ http_interactions:
|
|
59
69
|
}
|
60
70
|
}
|
61
71
|
http_version:
|
62
|
-
recorded_at:
|
72
|
+
recorded_at: Sat, 23 May 2015 01:32:22 GMT
|
63
73
|
recorded_with: VCR 2.9.3
|
@@ -2,10 +2,10 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://private-anon-
|
5
|
+
uri: https://private-anon-e01e290b7-cointrader.apiary-mock.com/api4/stats/symbol
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: "
|
8
|
+
string: '{"secret":"l33lpBPqrNazDz5bgOpQkaerFtpOBqw8wjLTK3sbEcSK","t":"1432344741868"}'
|
9
9
|
headers:
|
10
10
|
Accept:
|
11
11
|
- "*/*; q=0.5, application/xml"
|
@@ -13,8 +13,12 @@ http_interactions:
|
|
13
13
|
- gzip, deflate
|
14
14
|
Content-Type:
|
15
15
|
- application/json
|
16
|
+
X-Auth:
|
17
|
+
- hCkVvzR4Nuc6dbuN0biMFSqMqSfc1f1grhXqoaQAlq1y
|
18
|
+
X-Auth-Hash:
|
19
|
+
- 46469148812ab7616fb7673e874366a5232033f96ceb456ad7109aab271812b8
|
16
20
|
Content-Length:
|
17
|
-
- '
|
21
|
+
- '77'
|
18
22
|
User-Agent:
|
19
23
|
- Ruby
|
20
24
|
response:
|
@@ -29,11 +33,17 @@ http_interactions:
|
|
29
33
|
X-Apiary-Ratelimit-Limit:
|
30
34
|
- '120'
|
31
35
|
X-Apiary-Ratelimit-Remaining:
|
32
|
-
- '
|
36
|
+
- '119'
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Allow-Methods:
|
40
|
+
- OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT
|
41
|
+
Access-Control-Max-Age:
|
42
|
+
- '10'
|
33
43
|
X-Apiary-Transaction-Id:
|
34
|
-
-
|
44
|
+
- 555fd7f4759c2d0300169fa7
|
35
45
|
Date:
|
36
|
-
-
|
46
|
+
- Sat, 23 May 2015 01:29:24 GMT
|
37
47
|
Transfer-Encoding:
|
38
48
|
- chunked
|
39
49
|
Via:
|
@@ -66,5 +76,5 @@ http_interactions:
|
|
66
76
|
]
|
67
77
|
}
|
68
78
|
http_version:
|
69
|
-
recorded_at:
|
79
|
+
recorded_at: Sat, 23 May 2015 01:32:22 GMT
|
70
80
|
recorded_with: VCR 2.9.3
|
data/spec/spec_helper.rb
CHANGED
@@ -21,5 +21,5 @@ end
|
|
21
21
|
Cointrader.configure do |config|
|
22
22
|
config.api_key = ENV['API_KEY']
|
23
23
|
config.api_secret = ENV['API_SECRET']
|
24
|
-
config.api_url = 'https://private-anon-
|
24
|
+
config.api_url = 'https://private-anon-e01e290b7-cointrader.apiary-mock.com/api4'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cointrader.net
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.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: 2015-
|
11
|
+
date: 2015-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gem-release
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.7'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.7'
|
69
83
|
description: Ruby wrapper for the Cointrader.net API
|
70
84
|
email:
|
71
85
|
- mhluska@gmail.com
|
@@ -82,11 +96,14 @@ files:
|
|
82
96
|
- lib/cointrader.net.rb
|
83
97
|
- lib/cointrader.net/client.rb
|
84
98
|
- lib/cointrader.net/client/account.rb
|
99
|
+
- lib/cointrader.net/client/order.rb
|
85
100
|
- lib/cointrader.net/client/request.rb
|
86
101
|
- lib/cointrader.net/client/stats.rb
|
87
102
|
- lib/cointrader.net/version.rb
|
88
103
|
- spec/client_spec.rb
|
89
104
|
- spec/fixtures/vcr_cassettes/balance.yml
|
105
|
+
- spec/fixtures/vcr_cassettes/limit_buy.yml
|
106
|
+
- spec/fixtures/vcr_cassettes/limit_sell.yml
|
90
107
|
- spec/fixtures/vcr_cassettes/orders.yml
|
91
108
|
- spec/fixtures/vcr_cassettes/stats_24h.yml
|
92
109
|
- spec/fixtures/vcr_cassettes/stats_7d.yml
|
@@ -119,6 +136,8 @@ summary: Cointrader.net API wrapper
|
|
119
136
|
test_files:
|
120
137
|
- spec/client_spec.rb
|
121
138
|
- spec/fixtures/vcr_cassettes/balance.yml
|
139
|
+
- spec/fixtures/vcr_cassettes/limit_buy.yml
|
140
|
+
- spec/fixtures/vcr_cassettes/limit_sell.yml
|
122
141
|
- spec/fixtures/vcr_cassettes/orders.yml
|
123
142
|
- spec/fixtures/vcr_cassettes/stats_24h.yml
|
124
143
|
- spec/fixtures/vcr_cassettes/stats_7d.yml
|