coinrail 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{LICENSE.txt → LICENSE} +1 -1
- data/README.md +1 -1
- data/lib/coinrail/http/private.rb +55 -91
- data/lib/coinrail/version.rb +1 -1
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bebf3baecdaf0a950ddb7528d5e9157f1d442079
|
4
|
+
data.tar.gz: a05bb332c2b10174df500629b1c6801fbcff7182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 572f0b116bd0c2c640f0be6a3129fc6ac9d2828208030bd19b4f80d6365d6598eab7cd350237aef6fb9754fa382cad7b71e28892958455e3a7ef0582401fb475
|
7
|
+
data.tar.gz: 55a0653a5c4a4126983eb9245c544c1c54f261ace80b38d99953c74548262a5b97da2d3f189eb832d65dc6d1e24393290f594a91de5320ec172605dc8042641d
|
data/{LICENSE.txt → LICENSE}
RENAMED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# coinrail
|
2
|
-
coinrail is a wrapper interface of [CoinRail API](https://coinrail.co.kr/api/document)
|
2
|
+
coinrail is a wrapper interface of [CoinRail API](https://coinrail.co.kr/api/document). I borrowed original code from bitflyer API and modified for coinrail API.
|
3
3
|
|
4
4
|
## Installation
|
5
5
|
|
@@ -7,6 +7,10 @@ module CoinRail
|
|
7
7
|
@key = key
|
8
8
|
end
|
9
9
|
|
10
|
+
def current_timestamp
|
11
|
+
(Time.now.to_i * 1000)
|
12
|
+
end
|
13
|
+
|
10
14
|
def balance
|
11
15
|
puts @key
|
12
16
|
body = {timestamp: (Time.now.to_i * 1000).to_s,
|
@@ -30,110 +34,70 @@ module CoinRail
|
|
30
34
|
# @connection.get('/v1/me/getdeposits').body
|
31
35
|
# end
|
32
36
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
def wallet_info(currency)
|
38
|
+
body = {access_key: @key,
|
39
|
+
currency: currency,
|
40
|
+
timestamp: current_timestamp}.delete_if { |_, v| v.nil? }
|
41
|
+
@connection.post('/wallet', body).body
|
42
|
+
end
|
43
|
+
|
44
|
+
def withdraw_coin(currency, address, amount)
|
45
|
+
body = {access_key: @key,
|
46
|
+
currency: currency_code,
|
47
|
+
address: address,
|
48
|
+
amount: amount,
|
49
|
+
timestamp: current_timestamp
|
50
|
+
}.delete_if { |_, v| v.nil? }
|
51
|
+
@connection.post('/withdraw', body).body
|
52
|
+
end
|
42
53
|
|
43
54
|
# def withdrawals
|
44
55
|
# @connection.get('/v1/me/getwithdrawals').body
|
45
56
|
# end
|
46
57
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
# }.delete_if { |_, v| v.nil? }
|
57
|
-
# @connection.post('/v1/me/sendchildorder', body).body
|
58
|
-
# end
|
59
|
-
|
60
|
-
# def cancel_child_order(product_code: 'BTC_JPY', child_order_id: nil, child_order_acceptance_id: nil)
|
61
|
-
# body = {
|
62
|
-
# product_code: product_code,
|
63
|
-
# child_order_id: child_order_id,
|
64
|
-
# child_order_acceptance_id: child_order_acceptance_id
|
65
|
-
# }.delete_if { |_, v| v.nil? }
|
66
|
-
# @connection.post('/v1/me/cancelchildorder', body).body
|
67
|
-
# end
|
68
|
-
|
69
|
-
# def send_parent_order(order_method: nil, minute_to_expire: nil, time_in_force: 'GTC', parameters: {})
|
70
|
-
# body = {
|
71
|
-
# order_method: order_method,
|
72
|
-
# minute_to_expire: minute_to_expire,
|
73
|
-
# time_in_force: time_in_force,
|
74
|
-
# parameters: parameters
|
75
|
-
# }.delete_if { |_, v| v.nil? }
|
76
|
-
# @connection.post('/v1/me/sendparentorder', body).body
|
77
|
-
# end
|
78
|
-
|
79
|
-
# def cancel_parent_order(product_code: 'BTC_JPY', parent_order_id: nil, parent_order_acceptance_id: nil)
|
80
|
-
# body = {
|
81
|
-
# product_code: product_code,
|
82
|
-
# parent_order_id: parent_order_id,
|
83
|
-
# parent_order_acceptance_id: parent_order_acceptance_id
|
84
|
-
# }.delete_if { |_, v| v.nil? }
|
85
|
-
# @connection.post('/v1/me/cancelparentorder', body).body
|
86
|
-
# end
|
87
|
-
|
88
|
-
# def cancel_all_child_orders(product_code: 'BTC_JPY')
|
89
|
-
# @connection.post('/v1/me/cancelallchildorders', { product_code: product_code }).body
|
90
|
-
# end
|
91
|
-
|
92
|
-
# def child_orders(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, child_order_state: nil, parent_order_id: nil)
|
93
|
-
# query = {
|
94
|
-
# product_code: product_code,
|
95
|
-
# count: count,
|
96
|
-
# before: before,
|
97
|
-
# after: after,
|
98
|
-
# child_order_state: child_order_state,
|
99
|
-
# parent_order_id: parent_order_id
|
100
|
-
# }.delete_if { |_, v| v.nil? }
|
101
|
-
# @connection.get('/v1/me/getchildorders', query).body
|
102
|
-
# end
|
103
|
-
|
104
|
-
# def parent_orders(product_code: 'BTC_JPY', count: nil, before: nil, after: nil, parent_order_state: nil)
|
105
|
-
# query = {
|
106
|
-
# product_code: product_code,
|
107
|
-
# count: count,
|
108
|
-
# before: before,
|
109
|
-
# after: after,
|
110
|
-
# parent_order_state: parent_order_state
|
111
|
-
# }.delete_if { |_, v| v.nil? }
|
112
|
-
# @connection.get('/v1/me/getparentorders', query).body
|
113
|
-
# end
|
58
|
+
def limit_buy(currency, price, qty)
|
59
|
+
throw "limit_buy: all parameter should not be nil" if currency.nil? or price.nil? or qty.nil?
|
60
|
+
body = {access_key: @key,
|
61
|
+
currency: currency,
|
62
|
+
price: price,
|
63
|
+
qty: qty,
|
64
|
+
timestamp: current_timestamp}
|
65
|
+
@connection.post('/order/limit/buy', body).body
|
66
|
+
end
|
114
67
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
68
|
+
def limit_sell(currency, price, qty)
|
69
|
+
throw "limit_sell: all parameter should not be nil" if currency.nil? or price.nil? or qty.nil?
|
70
|
+
body = {access_key: @key,
|
71
|
+
currency: currency,
|
72
|
+
price: price,
|
73
|
+
qty: qty,
|
74
|
+
timestamp: current_timestamp}
|
75
|
+
@connection.post('/order/limit/sell', body).body
|
76
|
+
end
|
122
77
|
|
123
|
-
def trade_completed(currency:
|
78
|
+
def trade_completed(currency: nil, count: nil, offset: nil)
|
124
79
|
query = {
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
80
|
+
access_key: @key,
|
81
|
+
currency: currency,
|
82
|
+
count: count,
|
83
|
+
offset: offset,
|
84
|
+
timestamp: current_timestamp
|
129
85
|
}.delete_if { |_, v| v.nil? }
|
130
|
-
@connection.
|
86
|
+
@connection.post('/trade/completed', query).body
|
131
87
|
end
|
132
88
|
|
89
|
+
|
133
90
|
alias_method :executions, :trade_completed
|
134
91
|
|
135
|
-
def trade_pending(currency:
|
136
|
-
|
92
|
+
def trade_pending(currency: nil, count: nil, offset: nil)
|
93
|
+
query = {
|
94
|
+
access_key: @key,
|
95
|
+
currency: currency,
|
96
|
+
count: count,
|
97
|
+
offset: offset,
|
98
|
+
timestamp: current_timestamp
|
99
|
+
}.delete_if { |_, v| v.nil? }
|
100
|
+
@connection.post('/trade/pending', query).body
|
137
101
|
end
|
138
102
|
end
|
139
103
|
end
|
data/lib/coinrail/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinrail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Park Jiin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.12.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.12.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday_middleware
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.12.0
|
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
40
|
version: 0.12.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pubnub
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 4.0.22
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.0.22
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.12'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.12'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '10.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
82
|
version: '10.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
97
|
description: CoinRail API wrapper
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- CODE_OF_CONDUCT.md
|
105
105
|
- Gemfile
|
106
106
|
- Gemfile.lock
|
107
|
-
- LICENSE
|
107
|
+
- LICENSE
|
108
108
|
- README.md
|
109
109
|
- Rakefile
|
110
110
|
- coinrail.gemspec
|
@@ -125,17 +125,17 @@ require_paths:
|
|
125
125
|
- lib
|
126
126
|
required_ruby_version: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- -
|
128
|
+
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
|
-
- -
|
133
|
+
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.5.1
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: CoinRail API wrapper
|