binance-connector-ruby 1.0.1
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 +7 -0
- data/CHANGELOG.md +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +224 -0
- data/lib/binance/authentication.rb +13 -0
- data/lib/binance/error.rb +28 -0
- data/lib/binance/session.rb +106 -0
- data/lib/binance/spot/blvt.rb +104 -0
- data/lib/binance/spot/bswap.rb +217 -0
- data/lib/binance/spot/c2c.rb +27 -0
- data/lib/binance/spot/fiat.rb +49 -0
- data/lib/binance/spot/futures.rb +357 -0
- data/lib/binance/spot/loan.rb +26 -0
- data/lib/binance/spot/margin.rb +676 -0
- data/lib/binance/spot/market.rb +220 -0
- data/lib/binance/spot/mining.rb +243 -0
- data/lib/binance/spot/savings.rb +269 -0
- data/lib/binance/spot/stream.rb +61 -0
- data/lib/binance/spot/subaccount.rb +553 -0
- data/lib/binance/spot/trade.rb +294 -0
- data/lib/binance/spot/wallet.rb +316 -0
- data/lib/binance/spot/websocket.rb +147 -0
- data/lib/binance/spot.rb +61 -0
- data/lib/binance/utils/faraday/custom_params_encoder.rb +78 -0
- data/lib/binance/utils/faraday/middleware/signature.rb +21 -0
- data/lib/binance/utils/faraday/middleware/timestamp.rb +20 -0
- data/lib/binance/utils/faraday/middleware.rb +4 -0
- data/lib/binance/utils/url.rb +26 -0
- data/lib/binance/utils/validation.rb +26 -0
- data/lib/binance/version.rb +5 -0
- data/lib/binance/websocket_base.rb +84 -0
- data/lib/binance.rb +5 -0
- metadata +161 -0
@@ -0,0 +1,294 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Binance
|
4
|
+
class Spot
|
5
|
+
# This module includes all spot trading methods, including:
|
6
|
+
# - place orders (spot and oco)
|
7
|
+
# - query orders (spot and oco)
|
8
|
+
# - cancel orders (spot and oco)
|
9
|
+
# - account information
|
10
|
+
# - my trades
|
11
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#spot-account-trade
|
12
|
+
module Trade
|
13
|
+
# TestNew Order
|
14
|
+
#
|
15
|
+
# POST /api/v3/order/test
|
16
|
+
#
|
17
|
+
# send in a new order to test the request, no order is really generated.
|
18
|
+
#
|
19
|
+
# @param symbol [String] the symbol
|
20
|
+
# @param side [String]
|
21
|
+
# @param type [String]
|
22
|
+
# @param kwargs [Hash]
|
23
|
+
# @option kwargs [String] :timeInForce
|
24
|
+
# @option kwargs [Float] :quantity
|
25
|
+
# @option kwargs [Float] :quoteOrderQty
|
26
|
+
# @option kwargs [Float] :price
|
27
|
+
# @option kwargs [String] :newClientOrderId
|
28
|
+
# @option kwargs [Float] :stopPrice
|
29
|
+
# @option kwargs [Float] :icebergeQty
|
30
|
+
# @option kwargs [String] :newOrderRespType Set the response JSON. ACK, RESULT, or FULL.
|
31
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
32
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#test-new-order-trade
|
33
|
+
def new_order_test(symbol:, side:, type:, **kwargs)
|
34
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
35
|
+
Binance::Utils::Validation.require_param('side', side)
|
36
|
+
Binance::Utils::Validation.require_param('type', type)
|
37
|
+
|
38
|
+
@session.sign_request(:post, '/api/v3/order/test', params: kwargs.merge(
|
39
|
+
symbol: symbol,
|
40
|
+
side: side,
|
41
|
+
type: type
|
42
|
+
))
|
43
|
+
end
|
44
|
+
|
45
|
+
# New Order
|
46
|
+
#
|
47
|
+
# POST /api/v3/order
|
48
|
+
#
|
49
|
+
# send in a new order
|
50
|
+
#
|
51
|
+
# @param symbol [String] the symbol
|
52
|
+
# @param side [String]
|
53
|
+
# @param type [String]
|
54
|
+
# @param kwargs [Hash]
|
55
|
+
# @option kwargs [String] :timeInForce
|
56
|
+
# @option kwargs [Float] :quantity
|
57
|
+
# @option kwargs [Float] :quoteOrderQty
|
58
|
+
# @option kwargs [Float] :price
|
59
|
+
# @option kwargs [String] :newClientOrderId
|
60
|
+
# @option kwargs [Float] :stopPrice
|
61
|
+
# @option kwargs [Float] :icebergeQty
|
62
|
+
# @option kwargs [String] :newOrderRespType Set the response JSON. ACK, RESULT, or FULL.
|
63
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
64
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#new-order-trade
|
65
|
+
def new_order(symbol:, side:, type:, **kwargs)
|
66
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
67
|
+
Binance::Utils::Validation.require_param('side', side)
|
68
|
+
Binance::Utils::Validation.require_param('type', type)
|
69
|
+
|
70
|
+
@session.sign_request(:post, '/api/v3/order', params: kwargs.merge(
|
71
|
+
symbol: symbol,
|
72
|
+
side: side,
|
73
|
+
type: type
|
74
|
+
))
|
75
|
+
end
|
76
|
+
|
77
|
+
# Cancel Order (TRADE)
|
78
|
+
#
|
79
|
+
# DELETE /api/v3/order
|
80
|
+
#
|
81
|
+
# @param symbol [String] the symbol
|
82
|
+
# @param kwargs [Hash]
|
83
|
+
# @option kwargs [Integer] :orderId
|
84
|
+
# @option kwargs [String] :origClientOrderId
|
85
|
+
# @option kwargs [String] :newClientOrderId
|
86
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
87
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#cancel-order-trade
|
88
|
+
def cancel_order(symbol:, **kwargs)
|
89
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
90
|
+
|
91
|
+
@session.sign_request(:delete, '/api/v3/order', params: kwargs.merge(symbol: symbol))
|
92
|
+
end
|
93
|
+
|
94
|
+
# Cancel all Open Orders on a Symbol (TRADE)
|
95
|
+
#
|
96
|
+
# DELETE /api/v3/openOrders
|
97
|
+
#
|
98
|
+
# @param symbol [String] the symbol
|
99
|
+
# @param kwargs [Hash]
|
100
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
101
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#cancel-all-open-orders-on-a-symbol-trade
|
102
|
+
def cancel_open_orders(symbol:, **kwargs)
|
103
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
104
|
+
|
105
|
+
@session.sign_request(:delete, '/api/v3/openOrders', params: kwargs.merge(symbol: symbol))
|
106
|
+
end
|
107
|
+
|
108
|
+
# Query Order (USER_DATA)
|
109
|
+
#
|
110
|
+
# GET /api/v3/order
|
111
|
+
#
|
112
|
+
# @param symbol [String] the symbol
|
113
|
+
# @param kwargs [Hash]
|
114
|
+
# @option kwargs [Integer] :orderId
|
115
|
+
# @option kwargs [String] :origClientOrderId
|
116
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
117
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#query-order-user_data
|
118
|
+
def get_order(symbol:, **kwargs)
|
119
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
120
|
+
|
121
|
+
@session.sign_request(:get, '/api/v3/order', params: kwargs.merge(symbol: symbol))
|
122
|
+
end
|
123
|
+
|
124
|
+
# Current Open Orders (USER_DATA)
|
125
|
+
#
|
126
|
+
# GET /api/v3/openOrders
|
127
|
+
#
|
128
|
+
# @param kwargs [Hash]
|
129
|
+
# @option kwargs [String] :symbol the symbol
|
130
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
131
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data
|
132
|
+
def open_orders(**kwargs)
|
133
|
+
@session.sign_request(:get, '/api/v3/openOrders', params: kwargs)
|
134
|
+
end
|
135
|
+
|
136
|
+
# All Orders (USER_DATA)
|
137
|
+
#
|
138
|
+
# GET /api/v3/allOrders
|
139
|
+
#
|
140
|
+
# Get all account orders; active, canceled, or filled.
|
141
|
+
#
|
142
|
+
# @param symbol [String] the symbol
|
143
|
+
# @param kwargs [Hash]
|
144
|
+
# @option kwargs [String] :orderId
|
145
|
+
# @option kwargs [String] :startTime
|
146
|
+
# @option kwargs [String] :endTime
|
147
|
+
# @option kwargs [String] :limit Default 500; max 1000.
|
148
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
149
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
|
150
|
+
def all_orders(symbol:, **kwargs)
|
151
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
152
|
+
|
153
|
+
@session.sign_request(:get, '/api/v3/allOrders', params: kwargs.merge(symbol: symbol))
|
154
|
+
end
|
155
|
+
|
156
|
+
# New OCO (TRADE)
|
157
|
+
#
|
158
|
+
# POST /api/v3/order/oco
|
159
|
+
#
|
160
|
+
# Send in a new OCO
|
161
|
+
#
|
162
|
+
# @param symbol [String] the symbol
|
163
|
+
# @param side [String]
|
164
|
+
# @param quantity [Float]
|
165
|
+
# @param price [Float]
|
166
|
+
# @param stopPrice [Float]
|
167
|
+
# @param kwargs [Hash]
|
168
|
+
# @option kwargs [String] :listClientOrderId
|
169
|
+
# @option kwargs [String] :limitClientOrderId
|
170
|
+
# @option kwargs [Float] :limitIcebergQty
|
171
|
+
# @option kwargs [String] :stopClientOrderId
|
172
|
+
# @option kwargs [Float] :stopLimitPrice
|
173
|
+
# @option kwargs [Float] :stopIcebergQty
|
174
|
+
# @option kwargs [Float] :stopLimitTimeInForce GTC/ FOK/ IOC
|
175
|
+
# @option kwargs [String] :newOrderRespType
|
176
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
177
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#new-oco-trade
|
178
|
+
def new_oco_order(symbol:, side:, quantity:, price:, stopPrice:, **kwargs)
|
179
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
180
|
+
Binance::Utils::Validation.require_param('side', side)
|
181
|
+
Binance::Utils::Validation.require_param('quantity', quantity)
|
182
|
+
Binance::Utils::Validation.require_param('price', price)
|
183
|
+
Binance::Utils::Validation.require_param('stopPrice', stopPrice)
|
184
|
+
|
185
|
+
@session.sign_request(:post, '/api/v3/order/oco', params: kwargs.merge(
|
186
|
+
symbol: symbol,
|
187
|
+
side: side,
|
188
|
+
quantity: quantity,
|
189
|
+
price: price,
|
190
|
+
stopPrice: stopPrice
|
191
|
+
))
|
192
|
+
end
|
193
|
+
|
194
|
+
# Cancel OCO (TRADE)
|
195
|
+
#
|
196
|
+
# DELETE /api/v3/orderList
|
197
|
+
#
|
198
|
+
# @param symbol [String] the symbol
|
199
|
+
# @param kwargs [Hash]
|
200
|
+
# @option kwargs [Integer] :orderListId
|
201
|
+
# @option kwargs [String] :listClientOrderId
|
202
|
+
# @option kwargs [String] :newClientOrderId
|
203
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
204
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#cancel-oco-trade
|
205
|
+
def cancel_order_list(symbol:, **kwargs)
|
206
|
+
Binance::Utils::Validation.require_param('symbol', symbol)
|
207
|
+
|
208
|
+
@session.sign_request(:delete, '/api/v3/orderList', params: kwargs.merge(symbol: symbol))
|
209
|
+
end
|
210
|
+
|
211
|
+
# Query OCO (USER_DATA)
|
212
|
+
#
|
213
|
+
# GET /api/v3/orderList
|
214
|
+
#
|
215
|
+
# Retrieves a specific OCO based on provided optional parameters
|
216
|
+
#
|
217
|
+
# @param kwargs [Hash]
|
218
|
+
# @option kwargs [Integer] :orderListId
|
219
|
+
# @option kwargs [String] :orgClientOrderId
|
220
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
221
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#query-oco-user_data
|
222
|
+
def order_list(**kwargs)
|
223
|
+
@session.sign_request(:get, '/api/v3/orderList', params: kwargs)
|
224
|
+
end
|
225
|
+
|
226
|
+
# Query all OCO (USER_DATA)
|
227
|
+
#
|
228
|
+
# GET /api/v3/allOrderList
|
229
|
+
#
|
230
|
+
# Retrieves all OCO based on provided optional parameters
|
231
|
+
#
|
232
|
+
# @param kwargs [Hash]
|
233
|
+
# @option kwargs [Integer] :fromId
|
234
|
+
# @option kwargs [String] :startTime
|
235
|
+
# @option kwargs [String] :endTime
|
236
|
+
# @option kwargs [String] :limit Default 500; max 1000.
|
237
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
238
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#query-all-oco-user_data
|
239
|
+
def all_order_list(**kwargs)
|
240
|
+
@session.sign_request(:get, '/api/v3/allOrderList', params: kwargs)
|
241
|
+
end
|
242
|
+
|
243
|
+
# Query Open OCO (USER_DATA)
|
244
|
+
#
|
245
|
+
# GET /api/v3/openOrderList
|
246
|
+
#
|
247
|
+
# @param kwargs [Hash]
|
248
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
249
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#query-open-oco-user_data
|
250
|
+
def open_order_list(**kwargs)
|
251
|
+
@session.sign_request(:get, '/api/v3/openOrderList', params: kwargs)
|
252
|
+
end
|
253
|
+
|
254
|
+
# Account Information (USER_DATA)
|
255
|
+
#
|
256
|
+
# GET /api/v3/account
|
257
|
+
#
|
258
|
+
# @param kwargs [Hash]
|
259
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
260
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data
|
261
|
+
def account(**kwargs)
|
262
|
+
@session.sign_request(:get, '/api/v3/account', params: kwargs)
|
263
|
+
end
|
264
|
+
|
265
|
+
# Account Trade List (USER_DATA)
|
266
|
+
#
|
267
|
+
# GET /api/v3/myTrades
|
268
|
+
#
|
269
|
+
# @param symbol [String] the symbol
|
270
|
+
# @param kwargs [Hash]
|
271
|
+
# @option kwargs [Integer] :orderId
|
272
|
+
# @option kwargs [Integer] :startTime
|
273
|
+
# @option kwargs [Integer] :endTime
|
274
|
+
# @option kwargs [Integer] :fromId TradeId to fetch from. Default gets most recent trades.
|
275
|
+
# @option kwargs [Integer] :limit Default 500; max 1000.
|
276
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
277
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#account-trade-list-user_data
|
278
|
+
def my_trades(symbol:, **kwargs)
|
279
|
+
@session.sign_request(:get, '/api/v3/myTrades', params: kwargs.merge(symbol: symbol))
|
280
|
+
end
|
281
|
+
|
282
|
+
# Query Current Order Count Usage (TRADE)
|
283
|
+
#
|
284
|
+
# GET /api/v3/rateLimit/order
|
285
|
+
#
|
286
|
+
# @param kwargs [Hash]
|
287
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
288
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#query-current-order-count-usage-trade
|
289
|
+
def get_order_rate_limit(**kwargs)
|
290
|
+
@session.sign_request(:get, '/api/v3/rateLimit/order', params: kwargs)
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
@@ -0,0 +1,316 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Binance
|
4
|
+
class Spot
|
5
|
+
# all wallet endpoints
|
6
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#wallet-endpoints
|
7
|
+
module Wallet
|
8
|
+
# System Status (System)
|
9
|
+
#
|
10
|
+
# GET /sapi/v1/system/status
|
11
|
+
#
|
12
|
+
# Fetch system status.
|
13
|
+
#
|
14
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#system-status-system
|
15
|
+
def system_status
|
16
|
+
@session.public_request(path: '/sapi/v1/system/status')
|
17
|
+
end
|
18
|
+
|
19
|
+
# All Coins' Information (USER_DATA)
|
20
|
+
#
|
21
|
+
# GET /sapi/v1/capital/config/getall
|
22
|
+
#
|
23
|
+
# Get information of coins (available for deposit and withdraw) for user.
|
24
|
+
#
|
25
|
+
# @param kwargs [Hash]
|
26
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
27
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#all-coins-39-information-user_data
|
28
|
+
def coin_info(**kwargs)
|
29
|
+
@session.sign_request(:get, '/sapi/v1/capital/config/getall', params: kwargs)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Daily Account Snapshot (USER_DATA)
|
33
|
+
#
|
34
|
+
# GET /sapi/v1/accountSnapshot
|
35
|
+
#
|
36
|
+
# @param type [String] "SPOT", "MARGIN", "FUTURES"
|
37
|
+
# @param kwargs [Hash]
|
38
|
+
# @option kwargs [Integer] :startTime
|
39
|
+
# @option kwargs [Integer] :endTime
|
40
|
+
# @option kwargs [Integer] :limit min 5, max 30, default 5
|
41
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
42
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#daily-account-snapshot-user_data
|
43
|
+
def account_snapshot(type:, **kwargs)
|
44
|
+
Binance::Utils::Validation.require_param('type', type)
|
45
|
+
|
46
|
+
@session.sign_request(:get, '/sapi/v1/accountSnapshot', params: kwargs.merge(
|
47
|
+
type: type
|
48
|
+
))
|
49
|
+
end
|
50
|
+
|
51
|
+
# Disable Fast Withdraw Switch (USER_DATA)
|
52
|
+
#
|
53
|
+
# POST /sapi/v1/account/disableFastWithdrawSwitch
|
54
|
+
#
|
55
|
+
# @param kwargs [Hash]
|
56
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
57
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#disable-fast-withdraw-switch-user_data
|
58
|
+
def disable_fast_withdraw(**kwargs)
|
59
|
+
@session.sign_request(:post, '/sapi/v1/account/disableFastWithdrawSwitch', params: kwargs)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Enable Fast Withdraw Switch (USER_DATA)
|
63
|
+
#
|
64
|
+
# POST /sapi/v1/account/enableFastWithdrawSwitch
|
65
|
+
#
|
66
|
+
# @param kwargs [Hash]
|
67
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
68
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#enable-fast-withdraw-switch-user_data
|
69
|
+
def enable_fast_withdraw(**kwargs)
|
70
|
+
@session.sign_request(:post, '/sapi/v1/account/enableFastWithdrawSwitch', params: kwargs)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Withdraw [SAPI]
|
74
|
+
#
|
75
|
+
# POST /sapi/v1/capital/withdraw/apply
|
76
|
+
#
|
77
|
+
# @param coin [String]
|
78
|
+
# @param address [String]
|
79
|
+
# @param amount [Float]
|
80
|
+
# @param kwargs [Hash]
|
81
|
+
# @option kwargs [String] :withdrawOrderId
|
82
|
+
# @option kwargs [String] :network If network not send, return with default network of the coin.
|
83
|
+
# @option kwargs [String] :addressTag
|
84
|
+
# @option kwargs [Boolean] :transactionFeeFlag
|
85
|
+
# @option kwargs [String] :name
|
86
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
87
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
88
|
+
def withdraw(coin:, address:, amount:, **kwargs)
|
89
|
+
Binance::Utils::Validation.require_param('coin', coin)
|
90
|
+
Binance::Utils::Validation.require_param('address', address)
|
91
|
+
Binance::Utils::Validation.require_param('amount', amount)
|
92
|
+
|
93
|
+
@session.sign_request(:post, '/sapi/v1/capital/withdraw/apply', params: kwargs.merge(
|
94
|
+
coin: coin,
|
95
|
+
address: address,
|
96
|
+
amount: amount
|
97
|
+
))
|
98
|
+
end
|
99
|
+
|
100
|
+
# Deposit History (supporting network) (USER_DATA)
|
101
|
+
#
|
102
|
+
# GET /sapi/v1/capital/deposit/hisrec
|
103
|
+
#
|
104
|
+
# @param kwargs [Hash]
|
105
|
+
# @option kwargs [String] :coin
|
106
|
+
# @option kwargs [Integer] :status 0(0:pending,6: credited but cannot withdraw, 1:success)
|
107
|
+
# @option kwargs [Integer] :startTime
|
108
|
+
# @option kwargs [Integer] :endTime
|
109
|
+
# @option kwargs [Integer] :offest Default:0
|
110
|
+
# @option kwargs [Integer] :limit Default:1000, Max:1000
|
111
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
112
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#deposit-history-supporting-network-user_data
|
113
|
+
def deposit_history(**kwargs)
|
114
|
+
@session.sign_request(:get, '/sapi/v1/capital/deposit/hisrec', params: kwargs)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Withdraw History (supporting network) (USER_DATA)
|
118
|
+
#
|
119
|
+
# GET /sapi/v1/capital/withdraw/history
|
120
|
+
#
|
121
|
+
# @param kwargs [Hash]
|
122
|
+
# @option kwargs [String] :coin
|
123
|
+
# @option kwargs [String] :withdrawOrderId
|
124
|
+
# @option kwargs [Integer] :status 0(0:pending,6: credited but cannot withdraw, 1:success)
|
125
|
+
# @option kwargs [Integer] :startTime
|
126
|
+
# @option kwargs [Integer] :endTime
|
127
|
+
# @option kwargs [Integer] :offest
|
128
|
+
# @option kwargs [Integer] :limit
|
129
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
130
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
|
131
|
+
def withdraw_history(**kwargs)
|
132
|
+
@session.sign_request(:get, '/sapi/v1/capital/withdraw/history', params: kwargs)
|
133
|
+
end
|
134
|
+
|
135
|
+
# Deposit Address (supporting network) (USER_DATA)
|
136
|
+
#
|
137
|
+
# GET /sapi/v1/capital/deposit/address
|
138
|
+
#
|
139
|
+
# @param coin [String]
|
140
|
+
# @param kwargs [Hash]
|
141
|
+
# @option kwargs [String] :network
|
142
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
143
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#withdraw-history-supporting-network-user_data
|
144
|
+
def deposit_address(coin:, **kwargs)
|
145
|
+
Binance::Utils::Validation.require_param('coin', coin)
|
146
|
+
|
147
|
+
@session.sign_request(:get, '/sapi/v1/capital/deposit/address', params: kwargs.merge(
|
148
|
+
coin: coin
|
149
|
+
))
|
150
|
+
end
|
151
|
+
|
152
|
+
# Account Status (USER_DATA)
|
153
|
+
#
|
154
|
+
# GET /sapi/v1/account/status
|
155
|
+
#
|
156
|
+
# Fetch account status detail.
|
157
|
+
#
|
158
|
+
# @param kwargs [Hash]
|
159
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
160
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#account-status-user_data
|
161
|
+
def account_status(**kwargs)
|
162
|
+
@session.sign_request(:get, '/sapi/v1/account/status', params: kwargs)
|
163
|
+
end
|
164
|
+
|
165
|
+
# Account API Trading Status (USER_DATA)
|
166
|
+
#
|
167
|
+
# GET /sapi/v1/account/apiTradingStatus
|
168
|
+
#
|
169
|
+
# Fetch account api trading status detail.
|
170
|
+
#
|
171
|
+
# @param kwargs [Hash]
|
172
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
173
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#account-api-trading-status-user_data
|
174
|
+
def api_trading_status(**kwargs)
|
175
|
+
@session.sign_request(:get, '/sapi/v1/account/apiTradingStatus', params: kwargs)
|
176
|
+
end
|
177
|
+
|
178
|
+
# DustLog (USER_DATA)
|
179
|
+
#
|
180
|
+
# GET /sapi/v1/asset/dribblet
|
181
|
+
#
|
182
|
+
# @param kwargs [Hash]
|
183
|
+
# @option kwargs [Integer] :startTime
|
184
|
+
# @option kwargs [Integer] :endTime
|
185
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
186
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#dustlog-user_data
|
187
|
+
def dust_log(**kwargs)
|
188
|
+
@session.sign_request(:get, '/sapi/v1/asset/dribblet', params: kwargs)
|
189
|
+
end
|
190
|
+
|
191
|
+
# Dust Transfer (USER_DATA)
|
192
|
+
#
|
193
|
+
# POST /sapi/v1/asset/dust
|
194
|
+
#
|
195
|
+
# Convert dust assets to BNB.
|
196
|
+
#
|
197
|
+
# @param asset [Array]
|
198
|
+
# @param kwargs [Hash]
|
199
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
200
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#dust-transfer-user_data
|
201
|
+
def dust_transfer(asset:, **kwargs)
|
202
|
+
Binance::Utils::Validation.require_param('asset', asset)
|
203
|
+
|
204
|
+
@session.sign_request(:post, '/sapi/v1/asset/dust', params: kwargs.merge(
|
205
|
+
asset: asset
|
206
|
+
))
|
207
|
+
end
|
208
|
+
|
209
|
+
# Asset Dividend Record (USER_DATA)
|
210
|
+
#
|
211
|
+
# GET /sapi/v1/asset/assetDividend
|
212
|
+
#
|
213
|
+
# @param kwargs [Hash]
|
214
|
+
# @option kwargs [String] :asset
|
215
|
+
# @option kwargs [Integer] :startTime
|
216
|
+
# @option kwargs [Integer] :endTime
|
217
|
+
# @option kwargs [Integer] :limit Default 20, max 500
|
218
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
219
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#asset-dividend-record-user_data
|
220
|
+
def asset_devidend_record(**kwargs)
|
221
|
+
@session.sign_request(:get, '/sapi/v1/asset/assetDividend', params: kwargs)
|
222
|
+
end
|
223
|
+
|
224
|
+
# Asset Detail (USER_DATA)
|
225
|
+
#
|
226
|
+
# GET /sapi/v1/asset/assetDetail
|
227
|
+
#
|
228
|
+
# @param kwargs [Hash]
|
229
|
+
# @option kwargs [String] :asset
|
230
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
231
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#asset-detail-user_data
|
232
|
+
def asset_detail(**kwargs)
|
233
|
+
@session.sign_request(:get, '/sapi/v1/asset/assetDetail', params: kwargs)
|
234
|
+
end
|
235
|
+
|
236
|
+
# Trade Fee (USER_DATA)
|
237
|
+
#
|
238
|
+
# GET /sapi/v1/asset/tradeFee
|
239
|
+
#
|
240
|
+
# @param kwargs [Hash]
|
241
|
+
# @option kwargs [String] :symbol
|
242
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
243
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
|
244
|
+
def trade_fee(**kwargs)
|
245
|
+
@session.sign_request(:get, '/sapi/v1/asset/tradeFee', params: kwargs)
|
246
|
+
end
|
247
|
+
|
248
|
+
# User Universal Transfer (USER_DATA)
|
249
|
+
#
|
250
|
+
# POST /sapi/v1/asset/transfer
|
251
|
+
#
|
252
|
+
# @param type [String]
|
253
|
+
# @param asset [String]
|
254
|
+
# @param amount [Float]
|
255
|
+
# @param kwargs [Hash]
|
256
|
+
# @option kwargs [String] :fromSymbol must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
|
257
|
+
# @option kwargs [String] :toSymbol must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
|
258
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
259
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
|
260
|
+
def user_universal_transfer(type:, asset:, amount:, **kwargs)
|
261
|
+
Binance::Utils::Validation.require_param('type', type)
|
262
|
+
Binance::Utils::Validation.require_param('asset', asset)
|
263
|
+
Binance::Utils::Validation.require_param('amount', amount)
|
264
|
+
|
265
|
+
@session.sign_request(:post, '/sapi/v1/asset/transfer', params: kwargs.merge(
|
266
|
+
type: type,
|
267
|
+
asset: asset,
|
268
|
+
amount: amount
|
269
|
+
))
|
270
|
+
end
|
271
|
+
|
272
|
+
# Query User Universal Transfer History (USER_DATA)
|
273
|
+
#
|
274
|
+
# GET /sapi/v1/asset/transfer
|
275
|
+
#
|
276
|
+
# @param type [String]
|
277
|
+
# @param kwargs [Hash]
|
278
|
+
# @option kwargs [Integer] :startTime
|
279
|
+
# @option kwargs [Integer] :endTime
|
280
|
+
# @option kwargs [Integer] :current Default 1
|
281
|
+
# @option kwargs [Integer] :size Default 10, Max 100
|
282
|
+
# @option kwargs [String] :fromSymbol must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
|
283
|
+
# @option kwargs [String] :toSymbol must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
|
284
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
285
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#query-user-universal-transfer-history-user_data
|
286
|
+
def user_universal_transfer_history(type:, **kwargs)
|
287
|
+
Binance::Utils::Validation.require_param('type', type)
|
288
|
+
@session.sign_request(:get, '/sapi/v1/asset/transfer', params: kwargs.merge(type: type))
|
289
|
+
end
|
290
|
+
|
291
|
+
# Funding Wallet (USER_DATA)
|
292
|
+
#
|
293
|
+
# POST /sapi/v1/asset/get-funding-asset
|
294
|
+
#
|
295
|
+
# @param kwargs [Hash]
|
296
|
+
# @option kwargs [String] :asset
|
297
|
+
# @option kwargs [String] :needBtcValuation true or false
|
298
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
299
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#funding-wallet-user_data
|
300
|
+
def funding_wallet(**kwargs)
|
301
|
+
@session.sign_request(:post, '/sapi/v1/asset/get-funding-asset', params: kwargs)
|
302
|
+
end
|
303
|
+
|
304
|
+
# Get API Key Permission (USER_DATA)
|
305
|
+
#
|
306
|
+
# GET /sapi/v1/account/apiRestrictions
|
307
|
+
#
|
308
|
+
# @param kwargs [Hash]
|
309
|
+
# @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
|
310
|
+
# @see https://binance-docs.github.io/apidocs/spot/en/#get-api-key-permission-user_data
|
311
|
+
def api_key_permission(**kwargs)
|
312
|
+
@session.sign_request(:get, '/sapi/v1/account/apiRestrictions', params: kwargs)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|