binance-connector-ruby 1.5.2 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +128 -0
- data/lib/binance/session.rb +2 -1
- data/lib/binance/spot/c2c.rb +2 -2
- data/lib/binance/spot/convert.rb +134 -2
- data/lib/binance/spot/fiat.rb +3 -3
- data/lib/binance/spot/loan.rb +221 -7
- data/lib/binance/spot/margin.rb +104 -231
- data/lib/binance/spot/market.rb +73 -14
- data/lib/binance/spot/mining.rb +13 -13
- data/lib/binance/spot/simple_earn.rb +44 -24
- data/lib/binance/spot/stream.rb +1 -1
- data/lib/binance/spot/subaccount.rb +205 -52
- data/lib/binance/spot/trade.rb +94 -30
- data/lib/binance/spot/wallet.rb +140 -22
- data/lib/binance/spot/websocket.rb +23 -11
- data/lib/binance/spot.rb +1 -5
- data/lib/binance/version.rb +1 -1
- metadata +2 -4
- data/lib/binance/spot/blvt.rb +0 -104
- data/lib/binance/spot/futures.rb +0 -357
data/lib/binance/spot/trade.rb
CHANGED
@@ -8,7 +8,7 @@ module Binance
|
|
8
8
|
# - cancel orders (spot and oco)
|
9
9
|
# - account information
|
10
10
|
# - my trades
|
11
|
-
# @see https://binance
|
11
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api
|
12
12
|
module Trade
|
13
13
|
# TestNew Order
|
14
14
|
#
|
@@ -29,7 +29,7 @@ module Binance
|
|
29
29
|
# @option kwargs [Float] :icebergeQty
|
30
30
|
# @option kwargs [String] :newOrderRespType Set the response JSON. ACK, RESULT, or FULL.
|
31
31
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
32
|
-
# @see https://binance
|
32
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#test-new-order-trade
|
33
33
|
def new_order_test(symbol:, side:, type:, **kwargs)
|
34
34
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
35
35
|
Binance::Utils::Validation.require_param('side', side)
|
@@ -61,7 +61,7 @@ module Binance
|
|
61
61
|
# @option kwargs [Float] :icebergeQty
|
62
62
|
# @option kwargs [String] :newOrderRespType Set the response JSON. ACK, RESULT, or FULL.
|
63
63
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
64
|
-
# @see https://binance
|
64
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-trade
|
65
65
|
def new_order(symbol:, side:, type:, **kwargs)
|
66
66
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
67
67
|
Binance::Utils::Validation.require_param('side', side)
|
@@ -84,7 +84,7 @@ module Binance
|
|
84
84
|
# @option kwargs [String] :origClientOrderId
|
85
85
|
# @option kwargs [String] :newClientOrderId
|
86
86
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
87
|
-
# @see https://binance
|
87
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-order-trade
|
88
88
|
def cancel_order(symbol:, **kwargs)
|
89
89
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
90
90
|
|
@@ -98,7 +98,7 @@ module Binance
|
|
98
98
|
# @param symbol [String] the symbol
|
99
99
|
# @param kwargs [Hash]
|
100
100
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
101
|
-
# @see https://binance
|
101
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-all-open-orders-on-a-symbol-trade
|
102
102
|
def cancel_open_orders(symbol:, **kwargs)
|
103
103
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
104
104
|
|
@@ -114,7 +114,7 @@ module Binance
|
|
114
114
|
# @option kwargs [Integer] :orderId
|
115
115
|
# @option kwargs [String] :origClientOrderId
|
116
116
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
117
|
-
# @see https://binance
|
117
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-order-user_data
|
118
118
|
def get_order(symbol:, **kwargs)
|
119
119
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
120
120
|
|
@@ -128,7 +128,7 @@ module Binance
|
|
128
128
|
# @param kwargs [Hash]
|
129
129
|
# @option kwargs [String] :symbol the symbol
|
130
130
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
131
|
-
# @see https://binance
|
131
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#current-open-orders-user_data
|
132
132
|
def open_orders(**kwargs)
|
133
133
|
@session.sign_request(:get, '/api/v3/openOrders', params: kwargs)
|
134
134
|
end
|
@@ -146,7 +146,7 @@ module Binance
|
|
146
146
|
# @option kwargs [String] :endTime
|
147
147
|
# @option kwargs [String] :limit Default 500; max 1000.
|
148
148
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
149
|
-
# @see https://binance
|
149
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#all-orders-user_data
|
150
150
|
def all_orders(symbol:, **kwargs)
|
151
151
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
152
152
|
|
@@ -162,32 +162,42 @@ module Binance
|
|
162
162
|
# @param symbol [String] the symbol
|
163
163
|
# @param side [String]
|
164
164
|
# @param quantity [Float]
|
165
|
-
# @param
|
166
|
-
# @param
|
165
|
+
# @param aboveType [String]
|
166
|
+
# @param belowType [String]
|
167
167
|
# @param kwargs [Hash]
|
168
168
|
# @option kwargs [String] :listClientOrderId
|
169
|
-
# @option kwargs [String] :
|
170
|
-
# @option kwargs [
|
171
|
-
# @option kwargs [
|
172
|
-
# @option kwargs [Float] :
|
173
|
-
# @option kwargs [
|
174
|
-
# @option kwargs [Float] :
|
169
|
+
# @option kwargs [String] :aboveClientOrderId Arbitrary unique ID among open orders for the above order. Automatically generated if not sent
|
170
|
+
# @option kwargs [Integer] :aboveIcebergQty Note that this can only be used if aboveTimeInForce is GTC
|
171
|
+
# @option kwargs [Float] :abovePrice
|
172
|
+
# @option kwargs [Float] :aboveStopPriceCan be used if aboveType is STOP_LOSS or STOP_LOSS_LIMIT. Either aboveStopPrice or aboveTrailingDelta or both, must be specified.
|
173
|
+
# @option kwargs [Integer] :aboveTrailingDelta
|
174
|
+
# @option kwargs [Float] :aboveTimeInForce Required if the aboveType is STOP_LOSS_LIMIT.
|
175
|
+
# @option kwargs [Integer] :aboveStrategyId Arbitrary numeric value identifying the above order within an order strategy.
|
176
|
+
# @option kwargs [Integer] :aboveStrategyType Arbitrary numeric value identifying the above order strategy. Values smaller than 1000000 are reserved and cannot be used.
|
177
|
+
# @option kwargs [String] :belowClientOrderId Arbitrary unique ID among open orders for the below order. Automatically generated if not sent
|
178
|
+
# @option kwargs [Integer] :belowIcebergQty Note that this can only be used if belowTimeInForce is GTC
|
179
|
+
# @option kwargs [Float] :belowPrice Can be used if belowType is STOP_LOSS_LIMIT or LIMIT_MAKER to specify the limit price.
|
180
|
+
# @option kwargs [Float] :belowStopPrice Can be used if belowType is STOP_LOSS or STOP_LOSS_LIMIT. Either belowStopPrice or belowTrailingDelta or both, must be specified.
|
181
|
+
# @option kwargs [Integer] :belowTrailingDelta
|
182
|
+
# @option kwargs [String] :belowTimeInForce Required if the belowType is STOP_LOSS_LIMIT
|
183
|
+
# @option kwargs [Integer] :belowStrategyId Arbitrary numeric value identifying the below order within an order strategy
|
184
|
+
# @option kwargs [String] :belowStrategyType Arbitrary numeric value identifying the below order strategy. Values smaller than 1000000 are reserved and cannot be used.
|
175
185
|
# @option kwargs [String] :newOrderRespType
|
176
186
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
177
|
-
# @see https://binance
|
178
|
-
def new_oco_order(symbol:, side:, quantity:,
|
187
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-list---oco-trade
|
188
|
+
def new_oco_order(symbol:, side:, quantity:, aboveType:, belowType:, **kwargs)
|
179
189
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
180
190
|
Binance::Utils::Validation.require_param('side', side)
|
181
191
|
Binance::Utils::Validation.require_param('quantity', quantity)
|
182
|
-
Binance::Utils::Validation.require_param('
|
183
|
-
Binance::Utils::Validation.require_param('
|
192
|
+
Binance::Utils::Validation.require_param('aboveType', aboveType)
|
193
|
+
Binance::Utils::Validation.require_param('belowType', belowType)
|
184
194
|
|
185
195
|
@session.sign_request(:post, '/api/v3/order/oco', params: kwargs.merge(
|
186
196
|
symbol: symbol,
|
187
197
|
side: side,
|
188
198
|
quantity: quantity,
|
189
|
-
|
190
|
-
|
199
|
+
aboveType: aboveType,
|
200
|
+
belowType: belowType
|
191
201
|
))
|
192
202
|
end
|
193
203
|
|
@@ -201,7 +211,7 @@ module Binance
|
|
201
211
|
# @option kwargs [String] :listClientOrderId
|
202
212
|
# @option kwargs [String] :newClientOrderId
|
203
213
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
204
|
-
# @see https://binance
|
214
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-order-list-trade
|
205
215
|
def cancel_order_list(symbol:, **kwargs)
|
206
216
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
207
217
|
|
@@ -218,7 +228,7 @@ module Binance
|
|
218
228
|
# @option kwargs [Integer] :orderListId
|
219
229
|
# @option kwargs [String] :orgClientOrderId
|
220
230
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
221
|
-
# @see https://binance
|
231
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-order-list-user_data
|
222
232
|
def order_list(**kwargs)
|
223
233
|
@session.sign_request(:get, '/api/v3/orderList', params: kwargs)
|
224
234
|
end
|
@@ -235,7 +245,7 @@ module Binance
|
|
235
245
|
# @option kwargs [String] :endTime
|
236
246
|
# @option kwargs [String] :limit Default 500; max 1000.
|
237
247
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
238
|
-
# @see https://binance
|
248
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-all-order-lists-user_data
|
239
249
|
def all_order_list(**kwargs)
|
240
250
|
@session.sign_request(:get, '/api/v3/allOrderList', params: kwargs)
|
241
251
|
end
|
@@ -246,7 +256,7 @@ module Binance
|
|
246
256
|
#
|
247
257
|
# @param kwargs [Hash]
|
248
258
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
249
|
-
# @see https://binance
|
259
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-open-order-lists-user_data
|
250
260
|
def open_order_list(**kwargs)
|
251
261
|
@session.sign_request(:get, '/api/v3/openOrderList', params: kwargs)
|
252
262
|
end
|
@@ -257,7 +267,7 @@ module Binance
|
|
257
267
|
#
|
258
268
|
# @param kwargs [Hash]
|
259
269
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
260
|
-
# @see https://binance
|
270
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#account-information-user_data
|
261
271
|
def account(**kwargs)
|
262
272
|
@session.sign_request(:get, '/api/v3/account', params: kwargs)
|
263
273
|
end
|
@@ -274,7 +284,7 @@ module Binance
|
|
274
284
|
# @option kwargs [Integer] :fromId TradeId to fetch from. Default gets most recent trades.
|
275
285
|
# @option kwargs [Integer] :limit Default 500; max 1000.
|
276
286
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
277
|
-
# @see https://binance
|
287
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#account-trade-list-user_data
|
278
288
|
def my_trades(symbol:, **kwargs)
|
279
289
|
@session.sign_request(:get, '/api/v3/myTrades', params: kwargs.merge(symbol: symbol))
|
280
290
|
end
|
@@ -285,11 +295,59 @@ module Binance
|
|
285
295
|
#
|
286
296
|
# @param kwargs [Hash]
|
287
297
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
288
|
-
# @see https://binance
|
298
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-unfilled-order-count-user_data
|
289
299
|
def get_order_rate_limit(**kwargs)
|
290
300
|
@session.sign_request(:get, '/api/v3/rateLimit/order', params: kwargs)
|
291
301
|
end
|
292
302
|
|
303
|
+
# Query Prevented Matches (USER_DATA)
|
304
|
+
#
|
305
|
+
# GET /api/v3/myPreventedMatches
|
306
|
+
#
|
307
|
+
# @param symbol [String]
|
308
|
+
# @param kwargs [Hash]
|
309
|
+
# @param kwargs [Integer] :preventedMatchId
|
310
|
+
# @param kwargs [Integer] :orderId
|
311
|
+
# @param kwargs [Integer] :fromPreventedMatchId
|
312
|
+
# @param kwargs [Integer] :limit Default: 500; Max: 1000
|
313
|
+
# @param kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
314
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-prevented-matches-user_data
|
315
|
+
def my_prevented_matches(symbol:, **kwargs)
|
316
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
317
|
+
|
318
|
+
@session.sign_request(:get, '/api/v3/myPreventedMatches', params: kwargs.merge(symbol: symbol))
|
319
|
+
end
|
320
|
+
|
321
|
+
# Query Allocations (USER_DATA)
|
322
|
+
#
|
323
|
+
# GET /api/v3/myAllocations
|
324
|
+
#
|
325
|
+
# @param symbol [String]
|
326
|
+
# @param kwargs [Hash]
|
327
|
+
# @param kwargs [Integer] :startTime
|
328
|
+
# @param kwargs [Integer] :endTime
|
329
|
+
# @param kwargs [Integer] :fromAllocationId
|
330
|
+
# @param kwargs [Integer] :limit Default 500;Max 1000
|
331
|
+
# @param kwargs [Integer] :orderId
|
332
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-allocations-user_data
|
333
|
+
def my_allocations(symbol:, **kwargs)
|
334
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
335
|
+
|
336
|
+
@session.sign_request(:get, '/api/v3/myAllocations', params: kwargs.merge(symbol: symbol))
|
337
|
+
end
|
338
|
+
|
339
|
+
# Query Commission Rates (USER_DATA)
|
340
|
+
#
|
341
|
+
# GET /api/v3/account/commission
|
342
|
+
#
|
343
|
+
# @param symbol [String]
|
344
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-commission-rates-user_data
|
345
|
+
def commission_rate(symbol:)
|
346
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
347
|
+
|
348
|
+
@session.sign_request(:get, '/api/v3/account/commission', params: { symbol: symbol })
|
349
|
+
end
|
350
|
+
|
293
351
|
# Cancel an Existing Order and Send a New Order (TRADE)
|
294
352
|
#
|
295
353
|
# POST /api/v3/order/cancelReplace
|
@@ -307,12 +365,18 @@ module Binance
|
|
307
365
|
# @option kwargs [String] :cancelOrigClientOrderId
|
308
366
|
# @option kwargs [Integer] :cancelOrderId
|
309
367
|
# @option kwargs [String] :newClientOrderId
|
368
|
+
# @option kwargs [Integer] :strategyId
|
369
|
+
# @option kwargs [Integer] :strategyType The value cannot be less than 1000000
|
310
370
|
# @option kwargs [Float] :stopPrice
|
311
371
|
# @option kwargs [Integer] :trailingDelta
|
312
372
|
# @option kwargs [Float] :icebergQty
|
313
373
|
# @option kwargs [String] :newOrderRespType
|
374
|
+
# @option kwargs [String] :selfTradePreventionMode The allowed enums is dependent on what is configured on the symbo
|
375
|
+
# @option kwargs [String] :cancelRestrictions ONLY_NEW - Cancel will succeed if the order status is NEW. ONLY_PARTIALLY_FILLED - Cancel will succeed if order status is PARTIALLY_FILLED
|
376
|
+
# @option kwargs [String] :orderRateLimitExceededMode DO_NOTHING (default)- will only attempt to cancel the order if account has not exceeded the unfilled order rate limit
|
377
|
+
# CANCEL_ONLY - will always cancel the order
|
314
378
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
315
|
-
# @see https://binance
|
379
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-an-existing-order-and-send-a-new-order-trade
|
316
380
|
def cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs)
|
317
381
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
318
382
|
Binance::Utils::Validation.require_param('side', side)
|
data/lib/binance/spot/wallet.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Binance
|
4
4
|
class Spot
|
5
5
|
# all wallet endpoints
|
6
|
-
# @see https://binance
|
6
|
+
# @see https://developers.binance.com/docs/wallet/introduction
|
7
7
|
module Wallet
|
8
8
|
# System Status (System)
|
9
9
|
#
|
@@ -11,11 +11,22 @@ module Binance
|
|
11
11
|
#
|
12
12
|
# Fetch system status.
|
13
13
|
#
|
14
|
-
# @see https://binance
|
14
|
+
# @see https://developers.binance.com/docs/wallet/others/system-status
|
15
15
|
def system_status
|
16
16
|
@session.public_request(path: '/sapi/v1/system/status')
|
17
17
|
end
|
18
18
|
|
19
|
+
# Get symbols delist schedule for spot (MARKET_DATA)
|
20
|
+
#
|
21
|
+
# GET /sapi/v1/spot/delist-schedule
|
22
|
+
#
|
23
|
+
# @param kwargs [Hash]
|
24
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
25
|
+
# @see https://developers.binance.com/docs/wallet/others/delist-schedule
|
26
|
+
def delist_schedule(**kwargs)
|
27
|
+
@session.public_request(path: '/sapi/v1/spot/delist-schedule', params: kwargs)
|
28
|
+
end
|
29
|
+
|
19
30
|
# All Coins' Information (USER_DATA)
|
20
31
|
#
|
21
32
|
# GET /sapi/v1/capital/config/getall
|
@@ -24,7 +35,7 @@ module Binance
|
|
24
35
|
#
|
25
36
|
# @param kwargs [Hash]
|
26
37
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
27
|
-
# @see https://binance
|
38
|
+
# @see https://developers.binance.com/docs/wallet/capital/all-coins-info
|
28
39
|
def coin_info(**kwargs)
|
29
40
|
@session.sign_request(:get, '/sapi/v1/capital/config/getall', params: kwargs)
|
30
41
|
end
|
@@ -39,7 +50,7 @@ module Binance
|
|
39
50
|
# @option kwargs [Integer] :endTime
|
40
51
|
# @option kwargs [Integer] :limit min 5, max 30, default 5
|
41
52
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
42
|
-
# @see https://binance
|
53
|
+
# @see https://developers.binance.com/docs/wallet/account/daily-account-snapshoot
|
43
54
|
def account_snapshot(type:, **kwargs)
|
44
55
|
Binance::Utils::Validation.require_param('type', type)
|
45
56
|
|
@@ -54,7 +65,7 @@ module Binance
|
|
54
65
|
#
|
55
66
|
# @param kwargs [Hash]
|
56
67
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
57
|
-
# @see https://binance
|
68
|
+
# @see https://developers.binance.com/docs/wallet/account/disable-fast-withdraw-switch
|
58
69
|
def disable_fast_withdraw(**kwargs)
|
59
70
|
@session.sign_request(:post, '/sapi/v1/account/disableFastWithdrawSwitch', params: kwargs)
|
60
71
|
end
|
@@ -65,7 +76,7 @@ module Binance
|
|
65
76
|
#
|
66
77
|
# @param kwargs [Hash]
|
67
78
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
68
|
-
# @see https://binance
|
79
|
+
# @see https://developers.binance.com/docs/wallet/account/enable-fast-withdraw-switch
|
69
80
|
def enable_fast_withdraw(**kwargs)
|
70
81
|
@session.sign_request(:post, '/sapi/v1/account/enableFastWithdrawSwitch', params: kwargs)
|
71
82
|
end
|
@@ -84,7 +95,7 @@ module Binance
|
|
84
95
|
# @option kwargs [Boolean] :transactionFeeFlag
|
85
96
|
# @option kwargs [String] :name
|
86
97
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
87
|
-
# @see https://binance
|
98
|
+
# @see https://developers.binance.com/docs/wallet/capital/withdraw
|
88
99
|
def withdraw(coin:, address:, amount:, **kwargs)
|
89
100
|
Binance::Utils::Validation.require_param('coin', coin)
|
90
101
|
Binance::Utils::Validation.require_param('address', address)
|
@@ -109,7 +120,7 @@ module Binance
|
|
109
120
|
# @option kwargs [Integer] :offest Default:0
|
110
121
|
# @option kwargs [Integer] :limit Default:1000, Max:1000
|
111
122
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
112
|
-
# @see https://binance
|
123
|
+
# @see https://developers.binance.com/docs/wallet/capital/deposite-history
|
113
124
|
def deposit_history(**kwargs)
|
114
125
|
@session.sign_request(:get, '/sapi/v1/capital/deposit/hisrec', params: kwargs)
|
115
126
|
end
|
@@ -127,7 +138,7 @@ module Binance
|
|
127
138
|
# @option kwargs [Integer] :offest
|
128
139
|
# @option kwargs [Integer] :limit
|
129
140
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
130
|
-
# @see https://binance
|
141
|
+
# @see https://developers.binance.com/docs/wallet/capital/withdraw-history
|
131
142
|
def withdraw_history(**kwargs)
|
132
143
|
@session.sign_request(:get, '/sapi/v1/capital/withdraw/history', params: kwargs)
|
133
144
|
end
|
@@ -140,7 +151,7 @@ module Binance
|
|
140
151
|
# @param kwargs [Hash]
|
141
152
|
# @option kwargs [String] :network
|
142
153
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
143
|
-
# @see https://binance
|
154
|
+
# @see https://developers.binance.com/docs/wallet/capital/withdraw-history
|
144
155
|
def deposit_address(coin:, **kwargs)
|
145
156
|
Binance::Utils::Validation.require_param('coin', coin)
|
146
157
|
|
@@ -149,6 +160,36 @@ module Binance
|
|
149
160
|
))
|
150
161
|
end
|
151
162
|
|
163
|
+
# Fetch deposit address list with network (USER_DATA)
|
164
|
+
#
|
165
|
+
# GET /sapi/v1/capital/deposit/address/list
|
166
|
+
#
|
167
|
+
# @param coin [String] coin refers to the parent network address format that the address is using
|
168
|
+
# @param kwargs [Hash]
|
169
|
+
# @option kwargs [String] :network
|
170
|
+
# @see https://developers.binance.com/docs/wallet/capital/fetch-deposit-address-list-with-network
|
171
|
+
def deposit_address_list(coin:, **kwargs)
|
172
|
+
Binance::Utils::Validation.require_param('coin', coin)
|
173
|
+
|
174
|
+
@session.sign_request(:get, '/sapi/v1/capital/deposit/address/list', params: kwargs.merge(
|
175
|
+
coin: coin
|
176
|
+
))
|
177
|
+
end
|
178
|
+
|
179
|
+
# One click arrival deposit apply (for expired address deposit) (USER_DATA)
|
180
|
+
#
|
181
|
+
# POST /sapi/v1/capital/deposit/credit-apply
|
182
|
+
#
|
183
|
+
# @param kwargs [Hash]
|
184
|
+
# @option kwargs [String] :depositId Deposit record Id, priority use
|
185
|
+
# @option kwargs [String] :txId Deposit txId, used when depositId is not specified
|
186
|
+
# @option kwargs [String] :subAccountId Sub-accountId of Cloud user
|
187
|
+
# @option kwargs [String] :subUserId Sub-userId of parent user
|
188
|
+
# @see https://developers.binance.com/docs/wallet/capital/one-click-arrival-deposite-apply
|
189
|
+
def one_click_arrival_deposit_apply(**kwargs)
|
190
|
+
@session.sign_request(:post, '/sapi/v1/capital/deposit/credit-apply', params: kwargs)
|
191
|
+
end
|
192
|
+
|
152
193
|
# Account Status (USER_DATA)
|
153
194
|
#
|
154
195
|
# GET /sapi/v1/account/status
|
@@ -157,7 +198,7 @@ module Binance
|
|
157
198
|
#
|
158
199
|
# @param kwargs [Hash]
|
159
200
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
160
|
-
# @see https://binance
|
201
|
+
# @see https://developers.binance.com/docs/wallet/account/account-status
|
161
202
|
def account_status(**kwargs)
|
162
203
|
@session.sign_request(:get, '/sapi/v1/account/status', params: kwargs)
|
163
204
|
end
|
@@ -170,7 +211,7 @@ module Binance
|
|
170
211
|
#
|
171
212
|
# @param kwargs [Hash]
|
172
213
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
173
|
-
# @see https://binance
|
214
|
+
# @see https://developers.binance.com/docs/wallet/account/account-api-trading-status
|
174
215
|
def api_trading_status(**kwargs)
|
175
216
|
@session.sign_request(:get, '/sapi/v1/account/apiTradingStatus', params: kwargs)
|
176
217
|
end
|
@@ -183,7 +224,7 @@ module Binance
|
|
183
224
|
# @option kwargs [Integer] :startTime
|
184
225
|
# @option kwargs [Integer] :endTime
|
185
226
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
186
|
-
# @see https://binance
|
227
|
+
# @see https://developers.binance.com/docs/wallet/asset/dust-log
|
187
228
|
def dust_log(**kwargs)
|
188
229
|
@session.sign_request(:get, '/sapi/v1/asset/dribblet', params: kwargs)
|
189
230
|
end
|
@@ -197,7 +238,7 @@ module Binance
|
|
197
238
|
# @param asset [Array]
|
198
239
|
# @param kwargs [Hash]
|
199
240
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
200
|
-
# @see https://binance
|
241
|
+
# @see https://developers.binance.com/docs/wallet/asset/dust-transfer
|
201
242
|
def dust_transfer(asset:, **kwargs)
|
202
243
|
Binance::Utils::Validation.require_param('asset', asset)
|
203
244
|
|
@@ -216,7 +257,7 @@ module Binance
|
|
216
257
|
# @option kwargs [Integer] :endTime
|
217
258
|
# @option kwargs [Integer] :limit Default 20, max 500
|
218
259
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
219
|
-
# @see https://binance
|
260
|
+
# @see https://developers.binance.com/docs/wallet/asset/assets-divided-record
|
220
261
|
def asset_devidend_record(**kwargs)
|
221
262
|
@session.sign_request(:get, '/sapi/v1/asset/assetDividend', params: kwargs)
|
222
263
|
end
|
@@ -228,11 +269,22 @@ module Binance
|
|
228
269
|
# @param kwargs [Hash]
|
229
270
|
# @option kwargs [String] :asset
|
230
271
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
231
|
-
# @see https://binance
|
272
|
+
# @see https://developers.binance.com/docs/wallet/asset/asset-detail
|
232
273
|
def asset_detail(**kwargs)
|
233
274
|
@session.sign_request(:get, '/sapi/v1/asset/assetDetail', params: kwargs)
|
234
275
|
end
|
235
276
|
|
277
|
+
# Query User Wallet Balance (USER_DATA)
|
278
|
+
#
|
279
|
+
# GET /sapi/v1/asset/wallet/balance
|
280
|
+
#
|
281
|
+
# @param kwargs [Hash]
|
282
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
283
|
+
# @see https://developers.binance.com/docs/wallet/asset/query-user-wallet-balance
|
284
|
+
def wallet_balance(**kwargs)
|
285
|
+
@session.sign_request(:get, '/sapi/v1/asset/wallet/balance', params: kwargs)
|
286
|
+
end
|
287
|
+
|
236
288
|
# Trade Fee (USER_DATA)
|
237
289
|
#
|
238
290
|
# GET /sapi/v1/asset/tradeFee
|
@@ -240,7 +292,7 @@ module Binance
|
|
240
292
|
# @param kwargs [Hash]
|
241
293
|
# @option kwargs [String] :symbol
|
242
294
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
243
|
-
# @see https://binance
|
295
|
+
# @see https://developers.binance.com/docs/wallet/asset/trade-fee
|
244
296
|
def trade_fee(**kwargs)
|
245
297
|
@session.sign_request(:get, '/sapi/v1/asset/tradeFee', params: kwargs)
|
246
298
|
end
|
@@ -256,7 +308,7 @@ module Binance
|
|
256
308
|
# @option kwargs [String] :fromSymbol must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
|
257
309
|
# @option kwargs [String] :toSymbol must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
|
258
310
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
259
|
-
# @see https://binance
|
311
|
+
# @see https://developers.binance.com/docs/wallet/asset/user-universal-transfer
|
260
312
|
def user_universal_transfer(type:, asset:, amount:, **kwargs)
|
261
313
|
Binance::Utils::Validation.require_param('type', type)
|
262
314
|
Binance::Utils::Validation.require_param('asset', asset)
|
@@ -282,12 +334,24 @@ module Binance
|
|
282
334
|
# @option kwargs [String] :fromSymbol must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
|
283
335
|
# @option kwargs [String] :toSymbol must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
|
284
336
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
285
|
-
# @see https://binance
|
337
|
+
# @see https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer
|
286
338
|
def user_universal_transfer_history(type:, **kwargs)
|
287
339
|
Binance::Utils::Validation.require_param('type', type)
|
288
340
|
@session.sign_request(:get, '/sapi/v1/asset/transfer', params: kwargs.merge(type: type))
|
289
341
|
end
|
290
342
|
|
343
|
+
# Get Assets That Can Be Converted Into BNB (USER_DATA)
|
344
|
+
#
|
345
|
+
# POST /sapi/v1/asset/dust-btc
|
346
|
+
#
|
347
|
+
# @param kwargs [Hash]
|
348
|
+
# @option kwargs [String] :accountType SPOT or MARGIN,default SPOT
|
349
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
350
|
+
# @see https://developers.binance.com/docs/wallet/asset/assets-can-convert-bnb
|
351
|
+
def get_assets_converted_into_bnb(**kwargs)
|
352
|
+
@session.sign_request(:post, '/sapi/v1/asset/dust-btc', params: kwargs)
|
353
|
+
end
|
354
|
+
|
291
355
|
# Funding Wallet (USER_DATA)
|
292
356
|
#
|
293
357
|
# POST /sapi/v1/asset/get-funding-asset
|
@@ -296,18 +360,72 @@ module Binance
|
|
296
360
|
# @option kwargs [String] :asset
|
297
361
|
# @option kwargs [String] :needBtcValuation true or false
|
298
362
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
299
|
-
# @see https://binance
|
363
|
+
# @see https://developers.binance.com/docs/wallet/asset/funding-wallet
|
300
364
|
def funding_wallet(**kwargs)
|
301
365
|
@session.sign_request(:post, '/sapi/v1/asset/get-funding-asset', params: kwargs)
|
302
366
|
end
|
303
367
|
|
368
|
+
# Get Cloud-Mining payment and refund history (USER_DATA)
|
369
|
+
#
|
370
|
+
# GET /sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage
|
371
|
+
#
|
372
|
+
# @param kwargs [Hash]
|
373
|
+
# @option kwargs [Integer] :tranId
|
374
|
+
# @option kwargs [String] :clientTranId The unique flag
|
375
|
+
# @option kwargs [String] :asset If it is blank, we will query all assets
|
376
|
+
# @option kwargs [Integer] :startTime inclusive, unit: ms
|
377
|
+
# @option kwargs [Integer] :endTime exclusive, unit: ms
|
378
|
+
# @option kwargs [Integer] :current current page, default 1, the min value is 1
|
379
|
+
# @option kwargs [Integer] :size page size, default 10, the max value is 100
|
380
|
+
# @see https://developers.binance.com/docs/wallet/asset/cloud-mining-payment-and-refund-history
|
381
|
+
def cloud_mining_payment_and_refund_history(**kwargs)
|
382
|
+
@session.sign_request(:get, '/sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage', params: kwargs)
|
383
|
+
end
|
384
|
+
|
385
|
+
# Query User Delegation History (For Master Account)(USER_DATA)
|
386
|
+
#
|
387
|
+
# GET /sapi/v1/asset/custody/transfer-history
|
388
|
+
#
|
389
|
+
# @param email [String]
|
390
|
+
# @param startTime [Integer]
|
391
|
+
# @param endTime [Integer]
|
392
|
+
# @param kwargs [Hash]
|
393
|
+
# @option kwargs [String] :type Delegate/Undelegate
|
394
|
+
# @option kwargs [String] :asset
|
395
|
+
# @option kwargs [Integer] :current Default 1
|
396
|
+
# @option kwargs [Integer] :size default 10, max 100
|
397
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
398
|
+
# @see https://developers.binance.com/docs/wallet/asset/query-user-delegation
|
399
|
+
def user_delegation_history(email:, startTime:, endTime:, **kwargs)
|
400
|
+
Binance::Utils::Validation.require_param('email', email)
|
401
|
+
Binance::Utils::Validation.require_param('startTime', startTime)
|
402
|
+
Binance::Utils::Validation.require_param('endTime', endTime)
|
403
|
+
|
404
|
+
@session.sign_request(:get, '/sapi/v1/asset/custody/transfer-history', params: kwargs.merge(
|
405
|
+
email: email,
|
406
|
+
startTime: startTime,
|
407
|
+
endTime: endTime
|
408
|
+
))
|
409
|
+
end
|
410
|
+
|
411
|
+
# Account info (USER_DATA)
|
412
|
+
#
|
413
|
+
# GET /sapi/v1/account/info
|
414
|
+
#
|
415
|
+
# @param kwargs [Hash]
|
416
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
417
|
+
# @see https://developers.binance.com/docs/wallet/account
|
418
|
+
def account_info(**kwargs)
|
419
|
+
@session.sign_request(:get, '/sapi/v1/account/info', params: kwargs)
|
420
|
+
end
|
421
|
+
|
304
422
|
# Get API Key Permission (USER_DATA)
|
305
423
|
#
|
306
424
|
# GET /sapi/v1/account/apiRestrictions
|
307
425
|
#
|
308
426
|
# @param kwargs [Hash]
|
309
427
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
310
|
-
# @see https://binance
|
428
|
+
# @see https://developers.binance.com/docs/wallet/account/api-key-permission
|
311
429
|
def api_key_permission(**kwargs)
|
312
430
|
@session.sign_request(:get, '/sapi/v1/account/apiRestrictions', params: kwargs)
|
313
431
|
end
|
@@ -320,7 +438,7 @@ module Binance
|
|
320
438
|
# @option kwargs [String] :asset If asset is blank, then query all positive assets user have.
|
321
439
|
# @option kwargs [Boolean] :needBtcValuation
|
322
440
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
323
|
-
# @see https://binance
|
441
|
+
# @see https://developers.binance.com/docs/wallet/asset/user-assets
|
324
442
|
def get_user_asset(**kwargs)
|
325
443
|
@session.sign_request(:post, '/sapi/v3/asset/getUserAsset', params: kwargs)
|
326
444
|
end
|