binance-connector-ruby 1.5.2 → 1.6.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 +52 -0
- data/lib/binance/spot/c2c.rb +2 -2
- data/lib/binance/spot/convert.rb +2 -2
- data/lib/binance/spot/fiat.rb +3 -3
- data/lib/binance/spot/loan.rb +2 -2
- data/lib/binance/spot/margin.rb +34 -246
- data/lib/binance/spot/market.rb +14 -14
- data/lib/binance/spot/mining.rb +13 -13
- data/lib/binance/spot/simple_earn.rb +24 -24
- data/lib/binance/spot/stream.rb +1 -1
- data/lib/binance/spot/subaccount.rb +39 -59
- data/lib/binance/spot/trade.rb +17 -17
- data/lib/binance/spot/wallet.rb +22 -22
- data/lib/binance/spot/websocket.rb +11 -11
- data/lib/binance/spot.rb +1 -5
- data/lib/binance/version.rb +1 -1
- metadata +6 -8
- data/lib/binance/spot/blvt.rb +0 -104
- data/lib/binance/spot/futures.rb +0 -357
@@ -3,7 +3,7 @@
|
|
3
3
|
module Binance
|
4
4
|
class Spot
|
5
5
|
# all sub-account endpoints
|
6
|
-
# @see https://binance
|
6
|
+
# @see https://developers.binance.com/docs/sub_account/Introduction
|
7
7
|
module Subaccount
|
8
8
|
# Create a Virtual Sub-account(For Master Account)
|
9
9
|
#
|
@@ -15,7 +15,7 @@ module Binance
|
|
15
15
|
# @param subAccountString [String]
|
16
16
|
# @param kwargs [Hash]
|
17
17
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
18
|
-
# @see https://binance
|
18
|
+
# @see https://developers.binance.com/docs/sub_account/account-management/Create-a-Virtual-Sub-account
|
19
19
|
def create_virtual_sub_account(subAccountString:, **kwargs)
|
20
20
|
Binance::Utils::Validation.require_param('subAccountString', subAccountString)
|
21
21
|
|
@@ -34,7 +34,7 @@ module Binance
|
|
34
34
|
# @option kwargs [Integer] :page
|
35
35
|
# @option kwargs [Integer] :limit
|
36
36
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
37
|
-
# @see https://binance
|
37
|
+
# @see https://developers.binance.com/docs/sub_account/account-management/Query-Sub-account-List
|
38
38
|
def get_sub_account_list(**kwargs)
|
39
39
|
@session.sign_request(:get, '/sapi/v1/sub-account/list', params: kwargs)
|
40
40
|
end
|
@@ -54,7 +54,7 @@ module Binance
|
|
54
54
|
# @option kwargs [Integer] :page Default value: 1
|
55
55
|
# @option kwargs [Integer] :limit Default value: 500
|
56
56
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
57
|
-
# @see https://binance
|
57
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Spot-Asset-Transfer-History
|
58
58
|
def get_sub_account_spot_transfer_history(**kwargs)
|
59
59
|
@session.sign_request(:get, '/sapi/v1/sub-account/sub/transfer/history', params: kwargs)
|
60
60
|
end
|
@@ -71,7 +71,7 @@ module Binance
|
|
71
71
|
# @option kwargs [Integer] :page Default value: 1
|
72
72
|
# @option kwargs [Integer] :limit Default value: 50, Max value: 500
|
73
73
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
74
|
-
# @see https://binance
|
74
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Futures-Asset-Transfer-History
|
75
75
|
def get_sub_account_futures_transfer_history(email:, futuresType:, **kwargs)
|
76
76
|
Binance::Utils::Validation.require_param('email', email)
|
77
77
|
Binance::Utils::Validation.require_param('futuresType', futuresType)
|
@@ -93,7 +93,7 @@ module Binance
|
|
93
93
|
# @param amount [Float]
|
94
94
|
# @param kwargs [Hash]
|
95
95
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
96
|
-
# @see https://binance
|
96
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Futures-Asset-Transfer
|
97
97
|
def sub_account_futures_internal_transfer(fromEmail:, toEmail:, futuresType:, asset:, amount:, **kwargs)
|
98
98
|
Binance::Utils::Validation.require_param('fromEmail', fromEmail)
|
99
99
|
Binance::Utils::Validation.require_param('toEmail', toEmail)
|
@@ -117,7 +117,7 @@ module Binance
|
|
117
117
|
# @param email [String]
|
118
118
|
# @param kwargs [Hash]
|
119
119
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
120
|
-
# @see https://binance
|
120
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Assets-V3
|
121
121
|
def get_sub_account_assets(email:, **kwargs)
|
122
122
|
Binance::Utils::Validation.require_param('email', email)
|
123
123
|
|
@@ -135,7 +135,7 @@ module Binance
|
|
135
135
|
# @option kwargs [Integer] :page Default value: 1
|
136
136
|
# @option kwargs [Integer] :size default 10, max 20
|
137
137
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
138
|
-
# @see https://binance
|
138
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Query-Sub-account-Spot-Assets-Summary
|
139
139
|
def get_sub_account_spot_summary(**kwargs)
|
140
140
|
@session.sign_request(:get, '/sapi/v1/sub-account/spotSummary', params: kwargs)
|
141
141
|
end
|
@@ -151,7 +151,7 @@ module Binance
|
|
151
151
|
# @param kwargs [Hash]
|
152
152
|
# @option kwargs [String] :network
|
153
153
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
154
|
-
# @see https://binance
|
154
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-Address
|
155
155
|
def sub_account_deposit_address(email:, coin:, **kwargs)
|
156
156
|
Binance::Utils::Validation.require_param('email', email)
|
157
157
|
Binance::Utils::Validation.require_param('coin', coin)
|
@@ -177,7 +177,7 @@ module Binance
|
|
177
177
|
# @option kwargs [String] :limit
|
178
178
|
# @option kwargs [String] :offset
|
179
179
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
180
|
-
# @see https://binance
|
180
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Get-Sub-account-Deposit-History
|
181
181
|
def sub_account_deposit_history(email:, **kwargs)
|
182
182
|
Binance::Utils::Validation.require_param('email', email)
|
183
183
|
|
@@ -193,7 +193,7 @@ module Binance
|
|
193
193
|
# @param kwargs [Hash]
|
194
194
|
# @option kwargs [String] :email
|
195
195
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
196
|
-
# @see https://binance
|
196
|
+
# @see https://developers.binance.com/docs/sub_account/account-management/Get-Sub-accounts-Status-on-Margin-Or-Futures
|
197
197
|
def sub_account_status(**kwargs)
|
198
198
|
@session.sign_request(:get, '/sapi/v1/sub-account/status', params: kwargs)
|
199
199
|
end
|
@@ -205,7 +205,7 @@ module Binance
|
|
205
205
|
# @param kwargs [Hash]
|
206
206
|
# @option kwargs [String] :email
|
207
207
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
208
|
-
# @see https://binance
|
208
|
+
# @see https://developers.binance.com/docs/sub_account/account-management/Enable-Margin-for-Sub-account
|
209
209
|
def sub_account_enable_margin(email:, **kwargs)
|
210
210
|
Binance::Utils::Validation.require_param('email', email)
|
211
211
|
|
@@ -221,7 +221,7 @@ module Binance
|
|
221
221
|
# @param email [String]
|
222
222
|
# @param kwargs [Hash]
|
223
223
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
224
|
-
# @see https://binance
|
224
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Get-Detail-on-Sub-accounts-Margin-Account
|
225
225
|
def sub_account_margin_account(email:, **kwargs)
|
226
226
|
Binance::Utils::Validation.require_param('email', email)
|
227
227
|
|
@@ -236,7 +236,7 @@ module Binance
|
|
236
236
|
#
|
237
237
|
# @param kwargs [Hash]
|
238
238
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
239
|
-
# @see https://binance
|
239
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Get-Summary-of-Sub-accounts-Margin-Account
|
240
240
|
def sub_account_margin_account_summary(**kwargs)
|
241
241
|
@session.sign_request(:get, '/sapi/v1/sub-account/margin/accountSummary', params: kwargs)
|
242
242
|
end
|
@@ -248,7 +248,7 @@ module Binance
|
|
248
248
|
# @param email [String]
|
249
249
|
# @param kwargs [Hash]
|
250
250
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
251
|
-
# @see https://binance
|
251
|
+
# @see https://developers.binance.com/docs/sub_account/account-management/Enable-Futures-for-Sub-account
|
252
252
|
def sub_account_enable_futures(email:, **kwargs)
|
253
253
|
Binance::Utils::Validation.require_param('email', email)
|
254
254
|
|
@@ -265,7 +265,7 @@ module Binance
|
|
265
265
|
# @param futuresType [Integer] 1:USDT Margined Futures, 2:COIN Margined Futures
|
266
266
|
# @param kwargs [Hash]
|
267
267
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
268
|
-
# @see https://binance
|
268
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Get-Detail-on-Sub-accounts-Futures-Account-V2
|
269
269
|
def sub_account_futures_account(email:, futuresType:, **kwargs)
|
270
270
|
Binance::Utils::Validation.require_param('email', email)
|
271
271
|
Binance::Utils::Validation.require_param('futuresType', futuresType)
|
@@ -285,7 +285,7 @@ module Binance
|
|
285
285
|
# @option kwargs [Integer] :page default:1
|
286
286
|
# @option kwargs [Integer] :limit default:10, max:20
|
287
287
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
288
|
-
# @see https://binance
|
288
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Get-Summary-of-Sub-accounts-Futures-Account-V2
|
289
289
|
def sub_account_futures_account_summary(futuresType:, **kwargs)
|
290
290
|
Binance::Utils::Validation.require_param('futuresType', futuresType)
|
291
291
|
|
@@ -302,7 +302,7 @@ module Binance
|
|
302
302
|
# @param futuresType [Integer] 1:USDT Margined Futures, 2:COIN Margined Futures
|
303
303
|
# @param kwargs [Hash]
|
304
304
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
305
|
-
# @see https://binance
|
305
|
+
# @see https://developers.binance.com/docs/sub_account/account-management/Get-Futures-Position-Risk-of-Sub-account-V2
|
306
306
|
def sub_account_futures_position_risk(email:, futuresType:, **kwargs)
|
307
307
|
Binance::Utils::Validation.require_param('email', email)
|
308
308
|
Binance::Utils::Validation.require_param('futuresType', futuresType)
|
@@ -326,7 +326,7 @@ module Binance
|
|
326
326
|
# 4:transfer from subaccount's COIN-margined futures account to its spot account
|
327
327
|
# @param kwargs [Hash]
|
328
328
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
329
|
-
# @see https://binance
|
329
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Futures-Transfer-for-Sub-account
|
330
330
|
def sub_account_futures_transfer(email:, asset:, amount:, type:, **kwargs)
|
331
331
|
Binance::Utils::Validation.require_param('email', email)
|
332
332
|
Binance::Utils::Validation.require_param('asset', asset)
|
@@ -352,7 +352,7 @@ module Binance
|
|
352
352
|
# 2: transfer from subaccount's margin account to its spot account
|
353
353
|
# @param kwargs [Hash]
|
354
354
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
355
|
-
# @see https://binance
|
355
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Margin-Transfer-for-Sub-account
|
356
356
|
def sub_account_margin_transfer(email:, asset:, amount:, type:, **kwargs)
|
357
357
|
Binance::Utils::Validation.require_param('email', email)
|
358
358
|
Binance::Utils::Validation.require_param('asset', asset)
|
@@ -376,7 +376,7 @@ module Binance
|
|
376
376
|
# @param amount [String]
|
377
377
|
# @param kwargs [Hash]
|
378
378
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
379
|
-
# @see https://binance
|
379
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Transfer-to-Sub-account-of-Same-Master
|
380
380
|
def sub_account_transfer_to_sub(toEmail:, asset:, amount:, **kwargs)
|
381
381
|
Binance::Utils::Validation.require_param('toEmail', toEmail)
|
382
382
|
Binance::Utils::Validation.require_param('asset', asset)
|
@@ -397,7 +397,7 @@ module Binance
|
|
397
397
|
# @param amount [Float]
|
398
398
|
# @param kwargs [Hash]
|
399
399
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
400
|
-
# @see https://binance
|
400
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Transfer-to-Master
|
401
401
|
def sub_account_transfer_to_master(asset:, amount:, **kwargs)
|
402
402
|
Binance::Utils::Validation.require_param('asset', asset)
|
403
403
|
Binance::Utils::Validation.require_param('amount', amount)
|
@@ -419,7 +419,7 @@ module Binance
|
|
419
419
|
# @option kwargs [Integer] :endTime
|
420
420
|
# @option kwargs [Integer] :limit
|
421
421
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
422
|
-
# @see https://binance
|
422
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Sub-account-Transfer-History
|
423
423
|
def sub_account_transfer_sub_account_history(**kwargs)
|
424
424
|
@session.sign_request(:get, '/sapi/v1/sub-account/transfer/subUserHistory', params: kwargs)
|
425
425
|
end
|
@@ -439,7 +439,7 @@ module Binance
|
|
439
439
|
# @option kwargs [String] :fromEmail Transfer from master account by default if fromEmail is not sent.
|
440
440
|
# @option kwargs [String] :toEmail Transfer to master account by default if toEmail is not sent.
|
441
441
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
442
|
-
# @see https://binance
|
442
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Universal-Transfer
|
443
443
|
def universal_transfer(fromAccountType:, toAccountType:, asset:, amount:, **kwargs)
|
444
444
|
Binance::Utils::Validation.require_param('fromAccountType', fromAccountType)
|
445
445
|
Binance::Utils::Validation.require_param('toAccountType', toAccountType)
|
@@ -466,7 +466,7 @@ module Binance
|
|
466
466
|
# @option kwargs [Integer] :page
|
467
467
|
# @option kwargs [Integer] :limit Default 500, Max 500
|
468
468
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
469
|
-
# @see https://binance
|
469
|
+
# @see https://developers.binance.com/docs/sub_account/asset-management/Query-Universal-Transfer-History
|
470
470
|
def universal_transfer_history(**kwargs)
|
471
471
|
@session.sign_request(:get, '/sapi/v1/sub-account/universalTransfer', params: kwargs)
|
472
472
|
end
|
@@ -479,7 +479,7 @@ module Binance
|
|
479
479
|
# @param enableBlvt [Boolean] Only true for now
|
480
480
|
# @param kwargs [Hash]
|
481
481
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
482
|
-
# @see https://binance
|
482
|
+
# @see https://developers.binance.com/docs/sub_account/account-management/Enable-Leverage-Token-for-Sub-account
|
483
483
|
def sub_account_enable_blvt(email:, enableBlvt:, **kwargs)
|
484
484
|
Binance::Utils::Validation.require_param('email', email)
|
485
485
|
Binance::Utils::Validation.require_param('enableBlvt', enableBlvt)
|
@@ -499,7 +499,7 @@ module Binance
|
|
499
499
|
# @param amount [Float]
|
500
500
|
# @param kwargs [Hash]
|
501
501
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
502
|
-
# @see https://binance
|
502
|
+
# @see https://developers.binance.com/docs/sub_account/managed-sub-account/Deposit-Assets-Into-The-Managed-Sub-account
|
503
503
|
def deposit_to_sub_account(toEmail:, asset:, amount:, **kwargs)
|
504
504
|
Binance::Utils::Validation.require_param('toEmail', toEmail)
|
505
505
|
Binance::Utils::Validation.require_param('asset', asset)
|
@@ -519,7 +519,7 @@ module Binance
|
|
519
519
|
# @param email [String]
|
520
520
|
# @param kwargs [Hash]
|
521
521
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
522
|
-
# @see https://binance
|
522
|
+
# @see https://developers.binance.com/docs/sub_account/managed-sub-account/Query-Managed-Sub-account-Asset-Details
|
523
523
|
def sub_account_asset_details(email:, **kwargs)
|
524
524
|
Binance::Utils::Validation.require_param('email', email)
|
525
525
|
|
@@ -536,7 +536,7 @@ module Binance
|
|
536
536
|
# @param kwargs [Hash]
|
537
537
|
# @option kwargs [Integer] :transferDate
|
538
538
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
539
|
-
# @see https://binance
|
539
|
+
# @see https://developers.binance.com/docs/sub_account/managed-sub-account/Withdrawl-Assets-From-The-Managed-Sub-account
|
540
540
|
def withdraw_from_sub_account(fromEmail:, asset:, amount:, **kwargs)
|
541
541
|
Binance::Utils::Validation.require_param('fromEmail', fromEmail)
|
542
542
|
Binance::Utils::Validation.require_param('asset', asset)
|
@@ -551,43 +551,23 @@ module Binance
|
|
551
551
|
|
552
552
|
# Enable or Disable IP Restriction for a Sub-account API Key (For Master Account)
|
553
553
|
#
|
554
|
-
# POST /sapi/
|
554
|
+
# POST /sapi/v2/sub-account/subAccountApi/ipRestriction
|
555
555
|
#
|
556
556
|
# @param email [String]
|
557
557
|
# @param subAccountApiKey [String]
|
558
|
-
# @param
|
558
|
+
# @param status [String]
|
559
|
+
# @option kwargs [String] :ipAddress Insert static IP in batch, separated by commas.
|
559
560
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
560
|
-
# @see https://binance
|
561
|
-
def sub_account_toggle_ip_restriction(email:, subAccountApiKey:,
|
561
|
+
# @see https://developers.binance.com/docs/sub_account/api-management/Add-IP-Restriction-for-Sub-Account-API-key
|
562
|
+
def sub_account_toggle_ip_restriction(email:, subAccountApiKey:, status:, **kwargs)
|
562
563
|
Binance::Utils::Validation.require_param('email', email)
|
563
564
|
Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey)
|
564
|
-
Binance::Utils::Validation.require_param('
|
565
|
+
Binance::Utils::Validation.require_param('status', status)
|
565
566
|
|
566
|
-
@session.sign_request(:post, '/sapi/
|
567
|
+
@session.sign_request(:post, '/sapi/v2/sub-account/subAccountApi/ipRestriction', params: kwargs.merge(
|
567
568
|
email: email,
|
568
569
|
subAccountApiKey: subAccountApiKey,
|
569
|
-
|
570
|
-
))
|
571
|
-
end
|
572
|
-
|
573
|
-
# Add IP List for a Sub-account API Key (For Master Account)
|
574
|
-
#
|
575
|
-
# POST /sapi/v1/sub-account/subAccountApi/ipRestriction/ipList
|
576
|
-
#
|
577
|
-
# @param email [String]
|
578
|
-
# @param subAccountApiKey [String]
|
579
|
-
# @param ipAddress [String]
|
580
|
-
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
581
|
-
# @see https://binance-docs.github.io/apidocs/spot/en/#add-ip-list-for-a-sub-account-api-key-for-master-account
|
582
|
-
def sub_account_add_ip_list(email:, subAccountApiKey:, ipAddress:, **kwargs)
|
583
|
-
Binance::Utils::Validation.require_param('email', email)
|
584
|
-
Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey)
|
585
|
-
Binance::Utils::Validation.require_param('ipAddress', ipAddress)
|
586
|
-
|
587
|
-
@session.sign_request(:post, '/sapi/v1/sub-account/subAccountApi/ipRestriction/ipList', params: kwargs.merge(
|
588
|
-
email: email,
|
589
|
-
subAccountApiKey: subAccountApiKey,
|
590
|
-
ipAddress: ipAddress
|
570
|
+
status: status
|
591
571
|
))
|
592
572
|
end
|
593
573
|
|
@@ -598,7 +578,7 @@ module Binance
|
|
598
578
|
# @param email [String]
|
599
579
|
# @param subAccountApiKey [String]
|
600
580
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
601
|
-
# @see https://binance
|
581
|
+
# @see https://developers.binance.com/docs/sub_account/api-management/Get-IP-Restriction-for-a-Sub-account-API-Key
|
602
582
|
def sub_account_ip_list(email:, subAccountApiKey:, **kwargs)
|
603
583
|
Binance::Utils::Validation.require_param('email', email)
|
604
584
|
Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey)
|
@@ -617,7 +597,7 @@ module Binance
|
|
617
597
|
# @param subAccountApiKey [String]
|
618
598
|
# @param ipAddress [String]
|
619
599
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
620
|
-
# @see https://binance
|
600
|
+
# @see https://developers.binance.com/docs/sub_account/api-management/Get-IP-Restriction-for-a-Sub-account-API-Key
|
621
601
|
def sub_account_delete_ip_list(email:, subAccountApiKey:, ipAddress:, **kwargs)
|
622
602
|
Binance::Utils::Validation.require_param('email', email)
|
623
603
|
Binance::Utils::Validation.require_param('subAccountApiKey', subAccountApiKey)
|
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#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#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#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#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#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#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#all-orders-user_data
|
150
150
|
def all_orders(symbol:, **kwargs)
|
151
151
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
152
152
|
|
@@ -174,7 +174,7 @@ module Binance
|
|
174
174
|
# @option kwargs [Float] :stopLimitTimeInForce GTC/ FOK/ IOC
|
175
175
|
# @option kwargs [String] :newOrderRespType
|
176
176
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
177
|
-
# @see https://binance
|
177
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-oco---deprecated-trade
|
178
178
|
def new_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs)
|
179
179
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
180
180
|
Binance::Utils::Validation.require_param('side', side)
|
@@ -201,7 +201,7 @@ module Binance
|
|
201
201
|
# @option kwargs [String] :listClientOrderId
|
202
202
|
# @option kwargs [String] :newClientOrderId
|
203
203
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
204
|
-
# @see https://binance
|
204
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-order-list-trade
|
205
205
|
def cancel_order_list(symbol:, **kwargs)
|
206
206
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
207
207
|
|
@@ -218,7 +218,7 @@ module Binance
|
|
218
218
|
# @option kwargs [Integer] :orderListId
|
219
219
|
# @option kwargs [String] :orgClientOrderId
|
220
220
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
221
|
-
# @see https://binance
|
221
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-order-lists-user_data
|
222
222
|
def order_list(**kwargs)
|
223
223
|
@session.sign_request(:get, '/api/v3/orderList', params: kwargs)
|
224
224
|
end
|
@@ -235,7 +235,7 @@ module Binance
|
|
235
235
|
# @option kwargs [String] :endTime
|
236
236
|
# @option kwargs [String] :limit Default 500; max 1000.
|
237
237
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
238
|
-
# @see https://binance
|
238
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-all-order-lists-user_data
|
239
239
|
def all_order_list(**kwargs)
|
240
240
|
@session.sign_request(:get, '/api/v3/allOrderList', params: kwargs)
|
241
241
|
end
|
@@ -246,7 +246,7 @@ module Binance
|
|
246
246
|
#
|
247
247
|
# @param kwargs [Hash]
|
248
248
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
249
|
-
# @see https://binance
|
249
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-open-order-lists-user_data
|
250
250
|
def open_order_list(**kwargs)
|
251
251
|
@session.sign_request(:get, '/api/v3/openOrderList', params: kwargs)
|
252
252
|
end
|
@@ -257,7 +257,7 @@ module Binance
|
|
257
257
|
#
|
258
258
|
# @param kwargs [Hash]
|
259
259
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
260
|
-
# @see https://binance
|
260
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-information-user_data
|
261
261
|
def account(**kwargs)
|
262
262
|
@session.sign_request(:get, '/api/v3/account', params: kwargs)
|
263
263
|
end
|
@@ -274,7 +274,7 @@ module Binance
|
|
274
274
|
# @option kwargs [Integer] :fromId TradeId to fetch from. Default gets most recent trades.
|
275
275
|
# @option kwargs [Integer] :limit Default 500; max 1000.
|
276
276
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
277
|
-
# @see https://binance
|
277
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-trade-list-user_data
|
278
278
|
def my_trades(symbol:, **kwargs)
|
279
279
|
@session.sign_request(:get, '/api/v3/myTrades', params: kwargs.merge(symbol: symbol))
|
280
280
|
end
|
@@ -285,7 +285,7 @@ module Binance
|
|
285
285
|
#
|
286
286
|
# @param kwargs [Hash]
|
287
287
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
288
|
-
# @see https://binance
|
288
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-current-order-count-usage-trade
|
289
289
|
def get_order_rate_limit(**kwargs)
|
290
290
|
@session.sign_request(:get, '/api/v3/rateLimit/order', params: kwargs)
|
291
291
|
end
|
@@ -312,7 +312,7 @@ module Binance
|
|
312
312
|
# @option kwargs [Float] :icebergQty
|
313
313
|
# @option kwargs [String] :newOrderRespType
|
314
314
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
315
|
-
# @see https://binance
|
315
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-an-existing-order-and-send-a-new-order-trade
|
316
316
|
def cancel_replace(symbol:, side:, type:, cancelReplaceMode:, **kwargs)
|
317
317
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
318
318
|
Binance::Utils::Validation.require_param('side', side)
|