binance_client 2.0.0 → 4.0.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/CHANGELOG.md +30 -1
- data/Gemfile.lock +3 -3
- data/README.md +4 -5
- data/lib/binance_client/client.rb +4 -2
- data/lib/binance_client/factories.rb +55 -0
- data/lib/binance_client/models/base_model.rb +7 -0
- data/lib/binance_client/models/coin.rb +70 -0
- data/lib/binance_client/models/deposit.rb +40 -0
- data/lib/binance_client/models/market.rb +58 -0
- data/lib/binance_client/models/market_filter.rb +25 -0
- data/lib/binance_client/models/network.rb +70 -0
- data/lib/binance_client/models/rate_limit.rb +36 -0
- data/lib/binance_client/requests/{get_all_request.rb → coins_info_request.rb} +1 -1
- data/lib/binance_client/requests/exchange_info_request.rb +10 -0
- data/lib/binance_client/requests/sub_account_deposit_history_request.rb +36 -0
- data/lib/binance_client/responses/coins_info_response.rb +11 -0
- data/lib/binance_client/responses/exchange_info_response.rb +30 -0
- data/lib/binance_client/responses/sub_account_deposit_history_response.rb +11 -0
- data/lib/binance_client/version.rb +1 -1
- data/lib/binance_client.rb +14 -2
- metadata +17 -7
- data/lib/binance_client/responses/get_all_response.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3b7cc28ee5e49a6bd911193495c4fe75c8cb8854567a26aee1e4c4ab644403e
|
4
|
+
data.tar.gz: 8b2deb1fb0a89194fb839c4ed21949955c564f2cea8bfaccd35fb18a15619e72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac8076c646803401ee62a4320dc8f45335a0d0b3b7647e9c106816ffc5349853b789a3d83760f254cf4bf8e9c0ab32109e71b29225355a5100692fbf4ace5487
|
7
|
+
data.tar.gz: 47bea0043b15597afc809976f0389a8824b984115324fa430b115db2467559d9312c13a5f7d4790bb02ad22f3ffd8ac7fe2e5aaf3996d11a4f34e54d380ffb9b
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,36 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [
|
7
|
+
## [4.0.0]
|
8
|
+
### Added
|
9
|
+
- Add optional `network` parameter when getting deposit address of a specific network
|
10
|
+
- Use keyword arguments when calling `sub_account_deposit_address`
|
11
|
+
|
12
|
+
## [3.0.1]
|
13
|
+
### Fixed
|
14
|
+
- `Coin#network_list` is initialized properly
|
15
|
+
- Return decimal for the following methods of `Network`:
|
16
|
+
- `#withdraw_fee`
|
17
|
+
- `#withdraw_integer_multiple`
|
18
|
+
- `#withdraw_max`
|
19
|
+
- `#withdraw_min`
|
20
|
+
|
21
|
+
## [3.0.0]
|
22
|
+
### Changed
|
23
|
+
- Rename `#get_all` to `#coins_info` and give access to info via the response's `#coins` method
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
- `Deposit#insert_time` returns `Time` and not an Integer of milliseconds
|
27
|
+
|
28
|
+
### Added
|
29
|
+
- Add Deposit, RateLimit factories
|
30
|
+
|
31
|
+
## [2.1.0]
|
32
|
+
### Added
|
33
|
+
- `exchange_info` endpoint
|
34
|
+
- `sub_account_deposit_history` endpoint
|
35
|
+
|
36
|
+
## [2.0.0]
|
8
37
|
### Changed
|
9
38
|
- Remove `used_weight` from responses
|
10
39
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
binance_client (
|
4
|
+
binance_client (4.0.0)
|
5
5
|
activesupport
|
6
6
|
api_client_base (~> 1.11)
|
7
7
|
typhoeus
|
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
ffi (>= 1.15.0)
|
40
40
|
factory_bot (6.2.0)
|
41
41
|
activesupport (>= 5.0.0)
|
42
|
-
ffi (1.15.
|
42
|
+
ffi (1.15.5)
|
43
43
|
gem_config (0.3.2)
|
44
44
|
hashdiff (1.0.1)
|
45
45
|
i18n (1.8.11)
|
@@ -102,4 +102,4 @@ DEPENDENCIES
|
|
102
102
|
webmock
|
103
103
|
|
104
104
|
BUNDLED WITH
|
105
|
-
2.2.
|
105
|
+
2.2.29
|
data/README.md
CHANGED
@@ -34,11 +34,13 @@ We provide one method per API endpoint.
|
|
34
34
|
```
|
35
35
|
client.system_status
|
36
36
|
client.account_snapshot
|
37
|
-
client.
|
37
|
+
client.coins_info
|
38
38
|
client.book_ticker(symbol: "BTCETH")
|
39
39
|
client.order_book_depth(symbol: "BTCUSDT", limit: 100)
|
40
40
|
```
|
41
41
|
|
42
|
+
See `spec/acceptance` for all calls.
|
43
|
+
|
42
44
|
## Responses
|
43
45
|
The default representation of response data is a JSON hash
|
44
46
|
|
@@ -55,10 +57,7 @@ What you assign can be a proc -- it just needs to respond to `call` and accept t
|
|
55
57
|
class DoSomethingAfterBinanceResponse
|
56
58
|
|
57
59
|
def self.call(request, response)
|
58
|
-
|
59
|
-
if one_minute_weight > 1200
|
60
|
-
Rails.logger.info "Looks like we've hit the request limit!"
|
61
|
-
end
|
60
|
+
response.used_weights # Ruby hash of the headers of all the possible used weights
|
62
61
|
end
|
63
62
|
|
64
63
|
end
|
@@ -5,11 +5,13 @@ module BinanceClient
|
|
5
5
|
api_action :account
|
6
6
|
api_action :system_status
|
7
7
|
api_action :account_snapshot
|
8
|
-
api_action :
|
8
|
+
api_action :coins_info
|
9
|
+
api_action :exchange_info
|
9
10
|
api_action :book_ticker
|
10
11
|
api_action :order_book_depth
|
11
12
|
api_action :sub_account_assets, args: [:email]
|
12
|
-
api_action :sub_account_deposit_address
|
13
|
+
api_action :sub_account_deposit_address
|
14
|
+
api_action :sub_account_deposit_history
|
13
15
|
|
14
16
|
attribute :host
|
15
17
|
attribute :api_key
|
@@ -10,4 +10,59 @@ FactoryBot.define do
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
factory :binance_client_deposit, class: "BinanceClient::Deposit" do
|
14
|
+
sequence(:sub_account_id) { |n| n.to_s }
|
15
|
+
sequence(:address) { |n| "address#{n}" }
|
16
|
+
sequence(:address_tag) { |n| "address_tag#{n}" }
|
17
|
+
sequence(:amount) { |n| n * 10 }
|
18
|
+
sequence(:coin) { |n| "coin#{n}" }
|
19
|
+
sequence(:insert_time) { |n| Time.now }
|
20
|
+
sequence(:network) { |n| "network#{n}" }
|
21
|
+
sequence(:status) { |n| "status#{n}" }
|
22
|
+
sequence(:tx_id) { |n| "tx_id#{n}" }
|
23
|
+
sequence(:source_address) { |n| "source_address#{n}" }
|
24
|
+
sequence(:confirm_times) { |n| "#{n}/#{n}" }
|
25
|
+
end
|
26
|
+
|
27
|
+
factory :binance_client_rate_limit, class: "BinanceClient::RateLimit" do
|
28
|
+
rate_limit_type { "REQUEST_WEIGHT" }
|
29
|
+
interval { %w[SECOND MINUTE DAY].sample }
|
30
|
+
sequence(:interval_num) { |n| n }
|
31
|
+
sequence(:limit) { |n| n }
|
32
|
+
end
|
33
|
+
|
34
|
+
factory :binance_client_coin, class: "BinanceClient::Coin" do
|
35
|
+
sequence(:coin) { |n| "ASSET#{n}" }
|
36
|
+
sequence(:name) { |n| "Asset #{n}" }
|
37
|
+
free { 0.001 }
|
38
|
+
freeze { 0.001 }
|
39
|
+
ipoable { 0.002 }
|
40
|
+
ipoing { 0.003 }
|
41
|
+
locked { 0.004 }
|
42
|
+
storage { 0.005 }
|
43
|
+
withdrawing { 0.006 }
|
44
|
+
end
|
45
|
+
|
46
|
+
factory :binance_client_network, class: "BinanceClient::Network" do
|
47
|
+
address_regex { "^(bnb1)[0-9a-z]{38}$" }
|
48
|
+
coin { "BTC" }
|
49
|
+
deposit_desc { "Wallet Maintenance" }
|
50
|
+
deposit_enable { false }
|
51
|
+
is_default { false }
|
52
|
+
memo_regex { "^[0-9A-Za-z\\-_]{1,120}$" }
|
53
|
+
min_confirm { 1 }
|
54
|
+
name { "BEP2" }
|
55
|
+
network { "BNB" }
|
56
|
+
reset_address_status { false }
|
57
|
+
special_tips { "Both a MEMO is required" }
|
58
|
+
un_lock_confirm { 0 }
|
59
|
+
withdraw_desc { "Wallet Maintenance" }
|
60
|
+
withdraw_enable { false }
|
61
|
+
withdraw_fee { "0.00000220" }
|
62
|
+
withdraw_integer_multiple { "0.00000001" }
|
63
|
+
withdraw_max { "9999999999.99999999" }
|
64
|
+
withdraw_min { "0.00000440" }
|
65
|
+
same_address { true }
|
66
|
+
end
|
67
|
+
|
13
68
|
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class Coin < BaseModel
|
3
|
+
|
4
|
+
STR_METHODS = %i[
|
5
|
+
coin
|
6
|
+
name
|
7
|
+
].freeze
|
8
|
+
|
9
|
+
DECIMAL_METHODS = %i[
|
10
|
+
free
|
11
|
+
freeze
|
12
|
+
ipoable
|
13
|
+
ipoing
|
14
|
+
locked
|
15
|
+
storage
|
16
|
+
withdrawing
|
17
|
+
].freeze
|
18
|
+
|
19
|
+
BOOL_MAP = {
|
20
|
+
deposit_all_enable: :deposit_all_enabled?,
|
21
|
+
is_legal_money: :legal_money?,
|
22
|
+
trading: :trading?,
|
23
|
+
withdraw_all_enable: :withdraw_all_enabled?,
|
24
|
+
}.freeze
|
25
|
+
|
26
|
+
METHODS = (STR_METHODS + DECIMAL_METHODS + BOOL_MAP.keys).freeze
|
27
|
+
|
28
|
+
attr_accessor :raw_hash
|
29
|
+
attr_writer *METHODS
|
30
|
+
|
31
|
+
def initialize(**kwargs)
|
32
|
+
kwargs.each do |key, value|
|
33
|
+
self.send("#{key}=", value)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
STR_METHODS.each do |method_name|
|
38
|
+
define_method method_name do
|
39
|
+
memoize_results "@#{method_name}" do
|
40
|
+
raw_hash[method_name.to_s.camelcase(:lower)]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
DECIMAL_METHODS.each do |method_name|
|
46
|
+
define_method method_name do
|
47
|
+
memoize_results "@#{method_name}" do
|
48
|
+
raw_hash[method_name.to_s.camelcase(:lower)].to_d
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
BOOL_MAP.each do |original_method_name, alias_method_name|
|
54
|
+
define_method original_method_name do
|
55
|
+
memoize_results "@#{original_method_name}" do
|
56
|
+
raw_hash[original_method_name.to_s.camelcase(:lower)]
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
alias_method alias_method_name, original_method_name
|
61
|
+
end
|
62
|
+
|
63
|
+
def network_list
|
64
|
+
@network_list ||= raw_hash["networkList"].map do |network_hash|
|
65
|
+
Network.new(raw_hash: network_hash)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class Deposit < BaseModel
|
3
|
+
|
4
|
+
METHODS = %i[
|
5
|
+
sub_account_id
|
6
|
+
address
|
7
|
+
address_tag
|
8
|
+
amount
|
9
|
+
coin
|
10
|
+
network
|
11
|
+
status
|
12
|
+
tx_id
|
13
|
+
source_address
|
14
|
+
confirm_times
|
15
|
+
insert_time
|
16
|
+
].freeze
|
17
|
+
|
18
|
+
attr_accessor :raw_hash
|
19
|
+
attr_writer *METHODS
|
20
|
+
|
21
|
+
def initialize(**kwargs)
|
22
|
+
kwargs.each do |key, value|
|
23
|
+
self.send("#{key}=", value)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
METHODS.each do |method_name|
|
28
|
+
define_method method_name do
|
29
|
+
memoize_results "@#{method_name}" do
|
30
|
+
raw_hash[method_name.to_s.camelcase(:lower)]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def insert_time
|
36
|
+
@insert_time ||= Time.at(raw_hash["insertTime"] / 1_000)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class Market < BaseModel
|
3
|
+
|
4
|
+
METHODS = %i[
|
5
|
+
symbol
|
6
|
+
status
|
7
|
+
base_asset
|
8
|
+
base_asset_precision
|
9
|
+
quote_asset
|
10
|
+
quote_precision
|
11
|
+
quote_asset_precision
|
12
|
+
base_commission_precision
|
13
|
+
quote_commission_precision
|
14
|
+
order_types
|
15
|
+
iceberg_allowed
|
16
|
+
oco_allowed
|
17
|
+
quote_order_qty_market_allowed
|
18
|
+
is_spot_trading_allowed
|
19
|
+
is_margin_trading_allowed
|
20
|
+
].freeze
|
21
|
+
|
22
|
+
BOOL_MAP = {
|
23
|
+
iceberg_allowed: :iceberg_allowed?,
|
24
|
+
oco_allowed: :oco_allowed?,
|
25
|
+
quote_order_qty_market_allowed: :quote_order_qty_market_allowed?,
|
26
|
+
is_spot_trading_allowed: :spot_trading_allowed?,
|
27
|
+
is_margin_trading_allowed: :margin_trading_allowed?,
|
28
|
+
}.freeze
|
29
|
+
|
30
|
+
attr_accessor :raw_hash
|
31
|
+
attr_writer *METHODS
|
32
|
+
|
33
|
+
def initialize(**kwargs)
|
34
|
+
kwargs.each do |key, value|
|
35
|
+
self.send("#{key}=", value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
METHODS.each do |method_name|
|
40
|
+
define_method method_name do
|
41
|
+
memoize_results "@#{method_name}" do
|
42
|
+
raw_hash[method_name.to_s.camelcase(:lower)]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
BOOL_MAP.each do |original_method_name, alias_method_name|
|
48
|
+
alias_method alias_method_name, original_method_name
|
49
|
+
end
|
50
|
+
|
51
|
+
def filters
|
52
|
+
@filters ||= raw_hash["filters"].map do |filter_hash|
|
53
|
+
MarketFilter.new(raw_hash: filter_hash)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class MarketFilter
|
3
|
+
|
4
|
+
attr_reader :raw_hash
|
5
|
+
|
6
|
+
def initialize(raw_hash:)
|
7
|
+
@raw_hash = raw_hash
|
8
|
+
end
|
9
|
+
|
10
|
+
def method_missing(method_name, *args)
|
11
|
+
key = method_name.to_s.camelcase(:lower)
|
12
|
+
super if raw_hash[key].nil?
|
13
|
+
|
14
|
+
self.class.define_method method_name do
|
15
|
+
value = raw_hash[method_name.to_s.camelcase(:lower)]
|
16
|
+
|
17
|
+
value = value.to_d if value =~ /^[\d\.]+$/
|
18
|
+
|
19
|
+
value
|
20
|
+
end
|
21
|
+
send(method_name)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class Network < BaseModel
|
3
|
+
|
4
|
+
PLAIN_METHODS = %i[
|
5
|
+
address_regex
|
6
|
+
coin
|
7
|
+
deposit_desc
|
8
|
+
memo_regex
|
9
|
+
min_confirm
|
10
|
+
name
|
11
|
+
network
|
12
|
+
special_tips
|
13
|
+
un_lock_confirm
|
14
|
+
withdraw_desc
|
15
|
+
].freeze
|
16
|
+
|
17
|
+
DECIMAL_METHODS = %i[
|
18
|
+
withdraw_fee
|
19
|
+
withdraw_integer_multiple
|
20
|
+
withdraw_max
|
21
|
+
withdraw_min
|
22
|
+
].freeze
|
23
|
+
|
24
|
+
BOOL_MAP = {
|
25
|
+
deposit_enable: :deposit_enabled?,
|
26
|
+
is_default: :default?,
|
27
|
+
reset_address_status: :reset_address_status?,
|
28
|
+
withdraw_enable: :withdraw_enabled?,
|
29
|
+
same_address: :same_address?
|
30
|
+
}.freeze
|
31
|
+
|
32
|
+
METHODS = (PLAIN_METHODS + DECIMAL_METHODS + BOOL_MAP.keys).freeze
|
33
|
+
|
34
|
+
attr_accessor :raw_hash
|
35
|
+
attr_writer *METHODS
|
36
|
+
|
37
|
+
def initialize(**kwargs)
|
38
|
+
kwargs.each do |key, value|
|
39
|
+
self.send("#{key}=", value)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
PLAIN_METHODS.each do |method_name|
|
44
|
+
define_method method_name do
|
45
|
+
memoize_results "@#{method_name}" do
|
46
|
+
raw_hash[method_name.to_s.camelcase(:lower)]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
DECIMAL_METHODS.each do |method_name|
|
52
|
+
define_method method_name do
|
53
|
+
memoize_results "@#{method_name}" do
|
54
|
+
raw_hash[method_name.to_s.camelcase(:lower)].to_d
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
BOOL_MAP.each do |original_method_name, alias_method_name|
|
60
|
+
define_method original_method_name do
|
61
|
+
memoize_results "@#{original_method_name}" do
|
62
|
+
raw_hash[original_method_name.to_s.camelcase(:lower)]
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
alias_method alias_method_name, original_method_name
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class RateLimit < BaseModel
|
3
|
+
|
4
|
+
INTERVALS = %w[SECOND MINUTE DAY].freeze
|
5
|
+
METHODS = %i[
|
6
|
+
rate_limit_type
|
7
|
+
interval
|
8
|
+
interval_num
|
9
|
+
limit
|
10
|
+
].freeze
|
11
|
+
|
12
|
+
attr_accessor :raw_hash
|
13
|
+
attr_writer *METHODS
|
14
|
+
|
15
|
+
def initialize(**kwargs)
|
16
|
+
kwargs.each do |key, value|
|
17
|
+
self.send("#{key}=", value)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
METHODS.each do |method_name|
|
22
|
+
define_method method_name do
|
23
|
+
memoize_results("@#{method_name}") do
|
24
|
+
raw_hash[method_name.to_s.camelcase(:lower)]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
INTERVALS.each do |interval|
|
30
|
+
define_method "#{interval.downcase}?" do
|
31
|
+
interval == self.interval
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class SubAccountDepositHistoryRequest < AuthenticatedBaseRequest
|
3
|
+
attribute :sub_account_id, String
|
4
|
+
attribute :start_time, DateTime
|
5
|
+
attribute :end_time, DateTime
|
6
|
+
attribute :coin, String
|
7
|
+
attribute :status, Integer
|
8
|
+
attribute :limit, Integer
|
9
|
+
attribute :offset, Integer
|
10
|
+
|
11
|
+
PARAMS = [
|
12
|
+
:sub_account_id,
|
13
|
+
:start_time,
|
14
|
+
:end_time,
|
15
|
+
:coin,
|
16
|
+
:status,
|
17
|
+
:limit,
|
18
|
+
:offset,
|
19
|
+
].freeze
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def path
|
24
|
+
"/sapi/v1/broker/subAccount/depositHist"
|
25
|
+
end
|
26
|
+
|
27
|
+
def params_without_signature
|
28
|
+
PARAMS.each_with_object({}) do |param, hash|
|
29
|
+
key = param.to_s.camelcase(:lower)
|
30
|
+
value = send(param)
|
31
|
+
value = value.to_i * 1_000 if value.is_a?(DateTime)
|
32
|
+
hash[key] = value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module BinanceClient
|
2
|
+
class ExchangeInfoResponse < BaseResponse
|
3
|
+
|
4
|
+
def timezone
|
5
|
+
body["timezone"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def timezone
|
9
|
+
body["timezone"]
|
10
|
+
end
|
11
|
+
|
12
|
+
def server_time
|
13
|
+
body["serverTime"]
|
14
|
+
end
|
15
|
+
|
16
|
+
def markets
|
17
|
+
@markets ||= body["symbols"].map do |market_hash|
|
18
|
+
Market.new(raw_hash: market_hash)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
alias_method :symbols, :markets
|
22
|
+
|
23
|
+
def rate_limits
|
24
|
+
@rate_limits ||= body["rateLimits"].map do |rate_limit_hash|
|
25
|
+
RateLimit.new(raw_hash: rate_limit_hash)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
data/lib/binance_client.rb
CHANGED
@@ -3,6 +3,8 @@ require "api_client_base"
|
|
3
3
|
require "active_support/core_ext/hash/indifferent_access"
|
4
4
|
require "active_support/core_ext/object/to_query"
|
5
5
|
require "active_support/core_ext/string/inflections"
|
6
|
+
require "active_support/core_ext/date_time"
|
7
|
+
require "active_support/core_ext/integer"
|
6
8
|
require "json"
|
7
9
|
require "openssl"
|
8
10
|
|
@@ -13,25 +15,35 @@ require "binance_client/models/order_book_entry"
|
|
13
15
|
require "binance_client/models/order_book"
|
14
16
|
require "binance_client/models/asset_balance"
|
15
17
|
require "binance_client/models/deposit_address"
|
18
|
+
require "binance_client/models/market"
|
19
|
+
require "binance_client/models/market_filter"
|
20
|
+
require "binance_client/models/rate_limit"
|
21
|
+
require "binance_client/models/deposit"
|
22
|
+
require "binance_client/models/network"
|
23
|
+
require "binance_client/models/coin"
|
16
24
|
|
17
25
|
require "binance_client/requests/base_request"
|
18
26
|
require "binance_client/requests/authenticated_base_request"
|
19
27
|
require "binance_client/responses/base_response"
|
20
28
|
require "binance_client/requests/system_status_request"
|
21
29
|
require "binance_client/requests/account_snapshot_request"
|
22
|
-
require "binance_client/requests/
|
30
|
+
require "binance_client/requests/exchange_info_request"
|
31
|
+
require "binance_client/requests/coins_info_request"
|
23
32
|
require "binance_client/requests/book_ticker_request"
|
24
33
|
require "binance_client/requests/order_book_depth_request"
|
25
34
|
require "binance_client/requests/sub_account_assets_request"
|
26
35
|
require "binance_client/requests/sub_account_deposit_address_request"
|
36
|
+
require "binance_client/requests/sub_account_deposit_history_request"
|
27
37
|
require "binance_client/requests/account_request"
|
28
38
|
require "binance_client/responses/system_status_response"
|
29
39
|
require "binance_client/responses/account_snapshot_response"
|
30
|
-
require "binance_client/responses/
|
40
|
+
require "binance_client/responses/coins_info_response"
|
41
|
+
require "binance_client/responses/exchange_info_response"
|
31
42
|
require "binance_client/responses/book_ticker_response"
|
32
43
|
require "binance_client/responses/order_book_depth_response"
|
33
44
|
require "binance_client/responses/sub_account_assets_response"
|
34
45
|
require "binance_client/responses/sub_account_deposit_address_response"
|
46
|
+
require "binance_client/responses/sub_account_deposit_history_response"
|
35
47
|
require "binance_client/responses/account_response"
|
36
48
|
|
37
49
|
module BinanceClient
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binance_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AJ Villalobos
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: api_client_base
|
@@ -119,27 +119,37 @@ files:
|
|
119
119
|
- lib/binance_client/factories.rb
|
120
120
|
- lib/binance_client/models/asset_balance.rb
|
121
121
|
- lib/binance_client/models/base_model.rb
|
122
|
+
- lib/binance_client/models/coin.rb
|
123
|
+
- lib/binance_client/models/deposit.rb
|
122
124
|
- lib/binance_client/models/deposit_address.rb
|
125
|
+
- lib/binance_client/models/market.rb
|
126
|
+
- lib/binance_client/models/market_filter.rb
|
127
|
+
- lib/binance_client/models/network.rb
|
123
128
|
- lib/binance_client/models/order_book.rb
|
124
129
|
- lib/binance_client/models/order_book_entry.rb
|
130
|
+
- lib/binance_client/models/rate_limit.rb
|
125
131
|
- lib/binance_client/requests/account_request.rb
|
126
132
|
- lib/binance_client/requests/account_snapshot_request.rb
|
127
133
|
- lib/binance_client/requests/authenticated_base_request.rb
|
128
134
|
- lib/binance_client/requests/base_request.rb
|
129
135
|
- lib/binance_client/requests/book_ticker_request.rb
|
130
|
-
- lib/binance_client/requests/
|
136
|
+
- lib/binance_client/requests/coins_info_request.rb
|
137
|
+
- lib/binance_client/requests/exchange_info_request.rb
|
131
138
|
- lib/binance_client/requests/order_book_depth_request.rb
|
132
139
|
- lib/binance_client/requests/sub_account_assets_request.rb
|
133
140
|
- lib/binance_client/requests/sub_account_deposit_address_request.rb
|
141
|
+
- lib/binance_client/requests/sub_account_deposit_history_request.rb
|
134
142
|
- lib/binance_client/requests/system_status_request.rb
|
135
143
|
- lib/binance_client/responses/account_response.rb
|
136
144
|
- lib/binance_client/responses/account_snapshot_response.rb
|
137
145
|
- lib/binance_client/responses/base_response.rb
|
138
146
|
- lib/binance_client/responses/book_ticker_response.rb
|
139
|
-
- lib/binance_client/responses/
|
147
|
+
- lib/binance_client/responses/coins_info_response.rb
|
148
|
+
- lib/binance_client/responses/exchange_info_response.rb
|
140
149
|
- lib/binance_client/responses/order_book_depth_response.rb
|
141
150
|
- lib/binance_client/responses/sub_account_assets_response.rb
|
142
151
|
- lib/binance_client/responses/sub_account_deposit_address_response.rb
|
152
|
+
- lib/binance_client/responses/sub_account_deposit_history_response.rb
|
143
153
|
- lib/binance_client/responses/system_status_response.rb
|
144
154
|
- lib/binance_client/version.rb
|
145
155
|
homepage: https://github.com/bloom-solutions/binance_client-ruby
|
@@ -149,7 +159,7 @@ metadata:
|
|
149
159
|
homepage_uri: https://github.com/bloom-solutions/binance_client-ruby
|
150
160
|
source_code_uri: https://github.com/bloom-solutions/binance_client-ruby
|
151
161
|
changelog_uri: https://github.com/bloom-solutions/binance_client-ruby/CHANGELOG.md
|
152
|
-
post_install_message:
|
162
|
+
post_install_message:
|
153
163
|
rdoc_options: []
|
154
164
|
require_paths:
|
155
165
|
- lib
|
@@ -165,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
175
|
version: '0'
|
166
176
|
requirements: []
|
167
177
|
rubygems_version: 3.1.6
|
168
|
-
signing_key:
|
178
|
+
signing_key:
|
169
179
|
specification_version: 4
|
170
180
|
summary: Ruby wrapper for Binance API
|
171
181
|
test_files: []
|