coinone 0.3.0 → 0.4.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 +4 -4
- data/CHANGE_LOG.md +9 -0
- data/README.md +68 -5
- data/lib/coinone/account.rb +25 -1
- data/lib/coinone/account/daily_balance.rb +37 -0
- data/lib/coinone/account/daily_balance/balance.rb +39 -0
- data/lib/coinone/account/deposit_address.rb +38 -0
- data/lib/coinone/account/deposit_address/wallet.rb +31 -0
- data/lib/coinone/connection.rb +5 -7
- data/lib/coinone/public/tickers.rb +1 -1
- data/lib/coinone/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0aefd02378e40eca9136bb2fb48c8fa626158810
|
4
|
+
data.tar.gz: 382f3ea145b76062ff485ecfdab7506f1968dff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fea50289bad08e6dd8238547350771d23dc926a9b9aa31d3549bdb5dcba1623883f8c104f23d51f104330bfdf453886469b1bbe0fd20de33b0bfa3a732fa513f
|
7
|
+
data.tar.gz: 25317412c2f0f155366f99c63c32d2b7ae0250f10e773d98a7312a0127f8e89aef818082067e2cb84e10e536739305d7ed62d4d9bbb323a1e6a1ca671ed50204
|
data/CHANGE_LOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## Release History
|
2
2
|
|
3
|
+
* **v0.4.0** - 2017-03-15
|
4
|
+
- Porting `AccountV2 / Daily Balance`
|
5
|
+
- Porting `AccountV2 / Deposit Address`
|
6
|
+
|
7
|
+
* **v0.3.0** - 2017-03-10
|
8
|
+
- Porting `AccountV2 / Balance`
|
9
|
+
- Add Response Struct to README.md file
|
10
|
+
- Remove some duplicate files
|
11
|
+
|
3
12
|
* **v0.2.1** - 2017-03-08
|
4
13
|
- Porting `Public API`
|
5
14
|
- PUBLIC / Currency
|
data/README.md
CHANGED
@@ -71,10 +71,60 @@ user = Coinone::Account.new(access_token: ENV['COINONE_ACCESS_TOKEN'], secret_k
|
|
71
71
|
balance = user.get_balance
|
72
72
|
|
73
73
|
```
|
74
|
+
AttributeName | Class | Description
|
75
|
+
----------- | ------------- | -------------
|
76
|
+
result | String | Request's result
|
77
|
+
btc||BTC information.
|
78
|
+
- avail|BigDecimal|Available BTC.
|
79
|
+
- balance|BigDecimal|Total BTC.
|
80
|
+
eth||ETH information.
|
81
|
+
- avail|BigDecimal|Available ETH.
|
82
|
+
- balance|BigDecimal|Total ETH.
|
83
|
+
etc||ETC information.
|
84
|
+
- avail|BigDecimal|Available ETC.
|
85
|
+
- balance|BigDecimal|Total ETC.
|
86
|
+
normal_wallets|Array|BTC normal wallet information.
|
87
|
+
- balance|BigDecimal|Total BTC.
|
88
|
+
- label|String |Normal Wallet Label.
|
89
|
+
|
74
90
|
|
75
91
|
|
76
92
|
- ACCOUNT V2 / Daily Balance
|
93
|
+
```ruby
|
94
|
+
user = Coinone::Account.new(access_token: ENV['COINONE_ACCESS_TOKEN'], secret_key: ENV['COINONE_SECRET_KEY'])
|
95
|
+
|
96
|
+
daily_balance = user.get_daily_balance
|
97
|
+
|
98
|
+
```
|
99
|
+
AttributeName | Class | Description
|
100
|
+
----------- | ------------- | -------------
|
101
|
+
result | String | Request's result
|
102
|
+
daily_balances|Array|Daily balance's information.
|
103
|
+
- timestamp|Integer|Timestamp
|
104
|
+
- value|Integer|Overall balance's value in KRW.
|
105
|
+
- btc|BigDecimal|BTC balance.
|
106
|
+
- etc|BigDecimal|ETH balance.
|
107
|
+
- etc|BigDecimal|ETC balance.
|
108
|
+
- krw|BigDecimal|KRW balance.
|
109
|
+
-
|
77
110
|
- ACCOUNT V2 / Deposit Address
|
111
|
+
```ruby
|
112
|
+
user = Coinone::Account.new(access_token: ENV['COINONE_ACCESS_TOKEN'], secret_key: ENV['COINONE_SECRET_KEY'])
|
113
|
+
|
114
|
+
deposit_address = user.get_deposit_address
|
115
|
+
|
116
|
+
```
|
117
|
+
|
118
|
+
AttributeName | Class | Description
|
119
|
+
----------- | ------------- | -------------
|
120
|
+
result | String | Request's result
|
121
|
+
btc||BTC information.
|
122
|
+
- address|String|BTC wallet address.
|
123
|
+
eth||ETH information.
|
124
|
+
- address|String|ETH wallet address.
|
125
|
+
etc||ETC information.
|
126
|
+
- address|String|ETC wallet address.
|
127
|
+
|
78
128
|
- ACCOUNT V2 / Virtual Account
|
79
129
|
|
80
130
|
#### OAUTH
|
@@ -156,7 +206,7 @@ etc_day_complete_orders = Coinone::Public.get_complete_orders(currency: "etc",
|
|
156
206
|
AttributeName | Class | Description
|
157
207
|
----------- | ------------- | -------------
|
158
208
|
result | String | Request's result
|
159
|
-
|
209
|
+
orders |Array|Recent complete orders.
|
160
210
|
- price|Integer|Ask KRW price.
|
161
211
|
- qty|Float|BTC(or ETH, ETC) quantity.
|
162
212
|
- timestamp|Integer|Timestamp.
|
@@ -178,6 +228,19 @@ etc_ticker = Coinone::Public.get_ticker(currency: "etc") # ETC Ticker
|
|
178
228
|
all_ticker = Coinone::Public.get_ticker(currency: "all") # ALL Ticker
|
179
229
|
|
180
230
|
```
|
231
|
+
AttributeName | Class | Description
|
232
|
+
----------- | ------------- | -------------
|
233
|
+
result | String | Request's result
|
234
|
+
timestamp|Integer|Timestamp.
|
235
|
+
tickers |Array|Tickers List
|
236
|
+
- high|Integer|Highest price in 24 hours.
|
237
|
+
- low|Integer|Lowest price in 24 hours.
|
238
|
+
- last |Integer|Last completed price.
|
239
|
+
- first |Integer|First price in 24 hours.
|
240
|
+
- volume|Float|BTC volume of completed orders in 24 hours.
|
241
|
+
- currency|String |Currency.
|
242
|
+
|
243
|
+
|
181
244
|
|
182
245
|
#### TRANSACTION V2
|
183
246
|
|
@@ -190,8 +253,8 @@ all_ticker = Coinone::Public.get_ticker(currency: "all") # ALL Ticker
|
|
190
253
|
## ToDo
|
191
254
|
- [x] ACCOUNT V2 / Account Infomation
|
192
255
|
- [x] ACCOUNT V2 / Balance
|
193
|
-
- [
|
194
|
-
- [
|
256
|
+
- [x] ACCOUNT V2 / Daily Balance
|
257
|
+
- [x] ACCOUNT V2 / Deposit Address
|
195
258
|
- [ ] ACCOUNT V2 / Virtual Account
|
196
259
|
|
197
260
|
- [ ] OAUTH / Delete Access Token
|
@@ -224,7 +287,7 @@ The Documentation is at [Coinone Docs](http://doc.coinone.co.kr/)
|
|
224
287
|
|
225
288
|
## Change Log
|
226
289
|
|
227
|
-
Current Version 0.
|
290
|
+
Current Version 0.4.0
|
228
291
|
|
229
292
|
This link listing [Change Log](https://github.com/ggomagundan/coinone/blob/master/CHANGE_LOG.md)
|
230
293
|
|
@@ -249,7 +312,7 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
249
312
|
Welcome to Donation :)
|
250
313
|
|
251
314
|
- Ƀ BTC : 16MdVNJgvGYbVuaC6KrjGNy2RCrNsaPaZz
|
252
|
-
- Ξ ETH :
|
315
|
+
- Ξ ETH : 0xC4347246c9469ca4d740Cd2927d38b5EaB354df8
|
253
316
|
- ETC : 0xc45b10108920b5f20e574bbf021e73d93af5dbc8
|
254
317
|
|
255
318
|
|
data/lib/coinone/account.rb
CHANGED
@@ -1,18 +1,22 @@
|
|
1
1
|
require "coinone/account/account_info"
|
2
2
|
require "coinone/account/balance"
|
3
|
+
require "coinone/account/daily_balance"
|
4
|
+
require "coinone/account/deposit_address"
|
3
5
|
|
4
6
|
module Coinone
|
5
7
|
|
6
8
|
class Account
|
7
9
|
|
8
10
|
attr_reader :connection
|
9
|
-
attr_reader :account_info, :balance
|
11
|
+
attr_reader :account_info, :balance, :daily_balance, :deposit_address
|
10
12
|
|
11
13
|
def initialize(options={}, connection=nil)
|
12
14
|
|
13
15
|
@connection = connection || Connection.factory(options)
|
14
16
|
@account_info = AccountInfo.new()
|
15
17
|
@balance = Balance.new()
|
18
|
+
@daily_balance = DailyBalance.new()
|
19
|
+
@deposit_address = DepositAddress.new()
|
16
20
|
|
17
21
|
end
|
18
22
|
|
@@ -34,6 +38,26 @@ module Coinone
|
|
34
38
|
|
35
39
|
end
|
36
40
|
|
41
|
+
def get_daily_balance(options={})
|
42
|
+
|
43
|
+
response = @connection.post("/v2/account/daily_balance/", options)
|
44
|
+
|
45
|
+
@daily_balance.update_balance(response)
|
46
|
+
@daily_balance
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def get_deposit_address
|
51
|
+
|
52
|
+
response = @connection.post("/v2/account/deposit_address/")
|
53
|
+
|
54
|
+
@deposit_address.update_address(response)
|
55
|
+
@deposit_address
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
|
37
61
|
=begin
|
38
62
|
def security_level
|
39
63
|
return @security_level
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'coinone/account/daily_balance/balance'
|
2
|
+
|
3
|
+
module Coinone
|
4
|
+
|
5
|
+
class Account
|
6
|
+
|
7
|
+
class DailyBalance
|
8
|
+
|
9
|
+
attr_reader :result
|
10
|
+
attr_reader :daily_balances
|
11
|
+
|
12
|
+
def initialize(options={})
|
13
|
+
|
14
|
+
@result = options[:result] || nil
|
15
|
+
@daily_balances = []
|
16
|
+
|
17
|
+
update_balance(options) if options.has_key? :dailyBalance
|
18
|
+
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_balance(params={})
|
23
|
+
|
24
|
+
@result = params[:result] if params.has_key? :result
|
25
|
+
if params.has_key? :dailyBalance
|
26
|
+
@daily_balances.clear
|
27
|
+
params[:dailyBalance].each do |balance|
|
28
|
+
@daily_balances.push(Balance.new(balance))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
|
2
|
+
module Coinone
|
3
|
+
|
4
|
+
class Account
|
5
|
+
|
6
|
+
class DailyBalance
|
7
|
+
class Balance
|
8
|
+
|
9
|
+
attr_reader :timestamp, :value, :btc, :eth, :etc, :krw
|
10
|
+
|
11
|
+
def initialize(options={})
|
12
|
+
|
13
|
+
@timestamp = nil
|
14
|
+
@value = 0
|
15
|
+
@btc = 0
|
16
|
+
@eth = 0
|
17
|
+
@etc = 0
|
18
|
+
@krw = 0
|
19
|
+
|
20
|
+
update_balance(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def update_balance(params={})
|
24
|
+
|
25
|
+
@timestamp= params[:timestamp].to_i if params.has_key? :timestamp
|
26
|
+
@value = params[:value].to_d if params.has_key? :value
|
27
|
+
@btc = params[:btc].to_d if params.has_key? :btc
|
28
|
+
@eth = params[:eth].to_d if params.has_key? :eth
|
29
|
+
@etc = params[:etc].to_d if params.has_key? :etc
|
30
|
+
@krw = params[:krw].to_d if params.has_key? :krw
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'coinone/account/deposit_address/wallet'
|
2
|
+
module Coinone
|
3
|
+
|
4
|
+
class Account
|
5
|
+
|
6
|
+
class DepositAddress
|
7
|
+
|
8
|
+
attr_reader :result
|
9
|
+
attr_reader :btc, :eth, :etc
|
10
|
+
|
11
|
+
def initialize(options={})
|
12
|
+
|
13
|
+
@result = options[:result] || nil
|
14
|
+
@btc = Wallet.new()
|
15
|
+
@eth = Wallet.new()
|
16
|
+
@etc = Wallet.new()
|
17
|
+
|
18
|
+
update_address(options)
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_address(params={})
|
23
|
+
|
24
|
+
@result = params[:result] if params.has_key? :result
|
25
|
+
if params.has_key? :walletAddress
|
26
|
+
address = params[:walletAddress]
|
27
|
+
@btc.update_address(address) if address.has_key? :btc
|
28
|
+
@eth.update_address(address) if address.has_key? :eth
|
29
|
+
@etc.update_address(address) if address.has_key? :etc
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
module Coinone
|
3
|
+
|
4
|
+
class Account
|
5
|
+
|
6
|
+
class DepositAddress
|
7
|
+
class Wallet
|
8
|
+
|
9
|
+
attr_reader :address
|
10
|
+
|
11
|
+
def initialize(options={})
|
12
|
+
|
13
|
+
@address = nil
|
14
|
+
|
15
|
+
update_address(options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def update_address(params={})
|
19
|
+
|
20
|
+
@address = params[:btc] if params.has_key? :btc
|
21
|
+
@address = params[:eth] if params.has_key? :eth
|
22
|
+
@address = params[:etc] if params.has_key? :etc
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/coinone/connection.rb
CHANGED
@@ -46,15 +46,13 @@ module Coinone
|
|
46
46
|
|
47
47
|
def post( connection_uri, params = {} )
|
48
48
|
params[:access_token] = @access_token
|
49
|
-
params[:nonce] = Time.now.to_i
|
49
|
+
params[:nonce] = Time.now.to_i
|
50
50
|
payload = create_coinone_payload(params)
|
51
51
|
signature = create_coinone_signature(payload)
|
52
|
-
|
53
|
-
puts "
|
54
|
-
puts "
|
55
|
-
puts "
|
56
|
-
puts "signature: #{create_coinone_signature(payload)}"
|
57
|
-
=end
|
52
|
+
#puts "Send To : #{connection_uri}"
|
53
|
+
#puts "params: #{params}"
|
54
|
+
#puts "payload: #{payload}"
|
55
|
+
#puts "signature: #{create_coinone_signature(payload)}"
|
58
56
|
|
59
57
|
response = resource[ connection_uri ].post params, {'Content-Type': 'application/json', 'X-COINONE-PAYLOAD': payload, 'X-COINONE-SIGNATURE': signature }
|
60
58
|
|
data/lib/coinone/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coinone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kai Park
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,6 +137,10 @@ files:
|
|
137
137
|
- lib/coinone/account/balance.rb
|
138
138
|
- lib/coinone/account/balance/normal_wallet.rb
|
139
139
|
- lib/coinone/account/balance/wallet.rb
|
140
|
+
- lib/coinone/account/daily_balance.rb
|
141
|
+
- lib/coinone/account/daily_balance/balance.rb
|
142
|
+
- lib/coinone/account/deposit_address.rb
|
143
|
+
- lib/coinone/account/deposit_address/wallet.rb
|
140
144
|
- lib/coinone/connection.rb
|
141
145
|
- lib/coinone/error.rb
|
142
146
|
- lib/coinone/public.rb
|