binance-connector-ruby 1.5.2 → 1.7.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 +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/market.rb
CHANGED
@@ -9,13 +9,13 @@ module Binance
|
|
9
9
|
# - trades
|
10
10
|
# - orderbook
|
11
11
|
# - etc
|
12
|
-
# @see https://binance
|
12
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#market-data-endpoints
|
13
13
|
module Market
|
14
14
|
# Test Connectivity
|
15
15
|
#
|
16
16
|
# GET /api/v3/ping
|
17
17
|
#
|
18
|
-
# @see https://binance
|
18
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#test-connectivity
|
19
19
|
def ping
|
20
20
|
@session.public_request(path: '/api/v3/ping')
|
21
21
|
end
|
@@ -24,7 +24,7 @@ module Binance
|
|
24
24
|
#
|
25
25
|
# GET /api/v3/time
|
26
26
|
#
|
27
|
-
# @see https://binance
|
27
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#check-server-time
|
28
28
|
def time
|
29
29
|
@session.public_request(path: '/api/v3/time')
|
30
30
|
end
|
@@ -36,7 +36,9 @@ module Binance
|
|
36
36
|
# @option kwargs [string] :symbol
|
37
37
|
# @option kwargs [string] :symbols
|
38
38
|
# @option kwargs [string] :permissions
|
39
|
-
# @
|
39
|
+
# @option kwargs [Boolean] :feature Controls whether the content of the permissionSets field is populated or not. Defaults to true
|
40
|
+
# @option kwargs [string] :symbolStatus Filters symbols that have this tradingStatus. Valid values: TRADING, HALT, BREAK. Cannot be used in combination with symbols or symbol.
|
41
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#exchange-information
|
40
42
|
def exchange_info(symbol: nil, symbols: nil, permissions: nil)
|
41
43
|
if symbols.is_a?(Array)
|
42
44
|
symbols = symbols.map { |v| "%22#{v}%22" }.join(',')
|
@@ -59,7 +61,7 @@ module Binance
|
|
59
61
|
# @param symbol [String] the symbol
|
60
62
|
# @param kwargs [Hash]
|
61
63
|
# @option kwargs [Integer] :limit Default 100; max 1000. Valid limits:[5, 10, 20, 50, 100, 500, 1000, 5000]
|
62
|
-
# @see https://binance
|
64
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#order-book
|
63
65
|
def depth(symbol:, **kwargs)
|
64
66
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
65
67
|
|
@@ -76,7 +78,7 @@ module Binance
|
|
76
78
|
# @param symbol [String] the symbol
|
77
79
|
# @param kwargs [Hash]
|
78
80
|
# @option kwargs [Integer] :limit Default 500; max 1000.
|
79
|
-
# @see https://binance
|
81
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#recent-trades-list
|
80
82
|
def trades(symbol:, **kwargs)
|
81
83
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
82
84
|
|
@@ -96,7 +98,7 @@ module Binance
|
|
96
98
|
# @param kwargs [Hash]
|
97
99
|
# @option kwargs [Integer] :limit Default 500; max 1000.
|
98
100
|
# @option kwargs [Integer] :fromId Trade id to fetch from. Default gets most recent trades.
|
99
|
-
# @see https://binance
|
101
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#old-trade-lookup
|
100
102
|
def historical_trades(symbol:, **kwargs)
|
101
103
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
102
104
|
|
@@ -118,7 +120,7 @@ module Binance
|
|
118
120
|
# @option kwargs [Integer] :endTime Timestamp in ms to get aggregate trades until INCLUSIVE.
|
119
121
|
# @option kwargs [Integer] :fromId Trade id to fetch from. Default gets most recent trades.
|
120
122
|
# @option kwargs [Integer] :limit Default 500; max 1000.
|
121
|
-
# @see https://binance
|
123
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#compressedaggregate-trades-list
|
122
124
|
def agg_trades(symbol:, **kwargs)
|
123
125
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
124
126
|
|
@@ -140,8 +142,9 @@ module Binance
|
|
140
142
|
# @param kwargs [Hash]
|
141
143
|
# @option kwargs [Integer] :startTime Timestamp in ms to get aggregate trades from INCLUSIVE.
|
142
144
|
# @option kwargs [Integer] :endTime Timestamp in ms to get aggregate trades until INCLUSIVE.
|
145
|
+
# @option kwargs [String] :timeZone Default: 0 (UTC)
|
143
146
|
# @option kwargs [Integer] :limit Default 500; max 1000.
|
144
|
-
# @see https://binance
|
147
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#klinecandlestick-data
|
145
148
|
def klines(symbol:, interval:, **kwargs)
|
146
149
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
147
150
|
Binance::Utils::Validation.require_param('interval', interval)
|
@@ -155,6 +158,33 @@ module Binance
|
|
155
158
|
)
|
156
159
|
end
|
157
160
|
|
161
|
+
# UIKlines
|
162
|
+
#
|
163
|
+
# uiKlines return modified kline data, optimized for presentation of candlestick charts
|
164
|
+
#
|
165
|
+
# GET /api/v3/uiKlines
|
166
|
+
#
|
167
|
+
# @param symbol [String] the symbol
|
168
|
+
# @param interval [String] interval
|
169
|
+
# @param kwargs [Hash]
|
170
|
+
# @option kwargs [Integer] :startTime
|
171
|
+
# @option kwargs [Integer] :endTime
|
172
|
+
# @option kwargs [String] :timeZone Default: 0 (UTC)
|
173
|
+
# @option kwargs [Integer] :limit Default 500; max 1000.
|
174
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#uiklines
|
175
|
+
def ui_klines(symbol:, interval:, **kwargs)
|
176
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
177
|
+
Binance::Utils::Validation.require_param('interval', interval)
|
178
|
+
|
179
|
+
@session.public_request(
|
180
|
+
path: '/api/v3/uiKlines',
|
181
|
+
params: kwargs.merge(
|
182
|
+
symbol: symbol,
|
183
|
+
interval: interval
|
184
|
+
)
|
185
|
+
)
|
186
|
+
end
|
187
|
+
|
158
188
|
# Current Average Price
|
159
189
|
#
|
160
190
|
# Current average price for a symbol.
|
@@ -162,7 +192,7 @@ module Binance
|
|
162
192
|
# GET /api/v3/avgPrice
|
163
193
|
#
|
164
194
|
# @param symbol [String] the symbol
|
165
|
-
# @see https://binance
|
195
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#current-average-price
|
166
196
|
def avg_price(symbol:)
|
167
197
|
Binance::Utils::Validation.require_param('symbol', symbol)
|
168
198
|
|
@@ -179,7 +209,7 @@ module Binance
|
|
179
209
|
# GET /api/v3/ticker/24hr
|
180
210
|
#
|
181
211
|
# @param symbol [String] the symbol
|
182
|
-
# @see https://binance
|
212
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#24hr-ticker-price-change-statistics
|
183
213
|
def ticker_24hr(symbol: nil)
|
184
214
|
@session.public_request(
|
185
215
|
path: '/api/v3/ticker/24hr',
|
@@ -187,6 +217,35 @@ module Binance
|
|
187
217
|
)
|
188
218
|
end
|
189
219
|
|
220
|
+
# Trading Day Ticker
|
221
|
+
#
|
222
|
+
# Price change statistics for a trading day.
|
223
|
+
#
|
224
|
+
# GET /api/v3/ticker/tradingDay
|
225
|
+
#
|
226
|
+
# @param kwargs [Hash]
|
227
|
+
# @option kwargs [string] :symbol Either symbol or symbols must be provided
|
228
|
+
# @option kwargs [string] :symbols
|
229
|
+
# @option kwargs [String] :timeZone Default: 0 (UTC)
|
230
|
+
# @option kwargs [String] :type Supported values: FULL or MINI. Default: FULL
|
231
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#trading-day-ticker
|
232
|
+
def ticker_trading_day(symbol: nil, symbols: nil, **kwargs)
|
233
|
+
raise Binance::DuplicatedParametersError.new('symbol', 'symbols') unless symbols.nil? || symbol.nil?
|
234
|
+
|
235
|
+
if symbols
|
236
|
+
symbols = symbols.map { |s| "\"#{s}\"" }.join(',')
|
237
|
+
symbols = { symbols: "\[#{symbols}\]".upcase }
|
238
|
+
end
|
239
|
+
|
240
|
+
@session.public_request(
|
241
|
+
path: '/api/v3/ticker/tradingDay',
|
242
|
+
params: kwargs.merge(
|
243
|
+
symbol: symbol,
|
244
|
+
symbols: symbols
|
245
|
+
)
|
246
|
+
)
|
247
|
+
end
|
248
|
+
|
190
249
|
# Symbol Price Ticker
|
191
250
|
#
|
192
251
|
# Latest price for a symbol or symbols.
|
@@ -194,7 +253,7 @@ module Binance
|
|
194
253
|
# GET /api/v3/ticker/price
|
195
254
|
#
|
196
255
|
# @param symbol [String] the symbol
|
197
|
-
# @see https://binance
|
256
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#symbol-price-ticker
|
198
257
|
def ticker_price(symbol: nil)
|
199
258
|
@session.public_request(
|
200
259
|
path: '/api/v3/ticker/price',
|
@@ -209,7 +268,7 @@ module Binance
|
|
209
268
|
# GET /api/v3/ticker/bookTicker
|
210
269
|
#
|
211
270
|
# @param symbol [String] the symbol
|
212
|
-
# @see https://binance
|
271
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#symbol-order-book-ticker
|
213
272
|
def book_ticker(symbol: nil)
|
214
273
|
@session.public_request(
|
215
274
|
path: '/api/v3/ticker/bookTicker',
|
@@ -224,7 +283,7 @@ module Binance
|
|
224
283
|
# GET /api/v3/ticker/bookTicker
|
225
284
|
#
|
226
285
|
# @param symbol [String] the symbol
|
227
|
-
# @see https://binance
|
286
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#symbol-order-book-ticker
|
228
287
|
def ticker(symbol: nil, symbols: nil, windowSize: '1d')
|
229
288
|
raise Binance::DuplicatedParametersError.new('symbol', 'symbols') unless symbols.nil? || symbol.nil?
|
230
289
|
|
data/lib/binance/spot/mining.rb
CHANGED
@@ -4,13 +4,13 @@ module Binance
|
|
4
4
|
class Spot
|
5
5
|
# Mining endpoints
|
6
6
|
# The endpoints below allow to interact with Binance Pool.
|
7
|
-
# @see https://binance
|
7
|
+
# @see https://developers.binance.com/docs/mining/Introduction
|
8
8
|
module Mining
|
9
9
|
# Acquiring Algorithm (MARKET_DATA)
|
10
10
|
#
|
11
11
|
# GET /sapi/v1/mining/pub/algoList
|
12
12
|
#
|
13
|
-
# @see https://binance
|
13
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Acquiring-Algorithm
|
14
14
|
def mining_algo_list
|
15
15
|
@session.limit_request(path: '/sapi/v1/mining/pub/algoList')
|
16
16
|
end
|
@@ -19,7 +19,7 @@ module Binance
|
|
19
19
|
#
|
20
20
|
# GET /sapi/v1/mining/pub/coinList
|
21
21
|
#
|
22
|
-
# @see https://binance
|
22
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Acquiring-CoinName
|
23
23
|
def mining_coin_list
|
24
24
|
@session.limit_request(path: '/sapi/v1/mining/pub/coinList')
|
25
25
|
end
|
@@ -33,7 +33,7 @@ module Binance
|
|
33
33
|
# @param workerName [String]
|
34
34
|
# @param kwargs [Hash]
|
35
35
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
36
|
-
# @see https://binance
|
36
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Request-for-Detail-Miner-List
|
37
37
|
def mining_worker(algo:, userName:, workerName:, **kwargs)
|
38
38
|
Binance::Utils::Validation.require_param('algo', algo)
|
39
39
|
Binance::Utils::Validation.require_param('userName', userName)
|
@@ -58,7 +58,7 @@ module Binance
|
|
58
58
|
# @option kwargs [String] :sortColumn
|
59
59
|
# @option kwargs [String] :workerStatus
|
60
60
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
61
|
-
# @see https://binance
|
61
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Request-for-Miner-List
|
62
62
|
def mining_worker_list(algo:, userName:, **kwargs)
|
63
63
|
Binance::Utils::Validation.require_param('algo', algo)
|
64
64
|
Binance::Utils::Validation.require_param('userName', userName)
|
@@ -82,7 +82,7 @@ module Binance
|
|
82
82
|
# @option kwargs [Integer] :pageIndex
|
83
83
|
# @option kwargs [Integer] :pageSize
|
84
84
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
85
|
-
# @see https://binance
|
85
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Earnings-List
|
86
86
|
def mining_revenue_list(algo:, userName:, **kwargs)
|
87
87
|
Binance::Utils::Validation.require_param('algo', algo)
|
88
88
|
Binance::Utils::Validation.require_param('userName', userName)
|
@@ -101,7 +101,7 @@ module Binance
|
|
101
101
|
# @param userName [String]
|
102
102
|
# @param kwargs [Hash]
|
103
103
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
104
|
-
# @see https://binance
|
104
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Statistic-List
|
105
105
|
def mining_statistics_list(algo:, userName:, **kwargs)
|
106
106
|
Binance::Utils::Validation.require_param('algo', algo)
|
107
107
|
Binance::Utils::Validation.require_param('userName', userName)
|
@@ -120,7 +120,7 @@ module Binance
|
|
120
120
|
# @param userName [String]
|
121
121
|
# @param kwargs [Hash]
|
122
122
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
123
|
-
# @see https://binance
|
123
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Account-List
|
124
124
|
def mining_account_list(algo:, userName:, **kwargs)
|
125
125
|
Binance::Utils::Validation.require_param('algo', algo)
|
126
126
|
Binance::Utils::Validation.require_param('userName', userName)
|
@@ -144,7 +144,7 @@ module Binance
|
|
144
144
|
# @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1
|
145
145
|
# @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200
|
146
146
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
147
|
-
# @see https://binance
|
147
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Extra-Bonus-List
|
148
148
|
def mining_extra_bonus(algo:, userName:, **kwargs)
|
149
149
|
Binance::Utils::Validation.require_param('algo', algo)
|
150
150
|
Binance::Utils::Validation.require_param('userName', userName)
|
@@ -163,7 +163,7 @@ module Binance
|
|
163
163
|
# @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1
|
164
164
|
# @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200
|
165
165
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
166
|
-
# @see https://binance
|
166
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-List
|
167
167
|
def mining_resale_list(**kwargs)
|
168
168
|
@session.sign_request(:get, '/sapi/v1/mining/hash-transfer/config/details/list', params: kwargs)
|
169
169
|
end
|
@@ -178,7 +178,7 @@ module Binance
|
|
178
178
|
# @option kwargs [Integer] :pageIndex Page number, empty default first page, starting from 1
|
179
179
|
# @option kwargs [Integer] :pageSize Number of pages, minimum 10, maximum 200
|
180
180
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
181
|
-
# @see https://binance
|
181
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-Detail
|
182
182
|
def mining_resale_detail(configId:, userName:, **kwargs)
|
183
183
|
Binance::Utils::Validation.require_param('configId', configId)
|
184
184
|
Binance::Utils::Validation.require_param('userName', userName)
|
@@ -201,7 +201,7 @@ module Binance
|
|
201
201
|
# @param hashRate [Integer] Resale hashrate h/s must be transferred (BTC is greater than 500000000000 ETH is greater than 500000)
|
202
202
|
# @param kwargs [Hash]
|
203
203
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
204
|
-
# @see https://binance
|
204
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Hashrate-Resale-Request
|
205
205
|
def mining_resale_request(userName:, algo:, startDate:, endDate:, toPoolUser:, hashRate:, **kwargs)
|
206
206
|
Binance::Utils::Validation.require_param('userName', userName)
|
207
207
|
Binance::Utils::Validation.require_param('algo', algo)
|
@@ -228,7 +228,7 @@ module Binance
|
|
228
228
|
# @param userName [String] Mining Account
|
229
229
|
# @param kwargs [Hash]
|
230
230
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
231
|
-
# @see https://binance
|
231
|
+
# @see https://developers.binance.com/docs/mining/rest-api/Cancel-hashrate-resale-configuration
|
232
232
|
def mining_resale_cancel(configId:, userName:, **kwargs)
|
233
233
|
Binance::Utils::Validation.require_param('userName', userName)
|
234
234
|
Binance::Utils::Validation.require_param('configId', configId)
|
@@ -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/simple_earn/Introduction
|
7
7
|
module SimpleEarn
|
8
8
|
# Get Simple Earn Flexible Product List (USER_DATA)
|
9
9
|
#
|
@@ -14,7 +14,7 @@ module Binance
|
|
14
14
|
# @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
|
15
15
|
# @option kwargs [Integer] :size Default:10, Max:100
|
16
16
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
17
|
-
# @see https://binance
|
17
|
+
# @see https://developers.binance.com/docs/simple_earn/account/Get-Simple-Earn-Flexible-Product-List
|
18
18
|
def flexible_product_list(**kwargs)
|
19
19
|
@session.sign_request(:get, '/sapi/v1/simple-earn/flexible/list', params: kwargs)
|
20
20
|
end
|
@@ -28,7 +28,7 @@ module Binance
|
|
28
28
|
# @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
|
29
29
|
# @option kwargs [Integer] :size Default:10, Max:100
|
30
30
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
31
|
-
# @see https://binance
|
31
|
+
# @see https://developers.binance.com/docs/simple_earn/account/Get-Simple-Earn-Locked-Product-List
|
32
32
|
def locked_product_list(**kwargs)
|
33
33
|
@session.sign_request(:get, '/sapi/v1/simple-earn/locked/list', params: kwargs)
|
34
34
|
end
|
@@ -43,7 +43,7 @@ module Binance
|
|
43
43
|
# @option kwargs [Boolean] :autoSubscribe true or false, default true
|
44
44
|
# @option kwargs [String] :sourceAccount SPOT,FUND,ALL, default SPOT
|
45
45
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
46
|
-
# @see https://binance
|
46
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Subscribe-Flexible-Product
|
47
47
|
def flexible_subscribe(productId:, amount:, **kwargs)
|
48
48
|
Binance::Utils::Validation.require_param('productId', productId)
|
49
49
|
Binance::Utils::Validation.require_param('amount', amount)
|
@@ -63,8 +63,9 @@ module Binance
|
|
63
63
|
# @param kwargs [Hash]
|
64
64
|
# @option kwargs [Boolean] :autoSubscribe true or false, default true
|
65
65
|
# @option kwargs [String] :sourceAccount SPOT,FUND,ALL, default SPOT
|
66
|
+
# @option kwargs [String] :redeemTo SPOT,FLEXIBLE, default FLEXIBLE
|
66
67
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
67
|
-
# @see https://binance
|
68
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Subscribe-Locked-Product
|
68
69
|
def locked_subscribe(projectId:, amount:, **kwargs)
|
69
70
|
Binance::Utils::Validation.require_param('projectId', projectId)
|
70
71
|
Binance::Utils::Validation.require_param('amount', amount)
|
@@ -85,7 +86,7 @@ module Binance
|
|
85
86
|
# @option kwargs [Float] :amount if redeemAll is false, amount is mandatory
|
86
87
|
# @option kwargs [String] :destAccount SPOT,FUND,ALL, default SPOT
|
87
88
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
88
|
-
# @see https://binance
|
89
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Redeem-Flexible-Product
|
89
90
|
def flexible_redeem_product(productId:, **kwargs)
|
90
91
|
Binance::Utils::Validation.require_param('productId', productId)
|
91
92
|
|
@@ -101,7 +102,7 @@ module Binance
|
|
101
102
|
# @param positionId [String]
|
102
103
|
# @param kwargs [Hash]
|
103
104
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
104
|
-
# @see https://binance
|
105
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Redeem-Locked-Product
|
105
106
|
def locked_redeem_product(positionId:, **kwargs)
|
106
107
|
Binance::Utils::Validation.require_param('positionId', positionId)
|
107
108
|
|
@@ -120,7 +121,7 @@ module Binance
|
|
120
121
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
121
122
|
# @option kwargs [Integer] :size Default:10, Max:100
|
122
123
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
123
|
-
# @see https://binance
|
124
|
+
# @see https://developers.binance.com/docs/simple_earn/account/Get-Flexible-Product-Position
|
124
125
|
def flexible_product_position(**kwargs)
|
125
126
|
@session.sign_request(:get, '/sapi/v1/simple-earn/flexible/position', params: kwargs)
|
126
127
|
end
|
@@ -136,7 +137,7 @@ module Binance
|
|
136
137
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
137
138
|
# @option kwargs [Integer] :size Default:10, Max:100
|
138
139
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
139
|
-
# @see https://binance
|
140
|
+
# @see https://developers.binance.com/docs/simple_earn/account/Get-Locked-Product-Position
|
140
141
|
def locked_product_position(**kwargs)
|
141
142
|
@session.sign_request(:get, '/sapi/v1/simple-earn/locked/position', params: kwargs)
|
142
143
|
end
|
@@ -147,7 +148,7 @@ module Binance
|
|
147
148
|
#
|
148
149
|
# @param kwargs [Hash]
|
149
150
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
150
|
-
# @see https://binance
|
151
|
+
# @see https://developers.binance.com/docs/simple_earn/account/Simple-Account
|
151
152
|
def simple_earn_account(**kwargs)
|
152
153
|
@session.sign_request(:get, '/sapi/v1/simple-earn/account', params: kwargs)
|
153
154
|
end
|
@@ -165,7 +166,7 @@ module Binance
|
|
165
166
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
166
167
|
# @option kwargs [Integer] :size Default:10, Max:100
|
167
168
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
168
|
-
# @see https://binance
|
169
|
+
# @see https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Subscription-Record
|
169
170
|
def flexible_subscription_record(**kwargs)
|
170
171
|
@session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/subscriptionRecord', params: kwargs)
|
171
172
|
end
|
@@ -182,7 +183,7 @@ module Binance
|
|
182
183
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
183
184
|
# @option kwargs [Integer] :size Default:10, Max:100
|
184
185
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
185
|
-
# @see https://binance
|
186
|
+
# @see https://developers.binance.com/docs/simple_earn/history/Get-Locked-Subscription-Record
|
186
187
|
def locked_subscription_record(**kwargs)
|
187
188
|
@session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/subscriptionRecord', params: kwargs)
|
188
189
|
end
|
@@ -200,7 +201,7 @@ module Binance
|
|
200
201
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
201
202
|
# @option kwargs [Integer] :size Default:10, Max:100
|
202
203
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
203
|
-
# @see https://binance
|
204
|
+
# @see https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Redemption-Record
|
204
205
|
def flexible_redemption_record(**kwargs)
|
205
206
|
@session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/redemptionRecord', params: kwargs)
|
206
207
|
end
|
@@ -218,7 +219,7 @@ module Binance
|
|
218
219
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
219
220
|
# @option kwargs [Integer] :size Default:10, Max:100
|
220
221
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
221
|
-
# @see https://binance
|
222
|
+
# @see https://developers.binance.com/docs/simple_earn/history/Get-Locked-Redemption-Record
|
222
223
|
def locked_redemption_record(**kwargs)
|
223
224
|
@session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/redemptionRecord', params: kwargs)
|
224
225
|
end
|
@@ -236,7 +237,7 @@ module Binance
|
|
236
237
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
237
238
|
# @option kwargs [Integer] :size Default:10, Max:100
|
238
239
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
239
|
-
# @see https://binance
|
240
|
+
# @see https://developers.binance.com/docs/simple_earn/history/Get-Flexible-Rewards-History
|
240
241
|
def flexible_rewards_history(type:, **kwargs)
|
241
242
|
Binance::Utils::Validation.require_param('type', type)
|
242
243
|
|
@@ -255,7 +256,7 @@ module Binance
|
|
255
256
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
256
257
|
# @option kwargs [Integer] :size Default:10, Max:100
|
257
258
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
258
|
-
# @see https://binance
|
259
|
+
# @see https://developers.binance.com/docs/simple_earn/history/Get-Locked-Rewards-History
|
259
260
|
def locked_rewards_history(**kwargs)
|
260
261
|
@session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/rewardsRecord', params: kwargs)
|
261
262
|
end
|
@@ -268,7 +269,7 @@ module Binance
|
|
268
269
|
# @param autoSubscribe [Boolean] true or false
|
269
270
|
# @param kwargs [Hash]
|
270
271
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
271
|
-
# @see https://binance
|
272
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Set-Flexible-Auto-Subscribe
|
272
273
|
def flexible_auto_subscribe(productId:, autoSubscribe:, **kwargs)
|
273
274
|
Binance::Utils::Validation.require_param('productId', productId)
|
274
275
|
Binance::Utils::Validation.require_param('autoSubscribe', autoSubscribe)
|
@@ -287,7 +288,7 @@ module Binance
|
|
287
288
|
# @param autoSubscribe [Boolean] true or false
|
288
289
|
# @param kwargs [Hash]
|
289
290
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
290
|
-
# @see https://binance
|
291
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Set-Locked-Auto-Subscribe
|
291
292
|
def locked_auto_subscribe(positionId:, autoSubscribe:, **kwargs)
|
292
293
|
Binance::Utils::Validation.require_param('positionId', positionId)
|
293
294
|
Binance::Utils::Validation.require_param('autoSubscribe', autoSubscribe)
|
@@ -305,7 +306,7 @@ module Binance
|
|
305
306
|
# @param productId [String]
|
306
307
|
# @param kwargs [Hash]
|
307
308
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
308
|
-
# @see https://binance
|
309
|
+
# @see https://developers.binance.com/docs/simple_earn/account/Get-Flexible-Personal-Left-Quota
|
309
310
|
def flexible_personal_left_quota(productId:, **kwargs)
|
310
311
|
Binance::Utils::Validation.require_param('productId', productId)
|
311
312
|
|
@@ -319,7 +320,7 @@ module Binance
|
|
319
320
|
# @param projectId [String]
|
320
321
|
# @param kwargs [Hash]
|
321
322
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
322
|
-
# @see https://binance
|
323
|
+
# @see https://developers.binance.com/docs/simple_earn/account/Get-Locked-Personal-Left-Quota
|
323
324
|
def locked_personal_left_quota(projectId:, **kwargs)
|
324
325
|
Binance::Utils::Validation.require_param('projectId', projectId)
|
325
326
|
|
@@ -334,7 +335,7 @@ module Binance
|
|
334
335
|
# @param amount [Float]
|
335
336
|
# @param kwargs [Hash]
|
336
337
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
337
|
-
# @see https://binance
|
338
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Get-Flexible-Subscription-Preview
|
338
339
|
def flexible_subscription_preview(productId:, amount:, **kwargs)
|
339
340
|
Binance::Utils::Validation.require_param('productId', productId)
|
340
341
|
Binance::Utils::Validation.require_param('amount', amount)
|
@@ -354,7 +355,7 @@ module Binance
|
|
354
355
|
# @param kwargs [Hash]
|
355
356
|
# @option kwargs [Boolean] :autoSubscribe true or false, default true
|
356
357
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
357
|
-
# @see https://binance
|
358
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Get-Locked-Subscription-Preview
|
358
359
|
def locked_subscription_preview(projectId:, amount:, **kwargs)
|
359
360
|
Binance::Utils::Validation.require_param('projectId', projectId)
|
360
361
|
Binance::Utils::Validation.require_param('amount', amount)
|
@@ -365,6 +366,25 @@ module Binance
|
|
365
366
|
))
|
366
367
|
end
|
367
368
|
|
369
|
+
# Set Locked Product Redeem Option (USER_DATA)
|
370
|
+
#
|
371
|
+
# POST /sapi/v1/simple-earn/locked/setRedeemOption
|
372
|
+
#
|
373
|
+
# @param positionId [String]
|
374
|
+
# @param redeemTo [String] SPOT or FLEXIBLE
|
375
|
+
# @param kwargs [Hash]
|
376
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
377
|
+
# @see https://developers.binance.com/docs/simple_earn/earn/Set-Locked-Redeem-Option
|
378
|
+
def locked_redeem_option(positionId:, redeemTo:, **kwargs)
|
379
|
+
Binance::Utils::Validation.require_param('positionId', positionId)
|
380
|
+
Binance::Utils::Validation.require_param('redeemTo', redeemTo)
|
381
|
+
|
382
|
+
@session.sign_request(:post, '/sapi/v1/simple-earn/locked/setRedeemOption', params: kwargs.merge(
|
383
|
+
positionId: positionId,
|
384
|
+
redeemTo: redeemTo
|
385
|
+
))
|
386
|
+
end
|
387
|
+
|
368
388
|
# Get Rate History (USER_DATA)
|
369
389
|
#
|
370
390
|
# GET /sapi/v1/simple-earn/flexible/history/rateHistory
|
@@ -376,7 +396,7 @@ module Binance
|
|
376
396
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
377
397
|
# @option kwargs [Integer] :size Default:10, Max:100
|
378
398
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
379
|
-
# @see https://binance
|
399
|
+
# @see https://developers.binance.com/docs/simple_earn/history/Get-Rate-History
|
380
400
|
def rate_history(productId:, **kwargs)
|
381
401
|
Binance::Utils::Validation.require_param('productId', productId)
|
382
402
|
|
@@ -394,7 +414,7 @@ module Binance
|
|
394
414
|
# @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
|
395
415
|
# @option kwargs [Integer] :size Default:10, Max:100
|
396
416
|
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
397
|
-
# @see https://binance
|
417
|
+
# @see https://developers.binance.com/docs/simple_earn/history/Get-Collateral-Record
|
398
418
|
def collateral_record(**kwargs)
|
399
419
|
@session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/collateralRecord', params: kwargs)
|
400
420
|
end
|
data/lib/binance/spot/stream.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Binance
|
4
4
|
class Spot
|
5
5
|
# User data stream endpoints
|
6
|
-
# @see https://binance
|
6
|
+
# @see https://developers.binance.com/docs/binance-spot-api-docs/user-data-stream
|
7
7
|
module Stream
|
8
8
|
# Create a ListenKey (USER_STREAM)
|
9
9
|
#
|