binance_client 5.0.0 → 5.3.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: d50e294eccbbcabd5b1488a01cba18e55e78291d7027595f746e744fac3c47ba
4
- data.tar.gz: e4476ae6a531184f71a36bad4c96a8c764d45f366539c355269ebd8abbf9f834
3
+ metadata.gz: 2195d7329ae93172557f7e71ac420c55161aca2120a7293f4fc7c9158dcad7f1
4
+ data.tar.gz: bcbfc894402374fffc73c8938285dccc3168d7afb8dc0d92c08486c9866aed94
5
5
  SHA512:
6
- metadata.gz: 58e58894781ab8f2e1127b592d8df250bfe27000591aebc1dab2550a0f0d49ed5ec58d086641e9cdcabfc471cc5515e5b2c26c98d77c80e2b1649400a5e827b4
7
- data.tar.gz: ace12fc8592ab5f794542bb340a15730647edf24d385c495a4638186c7a0b2533a6025bcb3d1404715a8317bffd92448e8355c56ad74ece8028b1eff0367d3e8
6
+ metadata.gz: daef5aec2386eae6531bc72fa52610ca5de40074cae5ed1e69fa9f17f16921477696b767ea7a61fff50ec97e947293401e543616c7f58cf7b8fa5d0e2354c49a
7
+ data.tar.gz: 4b6b8e314fda53a36151cd85fca2cd0d435d7c7ecca087dae49c9c47648a962f14fc4cd90d8346556a0dced4e17b91bdea6efb605128a33319dc28c8adb21d33
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ 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.3.0] - 2022-09-09
8
+ ### Added
9
+ - `#sub_account_transfer_history`
10
+
11
+ ## [5.2.0] - 2022-05-20
12
+ ### Added
13
+ - `#all_orders`
14
+
15
+ ## [5.1.0] - 2022-04-22
16
+ ### Added
17
+ - `#ping`
18
+
7
19
  ## [5.0.0] - 2022-04-06
8
20
  ### Added
9
21
  - `#sub_account_bnb_burn_status`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- binance_client (5.0.0)
4
+ binance_client (5.3.0)
5
5
  activesupport
6
6
  api_client_base (~> 1.11)
7
7
  typhoeus
@@ -18,10 +18,13 @@ 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
26
+ api_action :ping
27
+ api_action :all_orders, args: [:symbol, :start_time]
25
28
 
26
29
  attribute :host
27
30
  attribute :api_key
@@ -0,0 +1,23 @@
1
+ module BinanceClient
2
+ class Order
3
+ attr_reader :symbol
4
+ attr_reader :executed_quantity
5
+ attr_reader :cummulative_quote_quantity
6
+ attr_reader :order_id
7
+ attr_reader :side
8
+
9
+ def initialize(
10
+ symbol:,
11
+ executed_quantity:,
12
+ cummulative_quote_quantity:,
13
+ order_id:,
14
+ side:
15
+ )
16
+ @symbol = symbol
17
+ @executed_quantity = executed_quantity
18
+ @cummulative_quote_quantity = cummulative_quote_quantity
19
+ @order_id = order_id
20
+ @side = side
21
+ end
22
+ end
23
+ 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,17 @@
1
+ module BinanceClient
2
+ class AllOrdersRequest < AuthenticatedBaseRequest
3
+ attribute :symbol, String
4
+ attribute :start_time, Integer
5
+
6
+ def path
7
+ "/api/v3/allOrders"
8
+ end
9
+
10
+ def params_without_signature
11
+ {
12
+ symbol: symbol,
13
+ startTime: start_time
14
+ }
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ module BinanceClient
2
+ class PingRequest < BaseRequest
3
+
4
+ private
5
+
6
+ def path
7
+ "/api/v3/ping"
8
+ end
9
+
10
+ end
11
+ 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,15 @@
1
+ module BinanceClient
2
+ class AllOrdersResponse < BaseResponse
3
+ def orders
4
+ body.map do |hash|
5
+ Order.new({
6
+ symbol: hash["symbol"],
7
+ executed_quantity: hash["executedQty"],
8
+ cummulative_quote_quantity: hash["cummulativeQuoteQty"],
9
+ order_id: hash["orderId"],
10
+ side: hash["side"],
11
+ })
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module BinanceClient
2
+ class PingResponse < BaseResponse
3
+
4
+ end
5
+ 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
@@ -1,3 +1,3 @@
1
1
  module BinanceClient
2
- VERSION = "5.0.0"
2
+ VERSION = "5.3.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.0.0
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AJ Villalobos
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-06 00:00:00.000000000 Z
11
+ date: 2022-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: api_client_base
@@ -141,12 +141,15 @@ files:
141
141
  - lib/binance_client/models/market.rb
142
142
  - lib/binance_client/models/market_filter.rb
143
143
  - lib/binance_client/models/network.rb
144
+ - lib/binance_client/models/order.rb
144
145
  - lib/binance_client/models/order_book.rb
145
146
  - lib/binance_client/models/order_book_entry.rb
146
147
  - lib/binance_client/models/order_fill.rb
147
148
  - lib/binance_client/models/rate_limit.rb
149
+ - lib/binance_client/models/transfer.rb
148
150
  - lib/binance_client/requests/account_request.rb
149
151
  - lib/binance_client/requests/account_snapshot_request.rb
152
+ - lib/binance_client/requests/all_orders_request.rb
150
153
  - lib/binance_client/requests/authenticated_base_request.rb
151
154
  - lib/binance_client/requests/base_create_order_request.rb
152
155
  - lib/binance_client/requests/base_request.rb
@@ -157,17 +160,20 @@ files:
157
160
  - lib/binance_client/requests/create_test_order_request.rb
158
161
  - lib/binance_client/requests/exchange_info_request.rb
159
162
  - lib/binance_client/requests/order_book_depth_request.rb
163
+ - lib/binance_client/requests/ping_request.rb
160
164
  - lib/binance_client/requests/sub_account_assets_request.rb
161
165
  - lib/binance_client/requests/sub_account_bnb_burn_status_request.rb
162
166
  - lib/binance_client/requests/sub_account_create_api_keys_request.rb
163
167
  - lib/binance_client/requests/sub_account_deposit_address_request.rb
164
168
  - lib/binance_client/requests/sub_account_deposit_history_request.rb
165
169
  - lib/binance_client/requests/sub_account_set_spot_bnb_burn_request.rb
170
+ - lib/binance_client/requests/sub_account_transfer_history_request.rb
166
171
  - lib/binance_client/requests/sub_account_transfer_request.rb
167
172
  - lib/binance_client/requests/system_status_request.rb
168
173
  - lib/binance_client/requests/withdraw_request.rb
169
174
  - lib/binance_client/responses/account_response.rb
170
175
  - lib/binance_client/responses/account_snapshot_response.rb
176
+ - lib/binance_client/responses/all_orders_response.rb
171
177
  - lib/binance_client/responses/base_create_order_response.rb
172
178
  - lib/binance_client/responses/base_response.rb
173
179
  - lib/binance_client/responses/book_ticker_response.rb
@@ -177,12 +183,14 @@ files:
177
183
  - lib/binance_client/responses/create_test_order_response.rb
178
184
  - lib/binance_client/responses/exchange_info_response.rb
179
185
  - lib/binance_client/responses/order_book_depth_response.rb
186
+ - lib/binance_client/responses/ping_response.rb
180
187
  - lib/binance_client/responses/sub_account_assets_response.rb
181
188
  - lib/binance_client/responses/sub_account_bnb_burn_status_response.rb
182
189
  - lib/binance_client/responses/sub_account_create_api_keys_response.rb
183
190
  - lib/binance_client/responses/sub_account_deposit_address_response.rb
184
191
  - lib/binance_client/responses/sub_account_deposit_history_response.rb
185
192
  - lib/binance_client/responses/sub_account_set_spot_bnb_burn_response.rb
193
+ - lib/binance_client/responses/sub_account_transfer_history_response.rb
186
194
  - lib/binance_client/responses/sub_account_transfer_response.rb
187
195
  - lib/binance_client/responses/system_status_response.rb
188
196
  - lib/binance_client/responses/withdraw_response.rb