fixed_ruby_coincheck_client 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.circle.yml +36 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +49 -0
- data/README.md +78 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/examples/private.rb +13 -0
- data/examples/public.rb +8 -0
- data/lib/.DS_Store +0 -0
- data/lib/ruby_coincheck_client/coincheck_client.rb +274 -0
- data/lib/ruby_coincheck_client/currency.rb +46 -0
- data/lib/ruby_coincheck_client/version.rb +3 -0
- data/lib/ruby_coincheck_client.rb +6 -0
- data/ruby_coincheck_client.gemspec +31 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e121a2519fb8067e7b9086ccb2188fe2d4b2e0c0
|
4
|
+
data.tar.gz: 8184891003c3d35eb25575d19d545074907c1aea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 50da80f09600d8bda62ff645ec02ba8e2090c847129ca33703d7d012d0f19eae2645ed59a91464a8942dad9ef66ccf37050a92a3af2d95641de192a67f8f35c0
|
7
|
+
data.tar.gz: e22c45db4673744af692a59a75cff75b43240400354061a8b9cf2d707585c45464f32289cc526d346944e872f3f40f5bc240c9925544dd510fe647b91b28c0f4
|
data/.DS_Store
ADDED
Binary file
|
data/.circle.yml
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
6
|
+
working_directory: ~/repo
|
7
|
+
steps:
|
8
|
+
- checkout
|
9
|
+
- restore_cache:
|
10
|
+
keys:
|
11
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
12
|
+
- v1-dependencies-
|
13
|
+
- run:
|
14
|
+
name: install dependencies
|
15
|
+
command: |
|
16
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
17
|
+
- save_cache:
|
18
|
+
paths:
|
19
|
+
- ./vendor/bundle
|
20
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
21
|
+
- run:
|
22
|
+
name: run tests
|
23
|
+
command: |
|
24
|
+
mkdir /tmp/test-results
|
25
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
26
|
+
|
27
|
+
bundle exec rspec --format progress \
|
28
|
+
--format RspecJunitFormatter \
|
29
|
+
--out /tmp/test-results/rspec.xml \
|
30
|
+
--format progress \
|
31
|
+
"${TEST_FILES}"
|
32
|
+
- store_test_results:
|
33
|
+
path: /tmp/test-results
|
34
|
+
- store_artifacts:
|
35
|
+
path: /tmp/test-results
|
36
|
+
destination: test-results
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ruby_coincheck_client (0.3.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.5.2)
|
10
|
+
public_suffix (>= 2.0.2, < 4.0)
|
11
|
+
crack (0.4.3)
|
12
|
+
safe_yaml (~> 1.0.0)
|
13
|
+
diff-lcs (1.3)
|
14
|
+
dotenv (2.2.1)
|
15
|
+
hashdiff (0.3.7)
|
16
|
+
public_suffix (3.0.1)
|
17
|
+
rake (10.4.2)
|
18
|
+
rspec (3.7.0)
|
19
|
+
rspec-core (~> 3.7.0)
|
20
|
+
rspec-expectations (~> 3.7.0)
|
21
|
+
rspec-mocks (~> 3.7.0)
|
22
|
+
rspec-core (3.7.0)
|
23
|
+
rspec-support (~> 3.7.0)
|
24
|
+
rspec-expectations (3.7.0)
|
25
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
26
|
+
rspec-support (~> 3.7.0)
|
27
|
+
rspec-mocks (3.7.0)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.7.0)
|
30
|
+
rspec-support (3.7.0)
|
31
|
+
safe_yaml (1.0.4)
|
32
|
+
webmock (3.1.1)
|
33
|
+
addressable (>= 2.3.6)
|
34
|
+
crack (>= 0.3.2)
|
35
|
+
hashdiff
|
36
|
+
|
37
|
+
PLATFORMS
|
38
|
+
ruby
|
39
|
+
|
40
|
+
DEPENDENCIES
|
41
|
+
bundler (~> 1.9)
|
42
|
+
dotenv
|
43
|
+
rake (~> 10.0)
|
44
|
+
rspec
|
45
|
+
ruby_coincheck_client!
|
46
|
+
webmock
|
47
|
+
|
48
|
+
BUNDLED WITH
|
49
|
+
1.16.0
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
[![CircleCI](https://circleci.com/gh/coincheckjp/ruby_coincheck_client.svg?style=svg)](https://circleci.com/gh/coincheckjp/ruby_coincheck_client)
|
2
|
+
|
3
|
+
# RubyCoincheckClient
|
4
|
+
|
5
|
+
This is ruby client implementation for Coincheck API.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'ruby_coincheck_client'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ruby_coincheck_client
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
#!/usr/bin/env ruby -Ilib
|
27
|
+
require 'ruby_coincheck_client'
|
28
|
+
|
29
|
+
cc = CoincheckClient.new("YOUR API KEY", "YOUR SECRET KEY")
|
30
|
+
response = cc.read_balance
|
31
|
+
response = cc.read_leverage_balance
|
32
|
+
response = cc.read_accounts
|
33
|
+
response = cc.read_transactions
|
34
|
+
response = cc.read_positions
|
35
|
+
response = cc.read_orders
|
36
|
+
response = cc.read_orders_rate(order_type: 'buy', amount: "0.01")
|
37
|
+
response = cc.create_orders(rate: "40001", amount: "0.01", order_type: "buy")
|
38
|
+
response = cc.create_orders(rate: "50001", amount: "0.001", order_type: "sell")
|
39
|
+
response = cc.create_orders(market_buy_amount: 100, order_type: "market_buy")
|
40
|
+
response = cc.create_orders(amount: "0.001", order_type: "market_sell")
|
41
|
+
response = cc.create_orders(rate: "40000", amount: "0.001", order_type: "leverage_buy")
|
42
|
+
response = cc.create_orders(rate: "60000", amount: "0.001", order_type: "leverage_sell")
|
43
|
+
response = cc.create_orders(rate: "60000", amount: "0.001", position_id: "2222", order_type: "close_long")
|
44
|
+
response = cc.create_orders(rate: "40000", amount: "0.001", position_id: "2222", order_type: "close_short")
|
45
|
+
response = cc.delete_orders(id: "2503344")
|
46
|
+
response = cc.create_send_money(address: "136aHpRdd7eezbEusAKS2GyWx9eXZsEuMz", amount: "0.0005")
|
47
|
+
response = cc.read_send_money
|
48
|
+
response = cc.read_deposit_money
|
49
|
+
response = cc.create_deposit_money_fast(id: "2222")
|
50
|
+
response = cc.read_ticker
|
51
|
+
response = cc.read_trades
|
52
|
+
response = cc.read_rate
|
53
|
+
response = cc.read_order_books
|
54
|
+
response = cc.read_bank_accounts
|
55
|
+
response = cc.delete_bank_accounts(id: "2222")
|
56
|
+
response = cc.read_withdraws
|
57
|
+
response = cc.delete_withdraws
|
58
|
+
response = cc.create_borrows(amount: "0.001", currency: "BTC")
|
59
|
+
response = cc.read_borrows
|
60
|
+
response = cc.delete_borrows(id: "58606")
|
61
|
+
response = cc.transfer_to_leverage(amount: "1000")
|
62
|
+
response = cc.transfer_from_leverage(amount: "1000")
|
63
|
+
JSON.parse(response.body)
|
64
|
+
```
|
65
|
+
|
66
|
+
## Development
|
67
|
+
|
68
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
69
|
+
|
70
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
1. Fork it ( https://github.com/coincheckjp/ruby_coincheck_client/fork )
|
75
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
76
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
77
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
78
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ruby_coincheck_client"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/examples/private.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative '../lib/ruby_coincheck_client'
|
2
|
+
require 'dotenv'
|
3
|
+
Dotenv.load ".env"
|
4
|
+
|
5
|
+
cc = CoincheckClient.new(ENV['API_KEY'], ENV['SECRET_KEY'])
|
6
|
+
puts cc.read_balance.body
|
7
|
+
puts cc.read_leverage_balance.body
|
8
|
+
puts cc.read_accounts.body
|
9
|
+
puts cc.read_transactions.body
|
10
|
+
puts cc.read_positions(status: 'open').body
|
11
|
+
puts cc.read_positions.body
|
12
|
+
puts cc.read_trades().body
|
13
|
+
puts cc.read_page_transactions.body
|
data/examples/public.rb
ADDED
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,274 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
require 'openssl'
|
4
|
+
require 'json'
|
5
|
+
require_relative './currency'
|
6
|
+
|
7
|
+
class CoincheckClient
|
8
|
+
|
9
|
+
include Currency
|
10
|
+
|
11
|
+
@@base_url = "https://coincheck.com/"
|
12
|
+
@@ssl = true
|
13
|
+
|
14
|
+
def initialize(key = nil, secret = nil, params = {})
|
15
|
+
@key = key
|
16
|
+
@secret = secret
|
17
|
+
if !params[:base_url].nil?
|
18
|
+
@@base_url = params[:base_url]
|
19
|
+
end
|
20
|
+
if !params[:ssl].nil?
|
21
|
+
@@ssl = params[:ssl]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def read_balance
|
26
|
+
uri = URI.parse @@base_url + "api/accounts/balance"
|
27
|
+
headers = get_signature(uri, @key, @secret)
|
28
|
+
request_for_get(uri, headers)
|
29
|
+
end
|
30
|
+
|
31
|
+
def read_leverage_balance
|
32
|
+
uri = URI.parse @@base_url + "api/accounts/leverage_balance"
|
33
|
+
headers = get_signature(uri, @key, @secret)
|
34
|
+
request_for_get(uri, headers)
|
35
|
+
end
|
36
|
+
|
37
|
+
def read_accounts
|
38
|
+
uri = URI.parse @@base_url + "api/accounts"
|
39
|
+
headers = get_signature(uri, @key, @secret)
|
40
|
+
request_for_get(uri, headers)
|
41
|
+
end
|
42
|
+
|
43
|
+
def read_transactions
|
44
|
+
uri = URI.parse @@base_url + "api/exchange/orders/transactions"
|
45
|
+
headers = get_signature(uri, @key, @secret)
|
46
|
+
request_for_get(uri, headers)
|
47
|
+
end
|
48
|
+
|
49
|
+
def read_page_transactions
|
50
|
+
uri = URI.parse @@base_url + "api/exchange/orders/transactions_pagination"
|
51
|
+
headers = get_signature(uri, @key, @secret)
|
52
|
+
request_for_get(uri, headers)
|
53
|
+
end
|
54
|
+
|
55
|
+
def read_positions(status: nil)
|
56
|
+
params = { status: status }
|
57
|
+
uri = URI.parse @@base_url + "api/exchange/leverage/positions"
|
58
|
+
uri.query = URI.encode_www_form(params)
|
59
|
+
headers = get_signature(uri, @key, @secret)
|
60
|
+
request_for_get(uri, headers)
|
61
|
+
end
|
62
|
+
|
63
|
+
def read_orders
|
64
|
+
uri = URI.parse @@base_url + "api/exchange/orders/opens"
|
65
|
+
headers = get_signature(uri, @key, @secret)
|
66
|
+
request_for_get(uri, headers)
|
67
|
+
end
|
68
|
+
|
69
|
+
def create_orders(order_type:, rate: nil, amount: nil, market_buy_amount: nil, position_id: nil, pair: Pair::BTC_JPY)
|
70
|
+
body = {
|
71
|
+
rate: rate,
|
72
|
+
amount: amount,
|
73
|
+
market_buy_amount: market_buy_amount,
|
74
|
+
order_type: order_type,
|
75
|
+
position_id: position_id,
|
76
|
+
pair: pair
|
77
|
+
}
|
78
|
+
uri = URI.parse @@base_url + "api/exchange/orders"
|
79
|
+
headers = get_signature(uri, @key, @secret, body.to_json)
|
80
|
+
request_for_post(uri, headers, body)
|
81
|
+
end
|
82
|
+
|
83
|
+
def delete_orders(id: )
|
84
|
+
uri = URI.parse @@base_url + "api/exchange/orders/#{id}"
|
85
|
+
headers = get_signature(uri, @key, @secret)
|
86
|
+
request_for_delete(uri, headers)
|
87
|
+
end
|
88
|
+
|
89
|
+
def read_orders_rate(order_type:, pair: Pair::BTC_JPY, price: nil, amount: nil)
|
90
|
+
params = { order_type: order_type, pair: pair, price: price, amount: amount }
|
91
|
+
uri = URI.parse @@base_url + "api/exchange/orders/rate"
|
92
|
+
uri.query = URI.encode_www_form(params)
|
93
|
+
request_for_get(uri)
|
94
|
+
end
|
95
|
+
|
96
|
+
def create_send_money(address:, amount:)
|
97
|
+
body = {
|
98
|
+
address: address,
|
99
|
+
amount: amount,
|
100
|
+
}
|
101
|
+
uri = URI.parse @@base_url + "api/send_money"
|
102
|
+
headers = get_signature(uri, @key, @secret, body.to_json)
|
103
|
+
request_for_post(uri, headers, body)
|
104
|
+
end
|
105
|
+
|
106
|
+
def read_send_money(currency: "BTC")
|
107
|
+
params = { currency: currency }
|
108
|
+
uri = URI.parse @@base_url + "api/send_money"
|
109
|
+
uri.query = URI.encode_www_form(params)
|
110
|
+
headers = get_signature(uri, @key, @secret)
|
111
|
+
request_for_get(uri, headers)
|
112
|
+
end
|
113
|
+
|
114
|
+
def read_deposit_money(currency: "BTC")
|
115
|
+
params = { currency: currency }
|
116
|
+
uri = URI.parse @@base_url + "api/deposit_money"
|
117
|
+
uri.query = URI.encode_www_form(params)
|
118
|
+
headers = get_signature(uri, @key, @secret)
|
119
|
+
request_for_get(uri, headers)
|
120
|
+
end
|
121
|
+
|
122
|
+
def create_deposit_money_fast(id: )
|
123
|
+
uri = URI.parse @@base_url + "api/deposit_money/#{id}/fast"
|
124
|
+
headers = get_signature(uri, @key, @secret)
|
125
|
+
request_for_delete(uri, headers)
|
126
|
+
end
|
127
|
+
|
128
|
+
def read_ticker
|
129
|
+
uri = URI.parse @@base_url + "api/ticker"
|
130
|
+
request_for_get(uri)
|
131
|
+
end
|
132
|
+
|
133
|
+
def read_trades(pair: Pair::BTC_JPY )
|
134
|
+
uri = URI.parse @@base_url + "api/trades#{pair}"
|
135
|
+
request_for_get(uri)
|
136
|
+
end
|
137
|
+
|
138
|
+
def read_rate(pair: Pair::BTC_JPY)
|
139
|
+
uri = URI.parse @@base_url + "api/rate/#{pair}"
|
140
|
+
request_for_get(uri)
|
141
|
+
end
|
142
|
+
|
143
|
+
def read_order_books
|
144
|
+
uri = URI.parse @@base_url + "api/order_books"
|
145
|
+
request_for_get(uri)
|
146
|
+
end
|
147
|
+
|
148
|
+
def read_bank_accounts
|
149
|
+
uri = URI.parse @@base_url + "api/bank_accounts"
|
150
|
+
headers = get_signature(uri, @key, @secret)
|
151
|
+
request_for_get(uri, headers)
|
152
|
+
end
|
153
|
+
|
154
|
+
def create_bank_accounts(bank_name:, branch_name:, bank_account_type:, number:, name:)
|
155
|
+
body = {
|
156
|
+
bank_name: bank_name,
|
157
|
+
branch_name: branch_name,
|
158
|
+
bank_account_type: bank_account_type,
|
159
|
+
number: number,
|
160
|
+
name: name
|
161
|
+
}
|
162
|
+
uri = URI.parse @@base_url + "api/bank_accounts"
|
163
|
+
headers = get_signature(uri, @key, @secret, body.to_json)
|
164
|
+
request_for_post(uri, headers, body)
|
165
|
+
end
|
166
|
+
|
167
|
+
def delete_bank_accounts(id:)
|
168
|
+
uri = URI.parse @@base_url + "api/bank_accounts/#{id}"
|
169
|
+
headers = get_signature(uri, @key, @secret)
|
170
|
+
request_for_delete(uri, headers)
|
171
|
+
end
|
172
|
+
|
173
|
+
def read_withdraws
|
174
|
+
uri = URI.parse @@base_url + "api/withdraws"
|
175
|
+
headers = get_signature(uri, @key, @secret)
|
176
|
+
request_for_get(uri, headers)
|
177
|
+
end
|
178
|
+
|
179
|
+
def delete_withdraws(id:)
|
180
|
+
uri = URI.parse @@base_url + "api/withdraws/#{id}"
|
181
|
+
headers = get_signature(uri, @key, @secret)
|
182
|
+
request_for_delete(uri, headers)
|
183
|
+
end
|
184
|
+
|
185
|
+
def create_borrows(amount:, currency:)
|
186
|
+
body = {
|
187
|
+
amount: amount,
|
188
|
+
currency: currency
|
189
|
+
}
|
190
|
+
uri = URI.parse @@base_url + "api/lending/borrows"
|
191
|
+
headers = get_signature(uri, @key, @secret, body.to_json)
|
192
|
+
request_for_post(uri, headers, body)
|
193
|
+
end
|
194
|
+
|
195
|
+
def read_borrows
|
196
|
+
uri = URI.parse @@base_url + "api/lending/borrows/matches"
|
197
|
+
headers = get_signature(uri, @key, @secret)
|
198
|
+
request_for_get(uri, headers)
|
199
|
+
end
|
200
|
+
|
201
|
+
def delete_borrows(id:)
|
202
|
+
body = { id: id}
|
203
|
+
uri = URI.parse @@base_url + "api/lending/borrows/#{id}/repay"
|
204
|
+
headers = get_signature(uri, @key, @secret, body.to_json)
|
205
|
+
request_for_post(uri, headers, body)
|
206
|
+
end
|
207
|
+
|
208
|
+
def transfer_to_leverage(amount:, currency: JPY)
|
209
|
+
body = {
|
210
|
+
amount: amount,
|
211
|
+
currency: currency
|
212
|
+
}
|
213
|
+
uri = URI.parse @@base_url + "api/exchange/transfers/to_leverage"
|
214
|
+
headers = get_signature(uri, @key, @secret, body.to_json)
|
215
|
+
request_for_post(uri, headers, body)
|
216
|
+
end
|
217
|
+
|
218
|
+
def transfer_from_leverage(amount:, currency: JPY)
|
219
|
+
body = {
|
220
|
+
amount: amount,
|
221
|
+
currency: currency
|
222
|
+
}
|
223
|
+
uri = URI.parse @@base_url + "api/exchange/transfers/from_leverage"
|
224
|
+
headers = get_signature(uri, @key, @secret, body.to_json)
|
225
|
+
request_for_post(uri, headers, body)
|
226
|
+
end
|
227
|
+
|
228
|
+
private
|
229
|
+
def http_request(uri, request)
|
230
|
+
https = Net::HTTP.new(uri.host, uri.port)
|
231
|
+
if @@ssl
|
232
|
+
https.use_ssl = true
|
233
|
+
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
234
|
+
end
|
235
|
+
|
236
|
+
response = https.start do |h|
|
237
|
+
h.request(request)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def request_for_get(uri, headers = {})
|
242
|
+
request = Net::HTTP::Get.new(uri.request_uri, initheader = custom_header(headers))
|
243
|
+
http_request(uri, request)
|
244
|
+
end
|
245
|
+
|
246
|
+
def request_for_delete(uri, headers)
|
247
|
+
request = Net::HTTP::Delete.new(uri.request_uri, initheader = custom_header(headers))
|
248
|
+
http_request(uri, request)
|
249
|
+
end
|
250
|
+
|
251
|
+
def request_for_post(uri, headers, body)
|
252
|
+
request = Net::HTTP::Post.new(uri.request_uri, initheader = custom_header(headers))
|
253
|
+
request.body = body.to_json
|
254
|
+
http_request(uri, request)
|
255
|
+
end
|
256
|
+
|
257
|
+
def custom_header(headers = {})
|
258
|
+
headers.merge!({
|
259
|
+
"Content-Type" => "application/json",
|
260
|
+
"User-Agent" => "RubyCoincheckClient v#{RubyCoincheckClient::VERSION}"
|
261
|
+
})
|
262
|
+
end
|
263
|
+
|
264
|
+
def get_signature(uri, key, secret, body = "")
|
265
|
+
nonce = (Time.now.to_f * 1000000).to_i.to_s
|
266
|
+
message = nonce + uri.to_s + body
|
267
|
+
signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha256"), secret, message)
|
268
|
+
headers = {
|
269
|
+
"ACCESS-KEY" => key,
|
270
|
+
"ACCESS-NONCE" => nonce,
|
271
|
+
"ACCESS-SIGNATURE" => signature
|
272
|
+
}
|
273
|
+
end
|
274
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Currency
|
2
|
+
JPY = "JPY"
|
3
|
+
BTC = "BTC"
|
4
|
+
ETH = "ETH"
|
5
|
+
ETC = "ETC"
|
6
|
+
DAO = "DAO"
|
7
|
+
LSK = "LSK"
|
8
|
+
FCT = "FCT"
|
9
|
+
XMR = "XMR"
|
10
|
+
REP = "REP"
|
11
|
+
XRP = "XRP"
|
12
|
+
ZEC = "ZEC"
|
13
|
+
XEM = "XEM"
|
14
|
+
LTC = "LTC"
|
15
|
+
DASH = "DASH"
|
16
|
+
BCH = "BCH"
|
17
|
+
|
18
|
+
module Pair
|
19
|
+
BTC_JPY = "btc_jpy"
|
20
|
+
ETH_JPY = "eth_jpy"
|
21
|
+
ETC_JPY = "etc_jpy"
|
22
|
+
DAO_JPY = "dao_jpy"
|
23
|
+
LSK_JPY = "lsk_jpy"
|
24
|
+
FCT_JPY = "fct_jpy"
|
25
|
+
XMR_JPY = "xmr_jpy"
|
26
|
+
REP_JPY = "rep_jpy"
|
27
|
+
XRP_JPY = "xrp_jpy"
|
28
|
+
ZEC_JPY = "zec_jpy"
|
29
|
+
XEM_JPY = "xem_jpy"
|
30
|
+
LTC_JPY = "ltc_jpy"
|
31
|
+
DASH_JPY = "dash_jpy"
|
32
|
+
BCH_JPY = "bch_jpy"
|
33
|
+
ETH_BTC = "eth_btc"
|
34
|
+
ETC_BTC = "etc_btc"
|
35
|
+
LSK_BTC = "lsk_btc"
|
36
|
+
FCT_BTC = "fct_btc"
|
37
|
+
XMR_BTC = "xmr_btc"
|
38
|
+
REP_BTC = "rep_btc"
|
39
|
+
XRP_BTC = "xrp_btc"
|
40
|
+
ZEC_BTC = "zec_btc"
|
41
|
+
XEM_BTC = "xem_btc"
|
42
|
+
LTC_BTC = "ltc_btc"
|
43
|
+
DASH_BTC = "dash_btc"
|
44
|
+
BCH_BTC = "bch_btc"
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ruby_coincheck_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "fixed_ruby_coincheck_client"
|
8
|
+
spec.version = RubyCoincheckClient::VERSION
|
9
|
+
spec.authors = ["Ryu Nishida"]
|
10
|
+
spec.email = ["nishidaryu416@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{This is a ruby client of coincheck api}
|
13
|
+
spec.homepage = "https://github.com/NishidaRyu416/ruby_coincheck_client"
|
14
|
+
|
15
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
16
|
+
# delete this section to allow pushing this gem to any host.
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
19
|
+
else
|
20
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
21
|
+
end
|
22
|
+
|
23
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
spec.bindir = "exe"
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
29
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
+
spec.add_development_dependency "rspec"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fixed_ruby_coincheck_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryu Nishida
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- nishidaryu416@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".DS_Store"
|
63
|
+
- ".circle.yml"
|
64
|
+
- ".gitignore"
|
65
|
+
- ".rspec"
|
66
|
+
- CHANGELOG.md
|
67
|
+
- Gemfile
|
68
|
+
- Gemfile.lock
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- examples/private.rb
|
74
|
+
- examples/public.rb
|
75
|
+
- lib/.DS_Store
|
76
|
+
- lib/ruby_coincheck_client.rb
|
77
|
+
- lib/ruby_coincheck_client/coincheck_client.rb
|
78
|
+
- lib/ruby_coincheck_client/currency.rb
|
79
|
+
- lib/ruby_coincheck_client/version.rb
|
80
|
+
- ruby_coincheck_client.gemspec
|
81
|
+
homepage: https://github.com/NishidaRyu416/ruby_coincheck_client
|
82
|
+
licenses: []
|
83
|
+
metadata:
|
84
|
+
allowed_push_host: https://rubygems.org
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.5.1
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: This is a ruby client of coincheck api
|
105
|
+
test_files: []
|