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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c1d6e7f55eb938256c2db85e90376b237434fa4
4
- data.tar.gz: 034341019c46392cea46942b39c239dc83f67758
3
+ metadata.gz: bebf3baecdaf0a950ddb7528d5e9157f1d442079
4
+ data.tar.gz: a05bb332c2b10174df500629b1c6801fbcff7182
5
5
  SHA512:
6
- metadata.gz: f2f76beaa27fde8e6c427b6012f14f522c343eb377c4872a1d62fe84d28d0e1cafbc6d82b5e035a394d732071f633dc9e2cab36e8b68b7dd8a89d58f5dd35237
7
- data.tar.gz: 12b95d4b80bb4792475103ec07c225f5d64d8de0776efddbaf4ff8caaf45102be38517e2d51ea0dd224fac1be57bfac4fee0b44cc2c1034a92f3f5f55c7037c7
6
+ metadata.gz: 572f0b116bd0c2c640f0be6a3129fc6ac9d2828208030bd19b4f80d6365d6598eab7cd350237aef6fb9754fa382cad7b71e28892958455e3a7ef0582401fb475
7
+ data.tar.gz: 55a0653a5c4a4126983eb9245c544c1c54f261ace80b38d99953c74548262a5b97da2d3f189eb832d65dc6d1e24393290f594a91de5320ec172605dc8042641d
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Yuji Ueki
3
+ Copyright (c) 2018 Park Jiin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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
- # def withdraw(currency_code: 'KRW', bank_account_id: nil, amount: nil, code: nil)
34
- # body = {
35
- # currency_code: currency_code,
36
- # bank_account_id: bank_account_id,
37
- # amount: amount,
38
- # code: code
39
- # }.delete_if { |_, v| v.nil? }
40
- # @connection.post('/v1/me/withdraw', body).body
41
- # end
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
- # def send_child_order(product_code: 'BTC_JPY', child_order_type: nil, side: nil, price: nil, size: nil, minute_to_expire: nil, time_in_force: 'GTC')
48
- # body = {
49
- # product_code: product_code,
50
- # child_order_type: child_order_type,
51
- # side: side,
52
- # price: price,
53
- # size: size,
54
- # minute_to_expire: minute_to_expire,
55
- # time_in_force: time_in_force
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
- # def parent_order(parent_order_id: nil, parent_order_acceptance_id: nil)
116
- # query = {
117
- # parent_order_id: parent_order_id,
118
- # parent_order_acceptance_id: parent_order_acceptance_id
119
- # }.delete_if { |_, v| v.nil? }
120
- # @connection.get('/v1/me/getparentorder', query).body
121
- # end
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: 'btc-krw', count: nil, offset: nil, timestamp: nil)
78
+ def trade_completed(currency: nil, count: nil, offset: nil)
124
79
  query = {
125
- currency: currency,
126
- count: count,
127
- offset: offset,
128
- timestamp: timestamp
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.get('/trade/completed', query).body
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: 'btc-krw')
136
- @connection.get('/trade/pending', { currency: currency }).body
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
@@ -1,3 +1,3 @@
1
1
  module CoinRail
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.3'
3
3
  end
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.1
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-01-21 00:00:00.000000000 Z
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.txt
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.0.14.1
138
+ rubygems_version: 2.5.1
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: CoinRail API wrapper