binance_client 5.2.0 → 5.4.0

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
  SHA256:
3
- metadata.gz: 2da825e960057759234b17aae2722429df0a91a6e87343aa63b5177d2f0dea0f
4
- data.tar.gz: ce99de0cdae0c663a384559d780f79933985cbc8cf6f06793dde6091d185b7a0
3
+ metadata.gz: 036c0e5f781eee981ff28fe37b0c1695a34191c7b82200e74b22860ec6c8aaa0
4
+ data.tar.gz: 1f74e555a2e1d369c334e596e59ec1c43d60c653cb5e899ada7e9a60c2f85b67
5
5
  SHA512:
6
- metadata.gz: f600ea14ca7dff15ac8b9626f812eccbf0843b9cc09455d04569ae98c25894455c15ba61cc6e1dfab0b7fa50854f520d7c9fa0dad558e3436a5acfe208d56073
7
- data.tar.gz: 2014a2de0f2d412aace73888cd1ad817f4943d64c6f264df15faebae9de970bc6ae0acc045237f52a610026ba46d849f561a344faa7bb033ce2232cb5fcf7862
6
+ metadata.gz: 0eef2cba13b537a29b9e13e9d09ebd1688ea75142fd78432e6b40676e5fc9b3e13771f857f649d3e4f43142c5107e4dc9419cb4c9a3d69c84cfab1d1dc470802
7
+ data.tar.gz: 8716f5b55077d996fac7f5bbd067518b0a59e246be5b983a7b72db4a40c031e44d9233de734f59a4414d0fc490ddabc14f72efc087eebf2a656b63a241a9e959
data/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ 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
+ ## [5.4.0] - 2022-10-19
8
+ ### Added
9
+ - `#sub_accounts` to get the list of an accounts sub accounts
10
+
11
+ ## [5.3.0] - 2022-09-09
12
+ ### Added
13
+ - `#sub_account_transfer_history`
14
+
7
15
  ## [5.2.0] - 2022-05-20
8
16
  ### Added
9
17
  - `#all_orders`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- binance_client (5.2.0)
4
+ binance_client (5.4.0)
5
5
  activesupport
6
6
  api_client_base (~> 1.11)
7
7
  typhoeus
@@ -104,4 +104,4 @@ DEPENDENCIES
104
104
  webmock
105
105
 
106
106
  BUNDLED WITH
107
- 2.2.29
107
+ 2.3.21
@@ -3,8 +3,8 @@ require_relative 'lib/binance_client/version'
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "binance_client"
5
5
  spec.version = BinanceClient::VERSION
6
- spec.authors = ["AJ Villalobos"]
7
- spec.email = ["hi@ajvillalobos.com"]
6
+ spec.authors = ["Bloom Devs"]
7
+ spec.email = ["dev@bloom.solutions"]
8
8
 
9
9
  spec.summary = "Ruby wrapper for Binance API"
10
10
  spec.description = "Ruby wrapper for Binance API"
@@ -18,12 +18,14 @@ module BinanceClient
18
18
  })
19
19
  api_action :create_sub_account
20
20
  api_action :sub_account_transfer
21
+ api_action :sub_account_transfer_history
21
22
  api_action :sub_account_create_api_keys
22
23
  api_action :create_test_order
23
24
  api_action :create_order
24
25
  api_action :withdraw
25
26
  api_action :ping
26
27
  api_action :all_orders, args: [:symbol, :start_time]
28
+ api_action :sub_accounts
27
29
 
28
30
  attribute :host
29
31
  attribute :api_key
@@ -0,0 +1,37 @@
1
+ module BinanceClient
2
+ class Account
3
+
4
+ include Virtus.model
5
+
6
+ LOCAL_TO_REMOTE_ATTR_MAP = {
7
+ sub_account_id: "subaccountId",
8
+ email: "email",
9
+ tag: "tag",
10
+ maker_commission: "makerCommission",
11
+ taker_commission: "takerCommission",
12
+ margin_maker_commission: "marginMakerCommission",
13
+ margin_taker_commission: "marginTakerCommission",
14
+ create_time: "createTime",
15
+ }
16
+
17
+ attribute :sub_account_id, Integer, lazy: true, default: :default_sub_account_id
18
+ attribute :email, String, lazy: true, default: :default_email
19
+ attribute :tag, String, lazy: true, default: :default_tag
20
+ attribute :maker_commission, BigDecimal, lazy: true, default: :default_maker_commission
21
+ attribute :taker_commission, BigDecimal, lazy: true, default: :default_taker_commission
22
+ attribute :margin_maker_commission, BigDecimal, lazy: true, default: :default_margin_maker_commission
23
+ attribute :margin_taker_commission, BigDecimal, lazy: true, default: :default_margin_taker_commission
24
+ attribute :create_time, Integer, lazy: true, default: :default_create_time
25
+
26
+ attribute :raw_hash, Hash
27
+
28
+ private
29
+
30
+ LOCAL_TO_REMOTE_ATTR_MAP.each do |local_attr, remote_attr|
31
+ define_method :"default_#{local_attr}" do
32
+ raw_hash[remote_attr]
33
+ end
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,44 @@
1
+ module BinanceClient
2
+ class Transfer
3
+
4
+ attr_reader :raw_hash
5
+
6
+ def initialize(raw_hash:)
7
+ @raw_hash = raw_hash
8
+ end
9
+
10
+ def from_id
11
+ @from_id ||= raw_hash["fromId"]
12
+ end
13
+
14
+ def to_id
15
+ @to_id ||= raw_hash["toId"]
16
+ end
17
+
18
+ def asset
19
+ @asset ||= raw_hash["asset"]
20
+ end
21
+
22
+ def qty
23
+ @qty ||= raw_hash["qty"]
24
+ end
25
+
26
+ def time
27
+ @time ||= raw_hash["time"]
28
+ end
29
+
30
+ def txn_id
31
+ @txn_id ||= raw_hash["txnId"]
32
+ end
33
+
34
+ def client_tran_id
35
+ @client_tran_id ||= raw_hash["clientTranId"]
36
+ end
37
+
38
+ def status
39
+ @status ||= raw_hash["status"]
40
+ end
41
+
42
+
43
+ end
44
+ end
@@ -0,0 +1,52 @@
1
+ module BinanceClient
2
+ class SubAccountTransferHistoryRequest < AuthenticatedBaseRequest
3
+
4
+ attribute :from_id, String
5
+ attribute :to_id, String
6
+ attribute :client_tran_id, String
7
+ attribute :show_all_status, Boolean
8
+ attribute :start_time, Integer
9
+ attribute :end_time, Integer
10
+ attribute :page, Integer
11
+ attribute :limit, Integer
12
+
13
+ def start_time=(datetime)
14
+ return if datetime.nil?
15
+ @start_time = datetime.to_i * 1_000
16
+ end
17
+
18
+ def end_time=(datetime)
19
+ return if datetime.nil?
20
+ @end_time = datetime.to_i * 1_000
21
+ end
22
+
23
+ private
24
+
25
+ def path
26
+ "/sapi/v1/broker/transfer"
27
+ end
28
+
29
+ def default_action
30
+ :get
31
+ end
32
+
33
+ def params_without_signature
34
+ %i[
35
+ fromId
36
+ toId
37
+ clientTranId
38
+ showAllStatus
39
+ startTime
40
+ endTime
41
+ page
42
+ limit
43
+ ].each_with_object({}) do |attr, hash|
44
+ val = send(attr.to_s.underscore)
45
+
46
+ next if val.nil?
47
+
48
+ hash[attr] = val
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,21 @@
1
+ module BinanceClient
2
+ class SubAccountsRequest < AuthenticatedBaseRequest
3
+
4
+ attribute :sub_account_id, Integer
5
+ attribute :page, Integer
6
+ attribute :size, Integer
7
+
8
+ private
9
+
10
+ def path
11
+ "/sapi/v1/broker/subAccount"
12
+ end
13
+
14
+ def params_without_signature
15
+ %i[sub_account_id page size].each_with_object({}) do |attr, hash|
16
+ hash[attr.to_s.camelcase(:lower)] = send(attr)
17
+ end
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ module BinanceClient
2
+ class SubAccountTransferHistoryResponse < BaseResponse
3
+
4
+ def transfers
5
+ @transfers ||= body.map do |hash|
6
+ Transfer.new(raw_hash: hash)
7
+ end
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,16 @@
1
+ module BinanceClient
2
+ class SubAccountsResponse < BaseResponse
3
+
4
+ attribute(:sub_accounts, Array[BinanceClient::Account], {
5
+ lazy: true,
6
+ default: :default_sub_accounts,
7
+ })
8
+
9
+ def default_sub_accounts
10
+ body.map do |sub_account_hash|
11
+ Account.new(raw_hash: sub_account_hash)
12
+ end
13
+ end
14
+
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module BinanceClient
2
- VERSION = "5.2.0"
2
+ VERSION = "5.4.0"
3
3
  end
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: 5.2.0
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
- - AJ Villalobos
8
- autorequire:
7
+ - Bloom Devs
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-20 00:00:00.000000000 Z
11
+ date: 2022-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api_client_base
@@ -110,7 +110,7 @@ dependencies:
110
110
  version: '0'
111
111
  description: Ruby wrapper for Binance API
112
112
  email:
113
- - hi@ajvillalobos.com
113
+ - dev@bloom.solutions
114
114
  executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
@@ -132,6 +132,7 @@ files:
132
132
  - lib/binance_client/client.rb
133
133
  - lib/binance_client/factories.rb
134
134
  - lib/binance_client/loader.rb
135
+ - lib/binance_client/models/account.rb
135
136
  - lib/binance_client/models/asset_balance.rb
136
137
  - lib/binance_client/models/base_model.rb
137
138
  - lib/binance_client/models/book_ticker.rb
@@ -146,6 +147,7 @@ files:
146
147
  - lib/binance_client/models/order_book_entry.rb
147
148
  - lib/binance_client/models/order_fill.rb
148
149
  - lib/binance_client/models/rate_limit.rb
150
+ - lib/binance_client/models/transfer.rb
149
151
  - lib/binance_client/requests/account_request.rb
150
152
  - lib/binance_client/requests/account_snapshot_request.rb
151
153
  - lib/binance_client/requests/all_orders_request.rb
@@ -166,7 +168,9 @@ files:
166
168
  - lib/binance_client/requests/sub_account_deposit_address_request.rb
167
169
  - lib/binance_client/requests/sub_account_deposit_history_request.rb
168
170
  - lib/binance_client/requests/sub_account_set_spot_bnb_burn_request.rb
171
+ - lib/binance_client/requests/sub_account_transfer_history_request.rb
169
172
  - lib/binance_client/requests/sub_account_transfer_request.rb
173
+ - lib/binance_client/requests/sub_accounts_request.rb
170
174
  - lib/binance_client/requests/system_status_request.rb
171
175
  - lib/binance_client/requests/withdraw_request.rb
172
176
  - lib/binance_client/responses/account_response.rb
@@ -188,7 +192,9 @@ files:
188
192
  - lib/binance_client/responses/sub_account_deposit_address_response.rb
189
193
  - lib/binance_client/responses/sub_account_deposit_history_response.rb
190
194
  - lib/binance_client/responses/sub_account_set_spot_bnb_burn_response.rb
195
+ - lib/binance_client/responses/sub_account_transfer_history_response.rb
191
196
  - lib/binance_client/responses/sub_account_transfer_response.rb
197
+ - lib/binance_client/responses/sub_accounts_response.rb
192
198
  - lib/binance_client/responses/system_status_response.rb
193
199
  - lib/binance_client/responses/withdraw_response.rb
194
200
  - lib/binance_client/version.rb
@@ -199,7 +205,7 @@ metadata:
199
205
  homepage_uri: https://github.com/bloom-solutions/binance_client-ruby
200
206
  source_code_uri: https://github.com/bloom-solutions/binance_client-ruby
201
207
  changelog_uri: https://github.com/bloom-solutions/binance_client-ruby/CHANGELOG.md
202
- post_install_message:
208
+ post_install_message:
203
209
  rdoc_options: []
204
210
  require_paths:
205
211
  - lib
@@ -215,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
221
  version: '0'
216
222
  requirements: []
217
223
  rubygems_version: 3.1.6
218
- signing_key:
224
+ signing_key:
219
225
  specification_version: 4
220
226
  summary: Ruby wrapper for Binance API
221
227
  test_files: []