binance-connector-ruby 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,357 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Binance
4
- class Spot
5
- # Futures endpoints
6
- # @see https://binance-docs.github.io/apidocs/spot/en/#futures
7
- module Futures
8
- # New Future Account Transfer (USER_DATA)
9
- #
10
- # POST /sapi/v1/futures/transfer
11
- #
12
- # Execute transfer between spot account and futures account.
13
- #
14
- # @param asset [String]
15
- # @param amount [Float]
16
- # @param type [Integer] 1: transfer from spot account to USDT-M futures account. <br>
17
- # 2: transfer from USDT-M futures account to spot account. <br>
18
- # 3: transfer from spot account to COIN-M futures account. <br>
19
- # 4: transfer from COIN-M futures account to spot account. <br>
20
- # @param kwargs [Hash]
21
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
22
- # @see https://binance-docs.github.io/apidocs/spot/en/#new-future-account-transfer-user_data
23
- def futures_account_transfer(asset:, amount:, type:, **kwargs)
24
- Binance::Utils::Validation.require_param('asset', asset)
25
- Binance::Utils::Validation.require_param('amount', amount)
26
- Binance::Utils::Validation.require_param('type', type)
27
-
28
- @session.sign_request(:post, '/sapi/v1/futures/transfer', params: kwargs.merge(
29
- asset: asset,
30
- amount: amount,
31
- type: type
32
- ))
33
- end
34
-
35
- # Get Future Account Transaction History List (USER_DATA)
36
- #
37
- # GET /sapi/v1/futures/transfer
38
- #
39
- # @param asset [String]
40
- # @param startTime [Integer]
41
- # @param kwargs [Hash]
42
- # @option kwargs [Integer] :endTime
43
- # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
44
- # @option kwargs [Integer] :size Default:10 Max:100
45
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
46
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-future-account-transaction-history-list-user_data
47
- def futures_account_transfer_history(asset:, startTime:, **kwargs)
48
- Binance::Utils::Validation.require_param('asset', asset)
49
- Binance::Utils::Validation.require_param('startTime', startTime)
50
-
51
- @session.sign_request(:get, '/sapi/v1/futures/transfer', params: kwargs.merge(
52
- asset: asset,
53
- startTime: startTime
54
- ))
55
- end
56
-
57
- # Borrow For Cross-Collateral (TRADE)
58
- #
59
- # POST /sapi/v1/futures/loan/borrow
60
- #
61
- # @param coin [String]
62
- # @param collateralCoin [String]
63
- # @param kwargs [Hash]
64
- # @option kwargs [Float] :amount Mandatory when collateralAmount is empty.
65
- # @option kwargs [Float] :collateralAmount Mandatory when amount is empty.
66
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
67
- # @see https://binance-docs.github.io/apidocs/spot/en/#borrow-for-cross-collateral-trade
68
- def cross_collateral_borrow(coin:, collateralCoin:, **kwargs)
69
- Binance::Utils::Validation.require_param('coin', coin)
70
- Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
71
-
72
- @session.sign_request(:post, '/sapi/v1/futures/loan/borrow', params: kwargs.merge(
73
- coin: coin,
74
- collateralCoin: collateralCoin
75
- ))
76
- end
77
-
78
- # Cross-Collateral Borrow History (USER_DATA)
79
- #
80
- # GET /sapi/v1/futures/loan/borrow/history
81
- #
82
- # @param kwargs [Hash]
83
- # @option kwargs [String] :coin
84
- # @option kwargs [Integer] :startTime
85
- # @option kwargs [Integer] :endTime
86
- # @option kwargs [Integer] :limit default 500, max 1000
87
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
88
- # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-borrow-history-user_data
89
- def cross_collateral_borrow_history(**kwargs)
90
- @session.sign_request(:get, '/sapi/v1/futures/loan/borrow/history', params: kwargs)
91
- end
92
-
93
- # Repay For Cross-Collateral (TRADE)
94
- #
95
- # POST /sapi/v1/futures/loan/repay
96
- #
97
- # @param coin [String]
98
- # @param collateralCoin [String]
99
- # @param amount [Float]
100
- # @param kwargs [Hash]
101
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
102
- # @see https://binance-docs.github.io/apidocs/spot/en/#repay-for-cross-collateral-trade
103
- def cross_collateral_repay(coin:, collateralCoin:, amount:, **kwargs)
104
- Binance::Utils::Validation.require_param('coin', coin)
105
- Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
106
- Binance::Utils::Validation.require_param('amount', amount)
107
-
108
- @session.sign_request(:post, '/sapi/v1/futures/loan/repay', params: kwargs.merge(
109
- coin: coin,
110
- collateralCoin: collateralCoin,
111
- amount: amount
112
- ))
113
- end
114
-
115
- # Cross-Collateral Repayment History (USER_DATA)
116
- #
117
- # GET /sapi/v1/futures/loan/repay/history
118
- #
119
- # @param kwargs [Hash]
120
- # @option kwargs [String] :coin
121
- # @option kwargs [Integer] :startTime
122
- # @option kwargs [Integer] :endTime
123
- # @option kwargs [Integer] :limit default 500, max 1000
124
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
125
- # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-repayment-history-user_data
126
- def cross_collateral_repay_history(**kwargs)
127
- @session.sign_request(:get, '/sapi/v1/futures/loan/repay/history', params: kwargs)
128
- end
129
-
130
- # Cross-Collateral Wallet (USER_DATA)
131
- #
132
- # GET /sapi/v2/futures/loan/wallet
133
- #
134
- # @param kwargs [Hash]
135
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
136
- # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-wallet-v2-user_data
137
- def cross_collateral_wallet(**kwargs)
138
- @session.sign_request(:get, '/sapi/v2/futures/loan/wallet', params: kwargs)
139
- end
140
-
141
- # Cross-Collateral Information (USER_DATA)
142
- #
143
- # GET /sapi/v2/futures/loan/configs
144
- #
145
- # @param kwargs [Hash]
146
- # @option kwargs [String] :loanCoin
147
- # @option kwargs [String] :collateralCoin
148
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
149
- # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-information-v2-user_data
150
- def cross_collateral_info(**kwargs)
151
- @session.sign_request(:get, '/sapi/v2/futures/loan/configs', params: kwargs)
152
- end
153
-
154
- # Calculate Rate After Adjust Cross-Collateral LTV (USER_DATA)
155
- #
156
- # GET /sapi/v2/futures/loan/calcAdjustLevel
157
- #
158
- # @param loanCoin [String]
159
- # @param collateralCoin [String]
160
- # @param amount [Float]
161
- # @param direction [String] "ADDITIONAL", "REDUCED"
162
- # @param kwargs [Hash]
163
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
164
- # @see https://binance-docs.github.io/apidocs/spot/en/#calculate-rate-after-adjust-cross-collateral-ltv-v2-user_data
165
- def calculate_adjust_rate(loanCoin:, collateralCoin:, amount:, direction:, **kwargs)
166
- Binance::Utils::Validation.require_param('loanCoin', loanCoin)
167
- Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
168
- Binance::Utils::Validation.require_param('amount', amount)
169
- Binance::Utils::Validation.require_param('direction', direction)
170
-
171
- @session.sign_request(:get, '/sapi/v2/futures/loan/calcAdjustLevel', params: kwargs.merge(
172
- loanCoin: loanCoin,
173
- collateralCoin: collateralCoin,
174
- amount: amount,
175
- direction: direction
176
- ))
177
- end
178
-
179
- # Get Max Amount for Adjust Cross-Collateral LTV (USER_DATA)
180
- #
181
- # GET /sapi/v2/futures/loan/calcMaxAdjustAmount
182
- #
183
- # @param loanCoin [String]
184
- # @param collateralCoin [String]
185
- # @param kwargs [Hash]
186
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
187
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-max-amount-for-adjust-cross-collateral-ltv-v2-user_data
188
- def calculate_adjust_max_amount(loanCoin:, collateralCoin:, **kwargs)
189
- Binance::Utils::Validation.require_param('loanCoin', loanCoin)
190
- Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
191
-
192
- @session.sign_request(:get, '/sapi/v2/futures/loan/calcMaxAdjustAmount', params: kwargs.merge(
193
- loanCoin: loanCoin,
194
- collateralCoin: collateralCoin
195
- ))
196
- end
197
-
198
- # Adjust Cross-Collateral LTV (TRADE)
199
- #
200
- # POST /sapi/v2/futures/loan/adjustCollateral
201
- #
202
- # @param loanCoin [String]
203
- # @param collateralCoin [String]
204
- # @param amount [Float]
205
- # @param direction [String] "ADDITIONAL", "REDUCED"
206
- # @param kwargs [Hash]
207
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
208
- # @see https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-v2-trade
209
- def adjust_cross_collateral(loanCoin:, collateralCoin:, amount:, direction:, **kwargs)
210
- Binance::Utils::Validation.require_param('loanCoin', loanCoin)
211
- Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
212
- Binance::Utils::Validation.require_param('amount', amount)
213
- Binance::Utils::Validation.require_param('direction', direction)
214
-
215
- @session.sign_request(:post, '/sapi/v2/futures/loan/adjustCollateral', params: kwargs.merge(
216
- loanCoin: loanCoin,
217
- collateralCoin: collateralCoin,
218
- amount: amount,
219
- direction: direction
220
- ))
221
- end
222
-
223
- # Adjust Cross-Collateral LTV History (USER_DATA)
224
- #
225
- # GET /sapi/v1/futures/loan/adjustCollateral/history
226
- #
227
- # All data will be returned if loanCoin or collateralCoin is not sent
228
- #
229
- # @param kwargs [Hash]
230
- # @option kwargs [String] :loanCoin
231
- # @option kwargs [String] :collateralCoin
232
- # @option kwargs [Integer] :startTime
233
- # @option kwargs [Integer] :endTime
234
- # @option kwargs [Integer] :limit default 500, max 1000
235
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
236
- # @see https://binance-docs.github.io/apidocs/spot/en/#adjust-cross-collateral-ltv-history-user_data
237
- def adjust_cross_collateral_history(**kwargs)
238
- @session.sign_request(:get, '/sapi/v1/futures/loan/adjustCollateral/history', params: kwargs)
239
- end
240
-
241
- # Cross-Collateral Liquidation History (USER_DATA)
242
- #
243
- # GET /sapi/v1/futures/loan/liquidationHistory
244
- #
245
- # All data will be returned if loanCoin or collateralCoin is not sent
246
- #
247
- # @param kwargs [Hash]
248
- # @option kwargs [String] :loanCoin
249
- # @option kwargs [String] :collateralCoin
250
- # @option kwargs [Integer] :startTime
251
- # @option kwargs [Integer] :endTime
252
- # @option kwargs [Integer] :limit default 500, max 1000
253
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
254
- # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-liquidation-history-user_data
255
- def cross_collateral_liquidation_history(**kwargs)
256
- @session.sign_request(:get, '/sapi/v1/futures/loan/liquidationHistory', params: kwargs)
257
- end
258
-
259
- # Check Collateral Repay Limit (USER_DATA)
260
- #
261
- # GET /sapi/v1/futures/loan/collateralRepayLimit
262
- #
263
- # Check the maximum and minimum limit when repay with collateral.
264
- #
265
- # @param coin [String]
266
- # @param collateralCoin [String]
267
- # @param kwargs [Hash]
268
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
269
- # @see https://binance-docs.github.io/apidocs/spot/en/#check-collateral-repay-limit-user_data
270
- def collateral_repay_limit(coin:, collateralCoin:, **kwargs)
271
- Binance::Utils::Validation.require_param('coin', coin)
272
- Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
273
-
274
- @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepayLimit', params: kwargs.merge(
275
- coin: coin,
276
- collateralCoin: collateralCoin
277
- ))
278
- end
279
-
280
- # Get Collateral Repay Quote (USER_DATA)
281
- #
282
- # GET /sapi/v1/futures/loan/collateralRepay
283
- #
284
- # Get quote before repay with collateral is mandatory, the quote will be valid within 25 seconds.
285
- #
286
- # @param coin [String]
287
- # @param collateralCoin [String]
288
- # @param amount [Float]
289
- # @param kwargs [Hash]
290
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
291
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-collateral-repay-quote-user_data
292
- def collateral_repay_quote(coin:, collateralCoin:, amount:, **kwargs)
293
- Binance::Utils::Validation.require_param('coin', coin)
294
- Binance::Utils::Validation.require_param('collateralCoin', collateralCoin)
295
- Binance::Utils::Validation.require_param('amount', amount)
296
-
297
- @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepay', params: kwargs.merge(
298
- coin: coin,
299
- collateralCoin: collateralCoin,
300
- amount: amount
301
- ))
302
- end
303
-
304
- # Repay with Collateral (USER_DATA)
305
- #
306
- # POST /sapi/v1/futures/loan/collateralRepay
307
- #
308
- # Repay with collateral. Get quote before repay with collateral is mandatory, the quote will be valid within 25 seconds.
309
- #
310
- # @param quoteId [String]
311
- # @param kwargs [Hash]
312
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
313
- # @see https://binance-docs.github.io/apidocs/spot/en/#repay-with-collateral-user_data
314
- def repay_with_collateral(quoteId:, **kwargs)
315
- Binance::Utils::Validation.require_param('quoteId', quoteId)
316
-
317
- @session.sign_request(:post, '/sapi/v1/futures/loan/collateralRepay', params: kwargs.merge(
318
- quoteId: quoteId
319
- ))
320
- end
321
-
322
- # Collateral Repayment Result (USER_DATA)
323
- #
324
- # GET /sapi/v1/futures/loan/collateralRepayResult
325
- #
326
- # Check collateral repayment result.
327
- #
328
- # @param quoteId [String]
329
- # @param kwargs [Hash]
330
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
331
- # @see https://binance-docs.github.io/apidocs/spot/en/#collateral-repayment-result-user_data
332
- def repayment_result(quoteId:, **kwargs)
333
- Binance::Utils::Validation.require_param('quoteId', quoteId)
334
-
335
- @session.sign_request(:get, '/sapi/v1/futures/loan/collateralRepayResult', params: kwargs.merge(
336
- quoteId: quoteId
337
- ))
338
- end
339
-
340
- # Cross-Collateral Interest History (USER_DATA)
341
- #
342
- # GET /sapi/v1/futures/loan/interestHistory
343
- #
344
- # @param kwargs [Hash]
345
- # @option kwargs [String] :collateralCoin
346
- # @option kwargs [Integer] :startTime
347
- # @option kwargs [Integer] :endTime
348
- # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
349
- # @option kwargs [Integer] :limit default 500, max 1000
350
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
351
- # @see https://binance-docs.github.io/apidocs/spot/en/#cross-collateral-interest-history-user_data
352
- def cross_collateral_interest_history(**kwargs)
353
- @session.sign_request(:get, '/sapi/v1/futures/loan/interestHistory', params: kwargs)
354
- end
355
- end
356
- end
357
- end