coinex 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +29 -0
- data/lib/coinex/autoloader.rb +41 -0
- data/lib/coinex/base.rb +38 -0
- data/lib/coinex/resources/amm.rb +16 -0
- data/lib/coinex/resources/balance.rb +44 -0
- data/lib/coinex/resources/common.rb +16 -0
- data/lib/coinex/resources/deposit.rb +51 -0
- data/lib/coinex/resources/market.rb +65 -0
- data/lib/coinex/resources/order.rb +98 -0
- data/lib/coinex/resources/request.rb +34 -0
- data/lib/coinex/resources/signature.rb +37 -0
- data/lib/coinex/resources/withdraw.rb +71 -0
- data/lib/coinex/version.rb +5 -0
- data/lib/coinex.rb +49 -0
- metadata +183 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ab67b4dd00a3197ea1c3f5f30399c2d98a2fc6ba6e3f536aacc5b5efe943afba
|
4
|
+
data.tar.gz: af17ee7bcc64ff481c02c9f0eb8df718bae16200b6464eef9857d22502b93db3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c54290e56a02399193053d044a3838a7f7fcdf4a62c0a8e3c2a2ba1f45a75eb0725936230ebcd391ddd15299d69025e2ac1dac1b8daa460b1bf7efa25d209ae2
|
7
|
+
data.tar.gz: 789061727fac53c1c4b94881d9baf4f0fd4443a7a5b481bba5733cba269cf59bab472d3eff1967725b425bb374a8bd4f8f2989fc4f1ede0fe0ba3bcafa290225
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Coinex
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/coinex`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
10
|
+
|
11
|
+
$ bundle add coinex
|
12
|
+
|
13
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
14
|
+
|
15
|
+
$ gem install coinex
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
TODO: Write usage instructions here
|
20
|
+
|
21
|
+
## Development
|
22
|
+
|
23
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
24
|
+
|
25
|
+
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`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/coinex.
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'zeitwerk'
|
4
|
+
|
5
|
+
module Coinex
|
6
|
+
class Autoloader
|
7
|
+
class Inflector < ::Zeitwerk::Inflector
|
8
|
+
INFLECTIONS_MAP = {
|
9
|
+
version: 'VERSION'
|
10
|
+
}.freeze
|
11
|
+
|
12
|
+
def camelize(basename, _abspath)
|
13
|
+
INFLECTIONS_MAP[basename.to_sym] || super
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class << self
|
18
|
+
LIB_PATH = ::File.dirname(__dir__).freeze
|
19
|
+
|
20
|
+
def setup!
|
21
|
+
loader = ::Zeitwerk::Loader.new
|
22
|
+
loader.tag = 'coinex'
|
23
|
+
loader.inflector = Inflector.new
|
24
|
+
loader.push_dir(LIB_PATH)
|
25
|
+
loader.collapse(::File.join(LIB_PATH, 'coinex', 'resources'))
|
26
|
+
|
27
|
+
ignored_paths.each { |path| loader.ignore(path) }
|
28
|
+
|
29
|
+
loader.setup
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def ignored_paths
|
35
|
+
[
|
36
|
+
::File.join(LIB_PATH, 'coinex', 'patches')
|
37
|
+
].freeze
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/lib/coinex/base.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'uri'
|
4
|
+
require 'net/http'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
module Coinex
|
8
|
+
class Base
|
9
|
+
class << self
|
10
|
+
attr_accessor :app_info, :path_prefix,
|
11
|
+
:access_id, :secret_key
|
12
|
+
|
13
|
+
def build_url(route:, params: {}, method: 'GET')
|
14
|
+
return nil if params.empty? && !route.nil?
|
15
|
+
|
16
|
+
signature = params[:signature]
|
17
|
+
params.delete(:signature)
|
18
|
+
if method == 'GET' || method == 'DELETE'
|
19
|
+
base_url = "#{Coinex::Base.path_prefix}#{route}?access_id=#{Coinex.access_id}"
|
20
|
+
params.each do |key, value|
|
21
|
+
base_url = "#{base_url}&#{key}=#{value}"
|
22
|
+
end
|
23
|
+
else
|
24
|
+
base_url = "#{Coinex::Base.path_prefix}#{route}?access_id=#{Coinex.access_id}"
|
25
|
+
base_url = "#{base_url}&tonce=#{params[:tonce]}"
|
26
|
+
end
|
27
|
+
|
28
|
+
[base_url, signature]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
self.app_info = ::ENV['APP_INFO'] || "#{::Coinex::NAME} V#{::Coinex.version}"
|
33
|
+
self.path_prefix = 'https://api.coinex.com/v1'
|
34
|
+
|
35
|
+
self.access_id = ::ENV['ACCESS_ID']
|
36
|
+
self.secret_key = ::ENV['SECRET_KEY']
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinex
|
4
|
+
class Amm < Base
|
5
|
+
class << self
|
6
|
+
# GET /amm/market
|
7
|
+
# Description: Acquire AMM Market List
|
8
|
+
# Parameter: /
|
9
|
+
|
10
|
+
def market
|
11
|
+
uri = URI('https://api.coinex.com/v1/amm/market')
|
12
|
+
Coinex::Request.request(uri: uri, method: 'GET')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinex
|
4
|
+
class Balance < Base
|
5
|
+
class << self
|
6
|
+
# GET /balance/info
|
7
|
+
# Description: Acquire Account Balance Info
|
8
|
+
# Parameter:
|
9
|
+
# Name Type Required Signature
|
10
|
+
# access_id String X
|
11
|
+
# tonce Integer X
|
12
|
+
|
13
|
+
# Signature for this function -> Coinex::Signature.calculate
|
14
|
+
|
15
|
+
def info(params:)
|
16
|
+
data = build_url(params: params, route: '/balance/info')
|
17
|
+
uri = URI(data.first)
|
18
|
+
|
19
|
+
Coinex::Request.request(uri: uri, method: 'GET', signature: data[1])
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /account/balance/history
|
23
|
+
# Description: Inquire User Operation History
|
24
|
+
# Parameter:
|
25
|
+
# Name Type Required Signature
|
26
|
+
# access_id String X
|
27
|
+
# tonce Integer X
|
28
|
+
# page Integer X
|
29
|
+
# limit Integer X
|
30
|
+
# start_time Integer
|
31
|
+
# end_time Integer
|
32
|
+
|
33
|
+
# Params -> p = { page: 1, limit: 100 } Start and time return service unvailable
|
34
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
35
|
+
|
36
|
+
def history(params:)
|
37
|
+
data = build_url(params: params, route: '/account/balance/history')
|
38
|
+
uri = URI(data.first)
|
39
|
+
|
40
|
+
Coinex::Request.request(uri: uri, method: 'GET', signature: data[1])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinex
|
4
|
+
class Common < Base
|
5
|
+
class << self
|
6
|
+
# GET /common/currency/rate
|
7
|
+
# Description: Acquire Currency Rate
|
8
|
+
# Parameter: /
|
9
|
+
|
10
|
+
def rate
|
11
|
+
uri = URI('https://api.coinex.com/v1/common/currency/rate')
|
12
|
+
Coinex::Request.request(uri: uri, method: 'GET')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinex
|
4
|
+
class Deposit < Base
|
5
|
+
class << self
|
6
|
+
# GET /balance/coin/deposit
|
7
|
+
# Description: Acquire Deposit Records
|
8
|
+
# Parameter:
|
9
|
+
# Name Type Required Signature
|
10
|
+
# access_id String X
|
11
|
+
# tonce Integer X
|
12
|
+
# coin_type String
|
13
|
+
# txid String
|
14
|
+
# page Integer X
|
15
|
+
# limit Integer X
|
16
|
+
# status String
|
17
|
+
|
18
|
+
# Params -> p = { page: 1, limit: 100 }
|
19
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
20
|
+
|
21
|
+
def list(params:)
|
22
|
+
data = build_url(params: params, route: '/balance/coin/deposit')
|
23
|
+
uri = URI(data.first)
|
24
|
+
|
25
|
+
Coinex::Request.request(uri: uri, method: 'GET', signature: data[1])
|
26
|
+
end
|
27
|
+
|
28
|
+
# GET /balance/coin/deposit
|
29
|
+
# Description: Acquire Deposit Record (Tx_id)
|
30
|
+
# Parameter:
|
31
|
+
# Name Type Required Signature
|
32
|
+
# access_id String X
|
33
|
+
# tonce Integer X
|
34
|
+
# coin_type String
|
35
|
+
# txid String
|
36
|
+
# page Integer X
|
37
|
+
# limit Integer X
|
38
|
+
# status String
|
39
|
+
|
40
|
+
# Params -> p = { page: 1, limit: 100 }
|
41
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
42
|
+
|
43
|
+
def find(params:)
|
44
|
+
data = build_url(params: params, route: '/balance/coin/deposit')
|
45
|
+
uri = URI(data.first)
|
46
|
+
|
47
|
+
Coinex::Request.request(uri: uri, method: 'GET', signature: data[1])
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinex
|
4
|
+
class Market < Base
|
5
|
+
class << self
|
6
|
+
# GET /market/list
|
7
|
+
# Description: Acquire All Market List
|
8
|
+
# Parameter: /
|
9
|
+
|
10
|
+
def list
|
11
|
+
uri = URI('https://api.coinex.com/v1/market/list')
|
12
|
+
Coinex::Request.request(uri: uri, method: 'GET')
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /market/info
|
16
|
+
# Description: Acquire All Market Info
|
17
|
+
# Parameter: /
|
18
|
+
|
19
|
+
def info
|
20
|
+
uri = URI('https://api.coinex.com/v1/market/info')
|
21
|
+
Coinex::Request.request(uri: uri, method: 'GET')
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /market/detail
|
25
|
+
# Description: Acquire Single Market Info
|
26
|
+
# Parameter:
|
27
|
+
# Name Type Required
|
28
|
+
# market String X
|
29
|
+
|
30
|
+
def find(name)
|
31
|
+
uri = URI("https://api.coinex.com/v1/market/detail?market=#{name}")
|
32
|
+
Coinex::Request.request(uri: uri, method: 'GET')
|
33
|
+
end
|
34
|
+
|
35
|
+
# GET /market/ticker
|
36
|
+
# Description: Acquire Single Market Statistics
|
37
|
+
# Parameter:
|
38
|
+
# Name Type Required
|
39
|
+
# market String X
|
40
|
+
|
41
|
+
def ticker(name)
|
42
|
+
uri = URI("https://api.coinex.com/v1/market/ticker?market=#{name}")
|
43
|
+
Coinex::Request.request(uri: uri, method: 'GET')
|
44
|
+
end
|
45
|
+
|
46
|
+
# GET /market/ticker/all
|
47
|
+
# Description: Acquire Single Market Statistics
|
48
|
+
# Parameter: /
|
49
|
+
|
50
|
+
def tickers
|
51
|
+
uri = URI('https://api.coinex.com/v1/market/ticker/all')
|
52
|
+
Coinex::Request.request(uri: uri, method: 'GET')
|
53
|
+
end
|
54
|
+
|
55
|
+
# GET /margin/market
|
56
|
+
# Description: Acquire Margin Market List
|
57
|
+
# Parameter: /
|
58
|
+
|
59
|
+
def margin
|
60
|
+
uri = URI('https://api.coinex.com/v1/margin/market')
|
61
|
+
Coinex::Request.request(uri: uri, method: 'GET')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinex
|
4
|
+
class Order < Base
|
5
|
+
class << self
|
6
|
+
# POST /order/market
|
7
|
+
# Description: Submit Market Order
|
8
|
+
# Parameter:
|
9
|
+
# Name Type Required Signature
|
10
|
+
# access_id String X
|
11
|
+
# tonce Integer X
|
12
|
+
# market String X
|
13
|
+
# type String X
|
14
|
+
# amount String X
|
15
|
+
|
16
|
+
# Params -> p = { market: 'BTCUSDT', type: 'buy', amount: '50.000' }
|
17
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
18
|
+
|
19
|
+
def market(params:)
|
20
|
+
params['access_id'] = Coinex.access_id
|
21
|
+
data = build_url(params: params, route: '/order/market', method: 'POST')
|
22
|
+
uri = URI(data.first)
|
23
|
+
|
24
|
+
Coinex::Request.request(uri: uri, method: 'POST', signature: data[1], params: params)
|
25
|
+
end
|
26
|
+
|
27
|
+
# POST /order/stop/market
|
28
|
+
# Description: Submit Stop-Market Order
|
29
|
+
# Parameter:
|
30
|
+
# Name Type Required Signature
|
31
|
+
# access_id String X
|
32
|
+
# tonce Integer X
|
33
|
+
# market String X
|
34
|
+
# type String X
|
35
|
+
# amount String X
|
36
|
+
# stop_price String X
|
37
|
+
|
38
|
+
# Params -> p = { market: 'BTCUSDT', type: 'buy', amount: '50.000',
|
39
|
+
# stop_price: 50000 }
|
40
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
41
|
+
|
42
|
+
# rubocop: disable Metrics/MethodLength, Lint/MissingCopEnableDirective
|
43
|
+
def limit(params:)
|
44
|
+
params['access_id'] = Coinex.access_id
|
45
|
+
data = build_url(params: params, route: '/order/stop/market', method: 'POST')
|
46
|
+
uri = URI(data.first)
|
47
|
+
|
48
|
+
Coinex::Request.request(uri: uri, method: 'POST', signature: data[1], params: params)
|
49
|
+
end
|
50
|
+
|
51
|
+
# GET /order/finished
|
52
|
+
# Description: Inquire Order History
|
53
|
+
# Parameter:
|
54
|
+
# Name Type Required Signature
|
55
|
+
# access_id String X
|
56
|
+
# tonce Integer X
|
57
|
+
# market String
|
58
|
+
# page Integer X
|
59
|
+
# limit Integer X
|
60
|
+
# type String
|
61
|
+
# start_time Integer
|
62
|
+
# end_time Integer
|
63
|
+
|
64
|
+
# Params -> p = { page: 1, limit: 100 }
|
65
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
66
|
+
|
67
|
+
def list(params:)
|
68
|
+
data = build_url(params: params, route: '/order/finished')
|
69
|
+
uri = URI(data.first)
|
70
|
+
|
71
|
+
Coinex::Request.request(uri: uri, method: 'GET', signature: data[1])
|
72
|
+
end
|
73
|
+
|
74
|
+
# GET /order/user/deals
|
75
|
+
# Description: Inquire User Transaction Records
|
76
|
+
# Parameter:
|
77
|
+
# Name Type Required Signature
|
78
|
+
# access_id String X
|
79
|
+
# tonce Integer X
|
80
|
+
# market String
|
81
|
+
# page Integer X
|
82
|
+
# limit Integer X
|
83
|
+
# type String
|
84
|
+
# start_time Integer
|
85
|
+
# end_time Integer
|
86
|
+
|
87
|
+
# Params -> p = { page: 1, limit: 100 }
|
88
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
89
|
+
|
90
|
+
def deals(params:)
|
91
|
+
data = build_url(params: params, route: '/order/user/deals')
|
92
|
+
uri = URI(data.first)
|
93
|
+
|
94
|
+
Coinex::Request.request(uri: uri, method: 'GET', signature: data[1])
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinex
|
4
|
+
class Request < Base
|
5
|
+
class << self
|
6
|
+
def request(uri:, method:, signature: nil, params: {})
|
7
|
+
req = get_method(name: method, uri: uri)
|
8
|
+
req['Authorization'] = signature unless signature.nil?
|
9
|
+
req['Content-Type'] = 'application/json'
|
10
|
+
|
11
|
+
req.body = JSON.dump(params) unless params.empty?
|
12
|
+
|
13
|
+
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
14
|
+
http.request(req)
|
15
|
+
end
|
16
|
+
|
17
|
+
JSON.parse(res.body)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_method(name:, uri:)
|
21
|
+
case name
|
22
|
+
when 'GET'
|
23
|
+
req = Net::HTTP::Get.new(uri)
|
24
|
+
when 'POST'
|
25
|
+
req = Net::HTTP::Post.new(uri)
|
26
|
+
when 'DELETE'
|
27
|
+
req = Net::HTTP::Delete.new(uri)
|
28
|
+
end
|
29
|
+
|
30
|
+
req
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require('digest')
|
4
|
+
|
5
|
+
module Coinex
|
6
|
+
class Signature < Base
|
7
|
+
class << self
|
8
|
+
def calculate(params: {})
|
9
|
+
current_time = params[:tonce].nil? ? Time.now.strftime('%s%L') : params[:tonce]
|
10
|
+
signature = nil
|
11
|
+
|
12
|
+
if params.empty?
|
13
|
+
sign_str = "access_id=#{Coinex.access_id}&tonce=#{current_time}&secret_key=#{Coinex.secret_key}"
|
14
|
+
signature = Digest::MD5.hexdigest(sign_str).upcase
|
15
|
+
else
|
16
|
+
params[:tonce] = current_time
|
17
|
+
signature = Digest::MD5.hexdigest(calculate_params(params)).upcase
|
18
|
+
end
|
19
|
+
|
20
|
+
{ tonce: current_time, signature: signature }
|
21
|
+
end
|
22
|
+
|
23
|
+
def calculate_params(params)
|
24
|
+
sort_params = params.sort.to_h
|
25
|
+
init = "access_id=#{Coinex.access_id}&"
|
26
|
+
finish = "secret_key=#{Coinex.secret_key}"
|
27
|
+
array = []
|
28
|
+
|
29
|
+
sort_params.each do |key, value|
|
30
|
+
array.push("#{key}=#{value}&")
|
31
|
+
end
|
32
|
+
|
33
|
+
init + array.join('') + finish
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Coinex
|
4
|
+
class Withdraw < Base
|
5
|
+
class << self
|
6
|
+
# POST /balance/coin/withdraw
|
7
|
+
# Description: Submit Withdrawal Request
|
8
|
+
# Parameter:
|
9
|
+
# Name Type Required Signature
|
10
|
+
# access_id String X
|
11
|
+
# tonce Integer X
|
12
|
+
# coin_type String X
|
13
|
+
# smart_contract_name String X(yes to pay less)
|
14
|
+
# coin_address String X
|
15
|
+
# transfer_method String
|
16
|
+
# actual_amount String X
|
17
|
+
|
18
|
+
# Params -> p = { coin_type: 'USDT', smart_contract_name: 'TRC20',
|
19
|
+
# coin_address: 'TM6RdomCvjrmnNSrB3KwAnihTsNfSKb1rj',
|
20
|
+
# transfer_method: 'onchain', actual_amount: '1.00000'}
|
21
|
+
# Signature for this function -> Coinex::Signature.calculate
|
22
|
+
|
23
|
+
# rubocop: disable Metrics/MethodLength, Lint/MissingCopEnableDirective
|
24
|
+
def create(params:)
|
25
|
+
data = build_url(params: params, route: '/balance/coin/withdraw', method: 'POST')
|
26
|
+
uri = URI(data.first)
|
27
|
+
|
28
|
+
Coinex::Request.request(uri: uri, method: 'POST', signature: data[1], params: params)
|
29
|
+
end
|
30
|
+
|
31
|
+
# DELETE /balance/coin/withdraw
|
32
|
+
# Description: Cancel Withdrawal Request
|
33
|
+
# Parameter:
|
34
|
+
# Name Type Required Signature
|
35
|
+
# access_id String X
|
36
|
+
# tonce Integer X
|
37
|
+
# coin_withdraw_id Integer X
|
38
|
+
|
39
|
+
# Params -> p = { coin_withdraw_id: 12345'}
|
40
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
41
|
+
|
42
|
+
def delete(params:)
|
43
|
+
data = build_url(params: params, route: '/balance/coin/withdraw', method: 'DELETE')
|
44
|
+
uri = URI(data.first)
|
45
|
+
|
46
|
+
Coinex::Request.request(uri: uri, method: 'DELETE', signature: data[1], params: params)
|
47
|
+
end
|
48
|
+
|
49
|
+
# GET /balance/coin/withdraw
|
50
|
+
# Description: Acquire Withdrawal History
|
51
|
+
# Parameter:
|
52
|
+
# Name Type Required Signature
|
53
|
+
# access_id String X
|
54
|
+
# tonce Integer X
|
55
|
+
# page Integer X
|
56
|
+
# limit Integer X
|
57
|
+
# coin_type String
|
58
|
+
# coin_withdraw_id Integer
|
59
|
+
|
60
|
+
# Params -> p = { page: 1, limit: 100 }
|
61
|
+
# Signature for this function -> Coinex::Signature.calculate(params: p)
|
62
|
+
|
63
|
+
def list(params:)
|
64
|
+
data = build_url(params: params, route: '/balance/coin/withdraw')
|
65
|
+
uri = URI(data.first)
|
66
|
+
|
67
|
+
Coinex::Request.request(uri: uri, method: 'GET', signature: data[1])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/coinex.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './coinex/autoloader'
|
4
|
+
|
5
|
+
module Coinex
|
6
|
+
NAME = 'Coinex Ruby'
|
7
|
+
|
8
|
+
@mutex = ::Mutex.new
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def app_info=(value)
|
12
|
+
::Coinex::Base.app_info = value
|
13
|
+
end
|
14
|
+
|
15
|
+
def ping
|
16
|
+
{ status: 200 }
|
17
|
+
end
|
18
|
+
|
19
|
+
def path=(value)
|
20
|
+
@mutex.synchronize { ::Coinex::Base.path_prefix = value }
|
21
|
+
end
|
22
|
+
|
23
|
+
def path
|
24
|
+
@mutex.synchronize { ::Coinex::Base.path_prefix }
|
25
|
+
end
|
26
|
+
|
27
|
+
def access_id=(value)
|
28
|
+
@mutex.synchronize { ::Coinex::Base.access_id = value }
|
29
|
+
end
|
30
|
+
|
31
|
+
def access_id
|
32
|
+
@mutex.synchronize { ::Coinex::Base.access_id }
|
33
|
+
end
|
34
|
+
|
35
|
+
def secret_key=(value)
|
36
|
+
@mutex.synchronize { ::Coinex::Base.secret_key = value }
|
37
|
+
end
|
38
|
+
|
39
|
+
def secret_key
|
40
|
+
@mutex.synchronize { ::Coinex::Base.secret_key }
|
41
|
+
end
|
42
|
+
|
43
|
+
def version
|
44
|
+
VERSION
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
::Coinex::Autoloader.setup!
|
metadata
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: coinex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stefano Baldazzi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-10-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: zeitwerk
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bump
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: digest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.1.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '13.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '13.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.16'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.16'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: webmock
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.14'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.14'
|
139
|
+
description: Coinex Ruby is a lightweight gem for accessing the Coinex API web services.
|
140
|
+
email:
|
141
|
+
- stefanobaldazzi40@gmail.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- README.md
|
147
|
+
- lib/coinex.rb
|
148
|
+
- lib/coinex/autoloader.rb
|
149
|
+
- lib/coinex/base.rb
|
150
|
+
- lib/coinex/resources/amm.rb
|
151
|
+
- lib/coinex/resources/balance.rb
|
152
|
+
- lib/coinex/resources/common.rb
|
153
|
+
- lib/coinex/resources/deposit.rb
|
154
|
+
- lib/coinex/resources/market.rb
|
155
|
+
- lib/coinex/resources/order.rb
|
156
|
+
- lib/coinex/resources/request.rb
|
157
|
+
- lib/coinex/resources/signature.rb
|
158
|
+
- lib/coinex/resources/withdraw.rb
|
159
|
+
- lib/coinex/version.rb
|
160
|
+
homepage: https://github.com/Baldaz02/coinex-ruby
|
161
|
+
licenses:
|
162
|
+
- MIT
|
163
|
+
metadata: {}
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '2.7'
|
173
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
requirements: []
|
179
|
+
rubygems_version: 3.3.24
|
180
|
+
signing_key:
|
181
|
+
specification_version: 4
|
182
|
+
summary: coinex0.0.3
|
183
|
+
test_files: []
|