binance-connector-ruby 1.4.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79de67acd5f3ce04c90bd7af5a1219d351f2475da326c52dd15d31de87a5fc59
4
- data.tar.gz: a6c937781d4becf1574fa0ae75159ef4183c5305ed71886b2a35a46d6f96726e
3
+ metadata.gz: ceca2a0ada80e0c672ab070079bfae98aa60102940466f5437182da8fb59b078
4
+ data.tar.gz: 480f974a34fe4238b1e809ada9a69c540411e1a40856c6553d682be66103e051
5
5
  SHA512:
6
- metadata.gz: 3fe1f8765880b0fb14c08333affda07065579f272b4250b2276544a93e4e4e64cbcdcad5b818903c6ed26b8e1ae932b273c832c337ef6fd45cc26b8a6935b23f
7
- data.tar.gz: '085799a56d01d5568f0a4cc98c709d98cba18b70d4011e512fd1e4460c52b2b408344fc5c5e54f4e11e152ff1d99ca73d80f327d5c2e25f6a236e9aacd68f37f'
6
+ metadata.gz: 5818261799432fd0b513123a174449dd69a47beabf2d1870b26a1aa7cd28824ff8aab7bfb047c24b45af1b49283086d03551edce723187b422d580da33e0eca2
7
+ data.tar.gz: 3b5cd20c16795e465e541ee6b4dec624379014feac1b12471981c5bac15ef773656d0adababc193ccce630d0135551bb283d87491323f48bf198eec8187bcffb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0 - 2024-04-10
4
+
5
+ ### Added
6
+ - Support Ruby 3.2 and 3.3
7
+ - New endpoint for Simple Earn:
8
+ - `GET /sapi/v1/simple-earn/flexible/list` to query available Simple Earn flexible product list
9
+ - `GET /sapi/v1/simple-earn/locked/list` to query available Simple Earn locked product list
10
+ - `POST /sapi/v1/simple-earn/flexible/subscribe` to subscribe to a flexible product
11
+ - `POST /sapi/v1/simple-earn/locked/subscribe` to subscribe to a locked product
12
+ - `POST /sapi/v1/simple-earn/flexible/redeem` to redeem a flexible product
13
+ - `POST /sapi/v1/simple-earn/locked/redeem` to redeem a locked product
14
+ - `GET /sapi/v1/simple-earn/flexible/position` to get a flexible product position
15
+ - `GET /sapi/v1/simple-earn/locked/position` to get a locked product position
16
+ - `GET /sapi/v1/simple-earn/account` to get a simple account balances
17
+ - `GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord` to get flexible subscription records
18
+ - `GET /sapi/v1/simple-earn/locked/history/subscriptionRecord` to get locked subscription records
19
+ - `GET /sapi/v1/simple-earn/flexible/history/redemptionRecord` to retrieve flexible redemption records
20
+ - `GET /sapi/v1/simple-earn/locked/history/redemptionRecord` to retrieve locked redemption records
21
+ - `GET /sapi/v1/simple-earn/flexible/history/rewardsRecord` to get flexible rewards history
22
+ - `GET /sapi/v1/simple-earn/locked/history/rewardsRecord` to get locked rewards history
23
+ - `POST /sapi/v1/simple-earn/flexible/setAutoSubscribe` to set an auto-subscription to a flexible product
24
+ - `POST /sapi/v1/simple-earn/locked/setAutoSubscribe` to set an auto-subscription to a locked product
25
+ - `GET /sapi/v1/simple-earn/flexible/personalLeftQuota` to get flexible personal left quota
26
+ - `GET /sapi/v1/simple-earn/locked/personalLeftQuota` to get locked personal left quota
27
+ - `GET /sapi/v1/simple-earn/flexible/subscriptionPreview` to get flexible subscription preview
28
+ - `GET /sapi/v1/simple-earn/locked/subscriptionPreview` to get locked subscription previews
29
+ - `GET /sapi/v1/simple-earn/flexible/history/rateHistory` to get a rate history
30
+ - `GET /sapi/v1/simple-earn/flexible/history/collateralRecord` to get collateral records
31
+
32
+ ### Changed
33
+ - Update dependencies
34
+ - Drop support of Ruby 2.6 and 2.7
35
+
36
+ ### Removed
37
+ - Deprecated Savings endpoints:
38
+ - `GET /sapi/v1/lending/daily/product/list`
39
+ - `GET /sapi/v1/lending/daily/userLeftQuota`
40
+ - `POST /sapi/v1/lending/daily/purchase`
41
+ - `GET /sapi/v1/lending/daily/userRedemptionQuota`
42
+ - `POST /sapi/v1/lending/daily/redeem`
43
+ - `GET /sapi/v1/lending/daily/token/position`
44
+ - `GET /sapi/v1/lending/project/list`
45
+ - `POST /sapi/v1/lending/customizedFixed/purchase`
46
+ - `GET /sapi/v1/lending/union/account`
47
+ - `GET /sapi/v1/lending/union/purchaseRecord`
48
+ - `GET /sapi/v1/lending/union/redemptionRecord`
49
+ - `GET /sapi/v1/lending/union/interestHistory`
50
+ - `GET /sapi/v1/lending/project/position/list`
51
+ - `POST /sapi/v1/lending/positionChanged`
52
+
53
+ - Deprecated Staking endpoints:
54
+ - `GET /sapi/v1/staking/productList`
55
+ - `POST /sapi/v1/staking/purchase`
56
+ - `POST /sapi/v1/staking/redeem`
57
+ - `GET /sapi/v1/staking/position`
58
+ - `GET /sapi/v1/staking/stakingRecord`
59
+ - `POST /sapi/v1/staking/setAutoStaking`
60
+ - `GET /sapi/v1/staking/personalLeftQuota`
61
+
62
+ - Deprecated BSwap endpoints:
63
+ - `GET /sapi/v1/bswap/pools`
64
+ - `GET /sapi/v1/bswap/liquidity`
65
+ - `POST /sapi/v1/bswap/liquidityAdd`
66
+ - `POST /sapi/v1/bswap/liquidityRemove`
67
+ - `GET /sapi/v1/bswap/liquidityOps`
68
+ - `GET /sapi/v1/bswap/quote`
69
+ - `POST /sapi/v1/bswap/swap`
70
+ - `GET /sapi/v1/bswap/swap`
71
+ - `GET /sapi/v1/bswap/poolConfigure`
72
+ - `GET /sapi/v1/bswap/addLiquidityPreview`
73
+ - `GET /sapi/v1/bswap/removeLiquidityPreview`
74
+
3
75
  ## 1.4.0 - 2022-12-20
4
76
  ### Added
5
77
  - Add RSA signature
data/lib/binance/error.rb CHANGED
@@ -21,7 +21,7 @@ module Binance
21
21
  class RequiredParameterError < Error
22
22
  def initialize(param_name, param_value)
23
23
  super(
24
- "ValidationFailed: #{param_name} is required, but provided value: #{param_value}"
24
+ "ValidationFailed: #{param_name} is required, but provided value: #{param_value}"
25
25
  )
26
26
  end
27
27
  end
@@ -0,0 +1,403 @@
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 SimpleEarn
8
+ # Get Simple Earn Flexible Product List (USER_DATA)
9
+ #
10
+ # GET /sapi/v1/simple-earn/flexible/list
11
+ #
12
+ # @param kwargs [Hash]
13
+ # @option kwargs [String] :asset
14
+ # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
15
+ # @option kwargs [Integer] :size Default:10, Max:100
16
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
17
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-flexible-product-list-user_data
18
+ def flexible_product_list(**kwargs)
19
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/list', params: kwargs)
20
+ end
21
+
22
+ # Get Simple Earn Locked Product List (USER_DATA)
23
+ #
24
+ # GET /sapi/v1/simple-earn/locked/list
25
+ #
26
+ # @param kwargs [Hash]
27
+ # @option kwargs [String] :asset
28
+ # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
29
+ # @option kwargs [Integer] :size Default:10, Max:100
30
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
31
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-simple-earn-locked-product-list-user_data
32
+ def locked_product_list(**kwargs)
33
+ @session.sign_request(:get, '/sapi/v1/simple-earn/locked/list', params: kwargs)
34
+ end
35
+
36
+ # Subscribe Flexible Product (TRADE)
37
+ #
38
+ # POST /sapi/v1/simple-earn/flexible/subscribe
39
+ #
40
+ # @param productId [String]
41
+ # @param amount [Float]
42
+ # @param kwargs [Hash]
43
+ # @option kwargs [Boolean] :autoSubscribe true or false, default true
44
+ # @option kwargs [String] :sourceAccount SPOT,FUND,ALL, default SPOT
45
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
46
+ # @see https://binance-docs.github.io/apidocs/spot/en/#subscribe-flexible-product-trade
47
+ def flexible_subscribe(productId:, amount:, **kwargs)
48
+ Binance::Utils::Validation.require_param('productId', productId)
49
+ Binance::Utils::Validation.require_param('amount', amount)
50
+
51
+ @session.sign_request(:post, '/sapi/v1/simple-earn/flexible/subscribe', params: kwargs.merge(
52
+ productId: productId,
53
+ amount: amount
54
+ ))
55
+ end
56
+
57
+ # Subscribe Locked Product (TRADE)
58
+ #
59
+ # POST /sapi/v1/simple-earn/locked/subscribe
60
+ #
61
+ # @param projectId [String]
62
+ # @param amount [Float]
63
+ # @param kwargs [Hash]
64
+ # @option kwargs [Boolean] :autoSubscribe true or false, default true
65
+ # @option kwargs [String] :sourceAccount SPOT,FUND,ALL, default SPOT
66
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
67
+ # @see https://binance-docs.github.io/apidocs/spot/en/#subscribe-locked-product-trade
68
+ def locked_subscribe(projectId:, amount:, **kwargs)
69
+ Binance::Utils::Validation.require_param('projectId', projectId)
70
+ Binance::Utils::Validation.require_param('amount', amount)
71
+
72
+ @session.sign_request(:post, '/sapi/v1/simple-earn/locked/subscribe', params: kwargs.merge(
73
+ projectId: projectId,
74
+ amount: amount
75
+ ))
76
+ end
77
+
78
+ # Redeem Flexible Product (TRADE)
79
+ #
80
+ # POST /sapi/v1/simple-earn/flexible/redeem
81
+ #
82
+ # @param productId [String]
83
+ # @param kwargs [Hash]
84
+ # @option kwargs [Boolean] :redeemAll true or false, default true
85
+ # @option kwargs [Float] :amount if redeemAll is false, amount is mandatory
86
+ # @option kwargs [String] :destAccount SPOT,FUND,ALL, default SPOT
87
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
88
+ # @see https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-trade
89
+ def flexible_redeem_product(productId:, **kwargs)
90
+ Binance::Utils::Validation.require_param('productId', productId)
91
+
92
+ @session.sign_request(:post, '/sapi/v1/simple-earn/flexible/redeem', params: kwargs.merge(
93
+ productId: productId
94
+ ))
95
+ end
96
+
97
+ # Redeem Locked Product (TRADE)
98
+ #
99
+ # POST /sapi/v1/simple-earn/locked/redeem
100
+ #
101
+ # @param positionId [String]
102
+ # @param kwargs [Hash]
103
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
104
+ # @see https://binance-docs.github.io/apidocs/spot/en/#redeem-locked-product-trade
105
+ def locked_redeem_product(positionId:, **kwargs)
106
+ Binance::Utils::Validation.require_param('positionId', positionId)
107
+
108
+ @session.sign_request(:post, '/sapi/v1/simple-earn/locked/redeem', params: kwargs.merge(
109
+ positionId: positionId
110
+ ))
111
+ end
112
+
113
+ # Get Flexible Product Position (USER_DATA)
114
+ #
115
+ # GET /sapi/v1/simple-earn/flexible/position
116
+ #
117
+ # @param kwargs [Hash]
118
+ # @option kwargs [String] :asset
119
+ # @option kwargs [String] :productId
120
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
121
+ # @option kwargs [Integer] :size Default:10, Max:100
122
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
123
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data
124
+ def flexible_product_position(**kwargs)
125
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/position', params: kwargs)
126
+ end
127
+
128
+ # Get Locked Product Position (USER_DATA)
129
+ #
130
+ # GET /sapi/v1/simple-earn/locked/position
131
+ #
132
+ # @param kwargs [Hash]
133
+ # @option kwargs [String] :asset
134
+ # @option kwargs [String] :positionId
135
+ # @option kwargs [String] :projectId
136
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
137
+ # @option kwargs [Integer] :size Default:10, Max:100
138
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
139
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-product-position-user_data
140
+ def locked_product_position(**kwargs)
141
+ @session.sign_request(:get, '/sapi/v1/simple-earn/locked/position', params: kwargs)
142
+ end
143
+
144
+ # Simple Account(USER_DATA)
145
+ #
146
+ # GET /sapi/v1/simple-earn/account'
147
+ #
148
+ # @param kwargs [Hash]
149
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
150
+ # @see https://binance-docs.github.io/apidocs/spot/en/#simple-account-user_data
151
+ def simple_earn_account(**kwargs)
152
+ @session.sign_request(:get, '/sapi/v1/simple-earn/account', params: kwargs)
153
+ end
154
+
155
+ # Get Flexible Subscription Record (USER_DATA)
156
+ #
157
+ # GET /sapi/v1/simple-earn/flexible/history/subscriptionRecord
158
+ #
159
+ # @param kwargs [Hash]
160
+ # @option kwargs [String] :productId
161
+ # @option kwargs [String] :purchaseId
162
+ # @option kwargs [String] :asset
163
+ # @option kwargs [Integer] :startTime
164
+ # @option kwargs [Integer] :endTime
165
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
166
+ # @option kwargs [Integer] :size Default:10, Max:100
167
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
168
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-subscription-record-user_data
169
+ def flexible_subscription_record(**kwargs)
170
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/subscriptionRecord', params: kwargs)
171
+ end
172
+
173
+ # Get Locked Subscription Record (USER_DATA)
174
+ #
175
+ # GET /sapi/v1/simple-earn/locked/history/subscriptionRecord
176
+ #
177
+ # @param kwargs [Hash]
178
+ # @option kwargs [String] :purchaseId
179
+ # @option kwargs [String] :asset
180
+ # @option kwargs [Integer] :startTime
181
+ # @option kwargs [Integer] :endTime
182
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
183
+ # @option kwargs [Integer] :size Default:10, Max:100
184
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
185
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-subscription-record-user_data
186
+ def locked_subscription_record(**kwargs)
187
+ @session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/subscriptionRecord', params: kwargs)
188
+ end
189
+
190
+ # Get Flexible Redemption Record (USER_DATA)
191
+ #
192
+ # GET /sapi/v1/simple-earn/flexible/history/redemptionRecord
193
+ #
194
+ # @param kwargs [Hash]
195
+ # @option kwargs [String] :productId
196
+ # @option kwargs [String] :redeemId
197
+ # @option kwargs [String] :asset
198
+ # @option kwargs [Integer] :startTime
199
+ # @option kwargs [Integer] :endTime
200
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
201
+ # @option kwargs [Integer] :size Default:10, Max:100
202
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
203
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-redemption-record-user_data
204
+ def flexible_redemption_record(**kwargs)
205
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/redemptionRecord', params: kwargs)
206
+ end
207
+
208
+ # Get Locked Redemption Record (USER_DATA)
209
+ #
210
+ # GET /sapi/v1/simple-earn/locked/history/redemptionRecord
211
+ #
212
+ # @param kwargs [Hash]
213
+ # @option kwargs [String] :positionId
214
+ # @option kwargs [String] :redeemId
215
+ # @option kwargs [String] :asset
216
+ # @option kwargs [Integer] :startTime
217
+ # @option kwargs [Integer] :endTime
218
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
219
+ # @option kwargs [Integer] :size Default:10, Max:100
220
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
221
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-redemption-record-user_data
222
+ def locked_redemption_record(**kwargs)
223
+ @session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/redemptionRecord', params: kwargs)
224
+ end
225
+
226
+ # Get Flexible Rewards History (USER_DATA)
227
+ #
228
+ # GET /sapi/v1/simple-earn/flexible/history/rewardsRecord
229
+ #
230
+ # @param type [String] BONUS - Bonus tiered APR, REALTIME Real-time APR, REWARDS Historical rewards
231
+ # @param kwargs [Hash]
232
+ # @option kwargs [String] :productId
233
+ # @option kwargs [String] :asset
234
+ # @option kwargs [Integer] :startTime
235
+ # @option kwargs [Integer] :endTime
236
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
237
+ # @option kwargs [Integer] :size Default:10, Max:100
238
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
239
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-rewards-history-user_data
240
+ def flexible_rewards_history(type:, **kwargs)
241
+ Binance::Utils::Validation.require_param('type', type)
242
+
243
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/rewardsRecord', params: kwargs.merge(type: type))
244
+ end
245
+
246
+ # Get Locked Rewards History (USER_DATA)
247
+ #
248
+ # GET /sapi/v1/simple-earn/locked/history/rewardsRecord
249
+ #
250
+ # @param kwargs [Hash]
251
+ # @option kwargs [String] :positionId
252
+ # @option kwargs [String] :asset
253
+ # @option kwargs [Integer] :startTime
254
+ # @option kwargs [Integer] :endTime
255
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
256
+ # @option kwargs [Integer] :size Default:10, Max:100
257
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
258
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-rewards-history-user_data
259
+ def locked_rewards_history(**kwargs)
260
+ @session.sign_request(:get, '/sapi/v1/simple-earn/locked/history/rewardsRecord', params: kwargs)
261
+ end
262
+
263
+ # Set Flexible Auto Subscribe (USER_DATA)
264
+ #
265
+ # POST /sapi/v1/simple-earn/flexible/setAutoSubscribe
266
+ #
267
+ # @param productId [String]
268
+ # @param autoSubscribe [Boolean] true or false
269
+ # @param kwargs [Hash]
270
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
271
+ # @see https://binance-docs.github.io/apidocs/spot/en/#set-flexible-auto-subscribe-user_data
272
+ def flexible_auto_subscribe(productId:, autoSubscribe:, **kwargs)
273
+ Binance::Utils::Validation.require_param('productId', productId)
274
+ Binance::Utils::Validation.require_param('autoSubscribe', autoSubscribe)
275
+
276
+ @session.sign_request(:post, '/sapi/v1/simple-earn/flexible/setAutoSubscribe', params: kwargs.merge(
277
+ productId: productId,
278
+ autoSubscribe: autoSubscribe
279
+ ))
280
+ end
281
+
282
+ # Set Locked Auto Subscribe (USER_DATA)
283
+ #
284
+ # POST /sapi/v1/simple-earn/locked/setAutoSubscribe
285
+ #
286
+ # @param positionId [String]
287
+ # @param autoSubscribe [Boolean] true or false
288
+ # @param kwargs [Hash]
289
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
290
+ # @see https://binance-docs.github.io/apidocs/spot/en/#set-locked-auto-subscribe-user_data
291
+ def locked_auto_subscribe(positionId:, autoSubscribe:, **kwargs)
292
+ Binance::Utils::Validation.require_param('positionId', positionId)
293
+ Binance::Utils::Validation.require_param('autoSubscribe', autoSubscribe)
294
+
295
+ @session.sign_request(:post, '/sapi/v1/simple-earn/locked/setAutoSubscribe', params: kwargs.merge(
296
+ positionId: positionId,
297
+ autoSubscribe: autoSubscribe
298
+ ))
299
+ end
300
+
301
+ # Get Flexible Personal Left Quota (USER_DATA)
302
+ #
303
+ # GET /sapi/v1/simple-earn/flexible/personalLeftQuota
304
+ #
305
+ # @param productId [String]
306
+ # @param kwargs [Hash]
307
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
308
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-personal-left-quota-user_data
309
+ def flexible_personal_left_quota(productId:, **kwargs)
310
+ Binance::Utils::Validation.require_param('productId', productId)
311
+
312
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/personalLeftQuota', params: kwargs.merge(productId: productId))
313
+ end
314
+
315
+ # Get Locked Personal Left Quota (USER_DATA)
316
+ #
317
+ # GET /sapi/v1/simple-earn/locked/personalLeftQuota
318
+ #
319
+ # @param projectId [String]
320
+ # @param kwargs [Hash]
321
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
322
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-personal-left-quota-user_data
323
+ def locked_personal_left_quota(projectId:, **kwargs)
324
+ Binance::Utils::Validation.require_param('projectId', projectId)
325
+
326
+ @session.sign_request(:get, '/sapi/v1/simple-earn/locked/personalLeftQuota', params: kwargs.merge(projectId: projectId))
327
+ end
328
+
329
+ # Get Flexible Subscription Preview (USER_DATA)
330
+ #
331
+ # GET /sapi/v1/simple-earn/flexible/subscriptionPreview
332
+ #
333
+ # @param productId [String]
334
+ # @param amount [Float]
335
+ # @param kwargs [Hash]
336
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
337
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-subscription-preview-user_data
338
+ def flexible_subscription_preview(productId:, amount:, **kwargs)
339
+ Binance::Utils::Validation.require_param('productId', productId)
340
+ Binance::Utils::Validation.require_param('amount', amount)
341
+
342
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/subscriptionPreview', params: kwargs.merge(
343
+ productId: productId,
344
+ amount: amount
345
+ ))
346
+ end
347
+
348
+ # Get Locked Subscription Preview (USER_DATA)
349
+ #
350
+ # GET /sapi/v1/simple-earn/locked/subscriptionPreview
351
+ #
352
+ # @param projectId [String]
353
+ # @param amount [Float]
354
+ # @param kwargs [Hash]
355
+ # @option kwargs [Boolean] :autoSubscribe true or false, default true
356
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
357
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-locked-subscription-preview-user_data
358
+ def locked_subscription_preview(projectId:, amount:, **kwargs)
359
+ Binance::Utils::Validation.require_param('projectId', projectId)
360
+ Binance::Utils::Validation.require_param('amount', amount)
361
+
362
+ @session.sign_request(:get, '/sapi/v1/simple-earn/locked/subscriptionPreview', params: kwargs.merge(
363
+ projectId: projectId,
364
+ amount: amount
365
+ ))
366
+ end
367
+
368
+ # Get Rate History (USER_DATA)
369
+ #
370
+ # GET /sapi/v1/simple-earn/flexible/history/rateHistory
371
+ #
372
+ # @param productId [String]
373
+ # @param kwargs [Hash]
374
+ # @option kwargs [Integer] :startTime
375
+ # @option kwargs [Integer] :endTime
376
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
377
+ # @option kwargs [Integer] :size Default:10, Max:100
378
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
379
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-rate-history-user_data
380
+ def rate_history(productId:, **kwargs)
381
+ Binance::Utils::Validation.require_param('productId', productId)
382
+
383
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/rateHistory', params: kwargs.merge(productId: productId))
384
+ end
385
+
386
+ # Get Collateral Record (USER_DATA)
387
+ #
388
+ # GET /sapi/v1/simple-earn/flexible/history/collateralRecord
389
+ #
390
+ # @param kwargs [Hash]
391
+ # @option kwargs [String] :productId
392
+ # @option kwargs [Integer] :startTime
393
+ # @option kwargs [Integer] :endTime
394
+ # @option kwargs [Integer] :current Currently querying the page. Start from 1. Default:1
395
+ # @option kwargs [Integer] :size Default:10, Max:100
396
+ # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
397
+ # @see https://binance-docs.github.io/apidocs/spot/en/#get-collateral-record-user_data
398
+ def collateral_record(**kwargs)
399
+ @session.sign_request(:get, '/sapi/v1/simple-earn/flexible/history/collateralRecord', params: kwargs)
400
+ end
401
+ end
402
+ end
403
+ end
data/lib/binance/spot.rb CHANGED
@@ -6,7 +6,6 @@ require 'binance/utils/validation'
6
6
  require 'binance/utils/url'
7
7
  require 'binance/error'
8
8
  require 'binance/spot/blvt'
9
- require 'binance/spot/bswap'
10
9
  require 'binance/spot/c2c'
11
10
  require 'binance/spot/convert'
12
11
  require 'binance/spot/fiat'
@@ -15,8 +14,7 @@ require 'binance/spot/loan'
15
14
  require 'binance/spot/margin'
16
15
  require 'binance/spot/market'
17
16
  require 'binance/spot/mining'
18
- require 'binance/spot/savings'
19
- require 'binance/spot/staking'
17
+ require 'binance/spot/simple_earn'
20
18
  require 'binance/spot/stream'
21
19
  require 'binance/spot/subaccount'
22
20
  require 'binance/spot/trade'
@@ -26,7 +24,6 @@ require 'binance/spot/websocket'
26
24
  module Binance
27
25
  # Spot class includes the following modules:
28
26
  # - Blvt
29
- # - Bswap
30
27
  # - C2C
31
28
  # - Convert
32
29
  # - Fiat
@@ -35,7 +32,7 @@ module Binance
35
32
  # - Margin
36
33
  # - Market
37
34
  # - Mining
38
- # - Saving
35
+ # - SimpleEarn
39
36
  # - Stream
40
37
  # - Subaccount
41
38
  # - Trade
@@ -43,7 +40,6 @@ module Binance
43
40
  # @see https://binance-docs.github.io/apidocs/spot/en/
44
41
  class Spot
45
42
  include Binance::Spot::Blvt
46
- include Binance::Spot::Bswap
47
43
  include Binance::Spot::C2C
48
44
  include Binance::Spot::Convert
49
45
  include Binance::Spot::Fiat
@@ -52,8 +48,7 @@ module Binance
52
48
  include Binance::Spot::Margin
53
49
  include Binance::Spot::Market
54
50
  include Binance::Spot::Mining
55
- include Binance::Spot::Savings
56
- include Binance::Spot::Staking
51
+ include Binance::Spot::SimpleEarn
57
52
  include Binance::Spot::Stream
58
53
  include Binance::Spot::Subaccount
59
54
  include Binance::Spot::Trade
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Binance
4
- VERSION = '1.4.0'
4
+ VERSION = '1.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binance-connector-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Binance
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-20 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,7 +109,6 @@ files:
109
109
  - lib/binance/session.rb
110
110
  - lib/binance/spot.rb
111
111
  - lib/binance/spot/blvt.rb
112
- - lib/binance/spot/bswap.rb
113
112
  - lib/binance/spot/c2c.rb
114
113
  - lib/binance/spot/convert.rb
115
114
  - lib/binance/spot/fiat.rb
@@ -118,8 +117,7 @@ files:
118
117
  - lib/binance/spot/margin.rb
119
118
  - lib/binance/spot/market.rb
120
119
  - lib/binance/spot/mining.rb
121
- - lib/binance/spot/savings.rb
122
- - lib/binance/spot/staking.rb
120
+ - lib/binance/spot/simple_earn.rb
123
121
  - lib/binance/spot/stream.rb
124
122
  - lib/binance/spot/subaccount.rb
125
123
  - lib/binance/spot/trade.rb
@@ -1,217 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Binance
4
- class Spot
5
- # Bswap endpoints
6
- # @see https://binance-docs.github.io/apidocs/spot/en/#bswap-endpoints
7
- module Bswap
8
- # List All Swap Pools (MARKET_DATA)
9
- #
10
- # GET /sapi/v1/bswap/pools
11
- #
12
- # @see https://binance-docs.github.io/apidocs/spot/en/#list-all-swap-pools-market_data
13
- def swap_pools
14
- @session.limit_request(path: '/sapi/v1/bswap/pools')
15
- end
16
-
17
- # Get liquidity information of a pool (USER_DATA)
18
- #
19
- # GET /sapi/v1/bswap/liquidity
20
- #
21
- # @param kwargs [Hash]
22
- # @option kwargs [Integer] :poolId
23
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
24
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-liquidity-information-of-a-pool-user_data
25
- def get_liquidity_info(**kwargs)
26
- @session.sign_request(:get, '/sapi/v1/bswap/liquidity', params: kwargs)
27
- end
28
-
29
- # Add Liquidity (TRADE)
30
- #
31
- # POST /sapi/v1/bswap/liquidityAdd
32
- #
33
- # @param poolId [Integer]
34
- # @param asset [String]
35
- # @param quantity [Float]
36
- # @param kwargs [Hash]
37
- # @option kwargs [String] :type "Single" to add a single token; "Combination" to add dual tokens. Default "Single"
38
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
39
- # @see https://binance-docs.github.io/apidocs/spot/en/#add-liquidity-trade
40
- def add_liquidity(poolId:, asset:, quantity:, **kwargs)
41
- Binance::Utils::Validation.require_param('poolId', poolId)
42
- Binance::Utils::Validation.require_param('asset', asset)
43
- Binance::Utils::Validation.require_param('quantity', quantity)
44
-
45
- @session.sign_request(:post, '/sapi/v1/bswap/liquidityAdd', params: kwargs.merge(
46
- poolId: poolId,
47
- asset: asset,
48
- quantity: quantity
49
- ))
50
- end
51
-
52
- # Remove Liquidity (TRADE)
53
- #
54
- # POST /sapi/v1/bswap/liquidityRemove
55
- #
56
- # @param poolId [Integer]
57
- # @param type [String] SINGLE for single asset removal, COMBINATION for combination of all coins removal
58
- # @param shareAmount [Float]
59
- # @param kwargs [Hash]
60
- # @option kwargs [String Array] :asset Mandatory for single asset removal
61
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
62
- # @see https://binance-docs.github.io/apidocs/spot/en/#remove-liquidity-trade
63
- def remove_liquidity(poolId:, type:, shareAmount:, **kwargs)
64
- Binance::Utils::Validation.require_param('poolId', poolId)
65
- Binance::Utils::Validation.require_param('type', type)
66
- Binance::Utils::Validation.require_param('shareAmount', shareAmount)
67
-
68
- @session.sign_request(:post, '/sapi/v1/bswap/liquidityRemove', params: kwargs.merge(
69
- poolId: poolId,
70
- type: type,
71
- shareAmount: shareAmount
72
- ))
73
- end
74
-
75
- # Get Liquidity Operation Record (USER_DATA)
76
- #
77
- # GET /sapi/v1/bswap/liquidityOps
78
- #
79
- # @param kwargs [Hash]
80
- # @option kwargs [Integer] :operationId
81
- # @option kwargs [Integer] :poolId
82
- # @option kwargs [String] :operation ADD or REMOVE
83
- # @option kwargs [Integer] :startTime
84
- # @option kwargs [Integer] :endTime
85
- # @option kwargs [Integer] :limit default 3, max 100
86
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
87
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-liquidity-operation-record-user_data
88
- def get_liquidity_operation_record(**kwargs)
89
- @session.sign_request(:get, '/sapi/v1/bswap/liquidityOps', params: kwargs)
90
- end
91
-
92
- # Request Quote (USER_DATA)
93
- #
94
- # GET /sapi/v1/bswap/quote
95
- #
96
- # @param quoteAsset [String]
97
- # @param baseAsset [String]
98
- # @param quoteQty [Float]
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/#request-quote-user_data
102
- def request_quote(quoteAsset:, baseAsset:, quoteQty:, **kwargs)
103
- Binance::Utils::Validation.require_param('quoteAsset', quoteAsset)
104
- Binance::Utils::Validation.require_param('baseAsset', baseAsset)
105
- Binance::Utils::Validation.require_param('quoteQty', quoteQty)
106
-
107
- @session.sign_request(:get, '/sapi/v1/bswap/quote', params: kwargs.merge(
108
- quoteAsset: quoteAsset,
109
- baseAsset: baseAsset,
110
- quoteQty: quoteQty
111
- ))
112
- end
113
-
114
- # Swap (TRADE)
115
- #
116
- # POST /sapi/v1/bswap/swap
117
- #
118
- # @param quoteAsset [String]
119
- # @param baseAsset [String]
120
- # @param quoteQty [Float]
121
- # @param [Hash] kwargs
122
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
123
- # @see https://binance-docs.github.io/apidocs/spot/en/#swap-trade
124
- def swap(quoteAsset:, baseAsset:, quoteQty:, **kwargs)
125
- Binance::Utils::Validation.require_param('quoteAsset', quoteAsset)
126
- Binance::Utils::Validation.require_param('baseAsset', baseAsset)
127
- Binance::Utils::Validation.require_param('quoteQty', quoteQty)
128
-
129
- @session.sign_request(:post, '/sapi/v1/bswap/swap', params: kwargs.merge(
130
- quoteAsset: quoteAsset,
131
- baseAsset: baseAsset,
132
- quoteQty: quoteQty
133
- ))
134
- end
135
-
136
- # Get Swap History (USER_DATA)
137
- #
138
- # GET /sapi/v1/bswap/swap
139
- #
140
- # @param kwargs [Hash]
141
- # @option kwargs [Integer] :swapId
142
- # @option kwargs [Integer] :startTime
143
- # @option kwargs [Integer] :endTime
144
- # @option kwargs [Integer] :status 0: pending for swap, 1: success, 2: failed
145
- # @option kwargs [String] :quoteAsset
146
- # @option kwargs [String] :baseAsset
147
- # @option kwargs [Integer] :limit
148
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
149
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-swap-history-user_data
150
- def get_swap_history(**kwargs)
151
- @session.sign_request(:get, '/sapi/v1/bswap/swap', params: kwargs)
152
- end
153
-
154
- # Get Pool Configure (USER_DATA)
155
- #
156
- # GET /sapi/v1/bswap/poolConfigure
157
- #
158
- # @param kwargs [Hash]
159
- # @option kwargs [Integer] :poolId
160
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
161
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-pool-configure-user_data
162
- def get_pool_config(**kwargs)
163
- @session.sign_request(:get, '/sapi/v1/bswap/poolConfigure', params: kwargs)
164
- end
165
-
166
- # Add Liquidity Preview (USER_DATA)
167
- #
168
- # GET /sapi/v1/bswap/addLiquidityPreview
169
- #
170
- # @param poolId [Integer]
171
- # @param type [String] "SINGLE" for adding a single token; "COMBINATION" for adding dual tokens
172
- # @param quoteAsset [String]
173
- # @param quoteQty [Float]
174
- # @param [Hash] kwargs
175
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
176
- # @see https://binance-docs.github.io/apidocs/spot/en/#add-liquidity-preview-user_data
177
- def add_liquidity_preview(poolId:, type:, quoteAsset:, quoteQty:, **kwargs)
178
- Binance::Utils::Validation.require_param('poolId', poolId)
179
- Binance::Utils::Validation.require_param('type', type)
180
- Binance::Utils::Validation.require_param('quoteAsset', quoteAsset)
181
- Binance::Utils::Validation.require_param('quoteQty', quoteQty)
182
-
183
- @session.sign_request(:get, '/sapi/v1/bswap/addLiquidityPreview', params: kwargs.merge(
184
- poolId: poolId,
185
- type: type,
186
- quoteAsset: quoteAsset,
187
- quoteQty: quoteQty
188
- ))
189
- end
190
-
191
- # Remove Liquidity Preview (USER_DATA)
192
- #
193
- # GET /sapi/v1/bswap/removeLiquidityPreview
194
- #
195
- # @param poolId [Integer]
196
- # @param type [String] "SINGLE" for removing a single token; "COMBINATION" for removing dual tokens
197
- # @param quoteAsset [String]
198
- # @param shareAmount [Float]
199
- # @param [Hash] kwargs
200
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
201
- # @see https://binance-docs.github.io/apidocs/spot/en/#remove-liquidity-preview-user_data
202
- def remove_liquidity_preview(poolId:, type:, quoteAsset:, shareAmount:, **kwargs)
203
- Binance::Utils::Validation.require_param('poolId', poolId)
204
- Binance::Utils::Validation.require_param('type', type)
205
- Binance::Utils::Validation.require_param('quoteAsset', quoteAsset)
206
- Binance::Utils::Validation.require_param('shareAmount', shareAmount)
207
-
208
- @session.sign_request(:get, '/sapi/v1/bswap/removeLiquidityPreview', params: kwargs.merge(
209
- poolId: poolId,
210
- type: type,
211
- quoteAsset: quoteAsset,
212
- shareAmount: shareAmount
213
- ))
214
- end
215
- end
216
- end
217
- end
@@ -1,269 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Binance
4
- class Spot
5
- # all savings endpoints
6
- # @see https://binance-docs.github.io/apidocs/spot/en/#savings-endpoints
7
- module Savings
8
- # Get Flexible Product List (USER_DATA)
9
- #
10
- # GET /sapi/v1/lending/daily/product/list
11
- #
12
- # @param kwargs [Hash]
13
- # @option kwargs [String] :status "ALL", "SUBSCRIBABLE", "UNSUBSCRIBABLE"; Default: "ALL"
14
- # @option kwargs [String] :featured "ALL", "TRUE"; Default: "ALL"
15
- # @option kwargs [Integer] :current Current query page. Default: 1, Min: 1
16
- # @option kwargs [Integer] :size Default: 50, Max: 100
17
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
18
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-list-user_data
19
- def savings_flexible_products(**kwargs)
20
- @session.sign_request(:get, '/sapi/v1/lending/daily/product/list', params: kwargs)
21
- end
22
-
23
- # Get Left Daily Purchase Quota of Flexible Product (USER_DATA)
24
- #
25
- # GET /sapi/v1/lending/daily/userLeftQuota
26
- #
27
- # @param productId [String]
28
- # @param kwargs [Hash]
29
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
30
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-left-daily-purchase-quota-of-flexible-product-user_data
31
- def savings_flexible_user_left_quota(productId:, **kwargs)
32
- Binance::Utils::Validation.require_param('productId', productId)
33
-
34
- @session.sign_request(:get, '/sapi/v1/lending/daily/userLeftQuota', params: kwargs.merge(
35
- productId: productId
36
- ))
37
- end
38
-
39
- # Purchase Flexible Product (USER_DATA)
40
- #
41
- # POST /sapi/v1/lending/daily/purchase
42
- #
43
- # @param productId [String]
44
- # @param amount [Float]
45
- # @param kwargs [Hash]
46
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
47
- # @see https://binance-docs.github.io/apidocs/spot/en/#purchase-flexible-product-user_data
48
- def savings_purchase_flexible_product(productId:, amount:, **kwargs)
49
- Binance::Utils::Validation.require_param('productId', productId)
50
- Binance::Utils::Validation.require_param('amount', amount)
51
-
52
- @session.sign_request(:post, '/sapi/v1/lending/daily/purchase', params: kwargs.merge(
53
- productId: productId,
54
- amount: amount
55
- ))
56
- end
57
-
58
- # Get Left Daily Redemption Quota of Flexible Product (USER_DATA)
59
- #
60
- # GET /sapi/v1/lending/daily/userRedemptionQuota
61
- #
62
- # @param productId [String]
63
- # @param type [String] "FAST", "NORMAL"
64
- # @param kwargs [Hash]
65
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
66
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-left-daily-redemption-quota-of-flexible-product-user_data
67
- def savings_flexible_user_redemption_quota(productId:, type:, **kwargs)
68
- Binance::Utils::Validation.require_param('productId', productId)
69
- Binance::Utils::Validation.require_param('type', type)
70
-
71
- @session.sign_request(:get, '/sapi/v1/lending/daily/userRedemptionQuota', params: kwargs.merge(
72
- productId: productId,
73
- type: type
74
- ))
75
- end
76
-
77
- # Redeem Flexible Product (USER_DATA)
78
- #
79
- # POST /sapi/v1/lending/daily/redeem
80
- #
81
- # @param productId [String]
82
- # @param amount [Float]]
83
- # @param type [String]
84
- # @param kwargs [Hash]
85
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
86
- # @see https://binance-docs.github.io/apidocs/spot/en/#redeem-flexible-product-user_data
87
- def savings_flexible_redeem(productId:, amount:, type:, **kwargs)
88
- Binance::Utils::Validation.require_param('productId', productId)
89
- Binance::Utils::Validation.require_param('amount', amount)
90
- Binance::Utils::Validation.require_param('type', type)
91
-
92
- @session.sign_request(:post, '/sapi/v1/lending/daily/redeem', params: kwargs.merge(
93
- productId: productId,
94
- amount: amount,
95
- type: type
96
- ))
97
- end
98
-
99
- # Get Flexible Product Position (USER_DATA)
100
- #
101
- # GET /sapi/v1/lending/daily/token/position
102
- #
103
- # @param asset [String]
104
- # @param kwargs [Hash]
105
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
106
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-flexible-product-position-user_data
107
- def savings_flexible_product_position(asset:, **kwargs)
108
- Binance::Utils::Validation.require_param('asset', asset)
109
-
110
- @session.sign_request(:get, '/sapi/v1/lending/daily/token/position', params: kwargs.merge(
111
- asset: asset
112
- ))
113
- end
114
-
115
- # Get Fixed and Activity Project List(USER_DATA)
116
- #
117
- # GET /sapi/v1/lending/project/list
118
- #
119
- # @param type [String] "REGULAR", "CUSTOMIZED_FIXED"
120
- # @param kwargs [Hash]
121
- # @option kwargs [String] :asset
122
- # @option kwargs [String] :status "ALL", "SUBSCRIBABLE", "UNSUBSCRIBABLE"; default "ALL"
123
- # @option kwargs [Boolean] :isSortAsc default "true"
124
- # @option kwargs [String] :sortBy "START_TIME", "LOT_SIZE", "INTEREST_RATE", "DURATION"; default "START_TIME"
125
- # @option kwargs [Integer] :current Currently querying page. Start from 1. Default:1
126
- # @option kwargs [Integer] :size Default:10, Max:100
127
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
128
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-fixed-and-activity-project-list-user_data
129
- def savings_product_list(type:, **kwargs)
130
- Binance::Utils::Validation.require_param('type', type)
131
-
132
- @session.sign_request(:get, '/sapi/v1/lending/project/list', params: kwargs.merge(
133
- type: type
134
- ))
135
- end
136
-
137
- # Purchase Fixed/Activity Project (USER_DATA)
138
- #
139
- # POST /sapi/v1/lending/customizedFixed/purchase
140
- #
141
- # @param projectId [String]
142
- # @param lot [String]
143
- # @param kwargs [Hash]
144
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
145
- # @see https://binance-docs.github.io/apidocs/spot/en/#purchase-fixed-activity-project-user_data
146
- def savings_purchase_customized_project(projectId:, lot:, **kwargs)
147
- Binance::Utils::Validation.require_param('projectId', projectId)
148
- Binance::Utils::Validation.require_param('lot', lot)
149
-
150
- @session.sign_request(:post, '/sapi/v1/lending/customizedFixed/purchase', params: kwargs.merge(
151
- projectId: projectId,
152
- lot: lot
153
- ))
154
- end
155
-
156
- # Get Fixed/Activity Project Position (USER_DATA)
157
- #
158
- # GET /sapi/v1/lending/project/position/list
159
- #
160
- # @param asset [String]
161
- # @param kwargs [Hash]
162
- # @option kwargs [String] :projectId
163
- # @option kwargs [String] :status "HOLDING", "REDEEMED"
164
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
165
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-fixed-activity-project-position-user_data
166
- def savings_customized_position(asset:, **kwargs)
167
- Binance::Utils::Validation.require_param('asset', asset)
168
-
169
- @session.sign_request(:get, '/sapi/v1/lending/project/position/list', params: kwargs.merge(
170
- asset: asset
171
- ))
172
- end
173
-
174
- # Lending Account (USER_DATA)
175
- #
176
- # GET /sapi/v1/lending/union/account
177
- #
178
- # @param kwargs [Hash]
179
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
180
- # @see https://binance-docs.github.io/apidocs/spot/en/#lending-account-user_data
181
- def savings_account(**kwargs)
182
- @session.sign_request(:get, '/sapi/v1/lending/union/account', params: kwargs)
183
- end
184
-
185
- # Get Purchase Record (USER_DATA)
186
- #
187
- # GET /sapi/v1/lending/union/purchaseRecord
188
- #
189
- # @param lendingType [String]
190
- # @param kwargs [Hash]
191
- # @option kwargs [String] :asset
192
- # @option kwargs [Integer] :startTime
193
- # @option kwargs [Integer] :endTime
194
- # @option kwargs [Integer] :current
195
- # @option kwargs [Integer] :size
196
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
197
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-purchase-record-user_data
198
- def savings_purchase_record(lendingType:, **kwargs)
199
- Binance::Utils::Validation.require_param('lendingType', lendingType)
200
-
201
- @session.sign_request(:get, '/sapi/v1/lending/union/purchaseRecord', params: kwargs.merge(
202
- lendingType: lendingType
203
- ))
204
- end
205
-
206
- # Get Redemption Record (USER_DATA)
207
- #
208
- # GET /sapi/v1/lending/union/redemptionRecord
209
- #
210
- # @param lendingType [String]
211
- # @param kwargs [Hash]
212
- # @option kwargs [String] :asset
213
- # @option kwargs [Integer] :startTime
214
- # @option kwargs [Integer] :endTime
215
- # @option kwargs [Integer] :current
216
- # @option kwargs [Integer] :size
217
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
218
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-redemption-record-user_data
219
- def savings_redemption_record(lendingType:, **kwargs)
220
- Binance::Utils::Validation.require_param('lendingType', lendingType)
221
-
222
- @session.sign_request(:get, '/sapi/v1/lending/union/redemptionRecord', params: kwargs.merge(
223
- lendingType: lendingType
224
- ))
225
- end
226
-
227
- # Get Interest History (USER_DATA)
228
- #
229
- # GET /sapi/v1/lending/union/interestHistory
230
- #
231
- # @param lendingType [String]
232
- # @param kwargs [Hash]
233
- # @option kwargs [String] :asset
234
- # @option kwargs [Integer] :startTime
235
- # @option kwargs [Integer] :endTime
236
- # @option kwargs [Integer] :current
237
- # @option kwargs [Integer] :size
238
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
239
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-interest-history-user_data-2
240
- def savings_interest_history(lendingType:, **kwargs)
241
- Binance::Utils::Validation.require_param('lendingType', lendingType)
242
-
243
- @session.sign_request(:get, '/sapi/v1/lending/union/interestHistory', params: kwargs.merge(
244
- lendingType: lendingType
245
- ))
246
- end
247
-
248
- # Change Fixed/Activity Position to Daily Position(USER_DATA)
249
- #
250
- # POST /sapi/v1/lending/positionChanged
251
- #
252
- # @param projectId [String]
253
- # @param lot [Integer]
254
- # @param kwargs [Hash]
255
- # @option kwargs [Integer] :positionId
256
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
257
- # @see https://binance-docs.github.io/apidocs/spot/en/#change-fixed-activity-position-to-daily-position-user_data
258
- def savings_position_changed(projectId:, lot:, **kwargs)
259
- Binance::Utils::Validation.require_param('projectId', projectId)
260
- Binance::Utils::Validation.require_param('lot', lot)
261
-
262
- @session.sign_request(:post, '/sapi/v1/lending/positionChanged', params: kwargs.merge(
263
- projectId: projectId,
264
- lot: lot
265
- ))
266
- end
267
- end
268
- end
269
- end
@@ -1,136 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Binance
4
- class Spot
5
- # all savings endpoints
6
- # @see https://binance-docs.github.io/apidocs/spot/en/#savings-endpoints
7
- module Staking
8
- # Get Staking Product List(USER_DATA)
9
- #
10
- # GET /sapi/v1/staking/productList
11
- #
12
- # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
13
- # @param kwargs [Hash]
14
- # @option kwargs [String] :asset
15
- # @option kwargs [Integer] :current
16
- # @option kwargs [Integer] :size
17
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
18
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data
19
- def staking_product_list(product:, **kwargs)
20
- Binance::Utils::Validation.require_param('product', product)
21
-
22
- @session.sign_request(:get, '/sapi/v1/staking/productList', params: kwargs.merge(product: product))
23
- end
24
-
25
- # Purchase Staking Product(USER_DATA)
26
- #
27
- # POST /sapi/v1/staking/purchase
28
- #
29
- # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
30
- # @param productId [String]
31
- # @param amount [Float]
32
- # @param kwargs [Hash]
33
- # @option kwargs [String] :renewable
34
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
35
- # @see https://binance-docs.github.io/apidocs/spot/en/#purchase-staking-product-user_data
36
- def staking_purchase(product:, productId:, amount:, **kwargs)
37
- Binance::Utils::Validation.require_param('product', product)
38
- Binance::Utils::Validation.require_param('productId', productId)
39
- Binance::Utils::Validation.require_param('amount', amount)
40
-
41
- @session.sign_request(:post, '/sapi/v1/staking/purchase', params: kwargs.merge(product: product, productId: productId, amount: amount))
42
- end
43
-
44
- # Redeem Staking Product(USER_DATA)
45
- #
46
- # POST /sapi/v1/staking/redeem
47
- #
48
- # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
49
- # @param productId [String]
50
- # @param kwargs [Hash]
51
- # @option kwargs [Float] :amount
52
- # @option kwargs [String] :positionId
53
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
54
- # @see https://binance-docs.github.io/apidocs/spot/en/#redeem-staking-product-user_data
55
- def staking_redeem(product:, productId:, **kwargs)
56
- Binance::Utils::Validation.require_param('product', product)
57
- Binance::Utils::Validation.require_param('productId', productId)
58
-
59
- @session.sign_request(:post, '/sapi/v1/staking/redeem', params: kwargs.merge(product: product, productId: productId))
60
- end
61
-
62
- # Get Staking Product Position(USER_DATA)
63
- #
64
- # GET /sapi/v1/staking/position
65
- #
66
- # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
67
- # @param kwargs [Hash]
68
- # @option kwargs [String] :productId
69
- # @option kwargs [String] :asset
70
- # @option kwargs [Integer] :current
71
- # @option kwargs [Integer] :size
72
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
73
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-staking-product-list-user_data
74
- def staking_position(product:, **kwargs)
75
- Binance::Utils::Validation.require_param('product', product)
76
-
77
- @session.sign_request(:get, '/sapi/v1/staking/position', params: kwargs.merge(product: product))
78
- end
79
-
80
- # Get Staking History(USER_DATA)
81
- #
82
- # GET /sapi/v1/staking/stakingRecord
83
- #
84
- # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
85
- # @param txnType [String] "SUBSCRIPTION", "REDEMPTION", "INTEREST"
86
- # @param kwargs [Hash]
87
- # @option kwargs [String] :asset
88
- # @option kwargs [Integer] :startTime
89
- # @option kwargs [Integer] :endTime
90
- # @option kwargs [Integer] :current
91
- # @option kwargs [Integer] :size
92
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
93
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data
94
- def staking_history(product:, txnType:, **kwargs)
95
- Binance::Utils::Validation.require_param('product', product)
96
- Binance::Utils::Validation.require_param('txnType', txnType)
97
-
98
- @session.sign_request(:get, '/sapi/v1/staking/stakingRecord', params: kwargs.merge(product: product, txnType: txnType))
99
- end
100
-
101
- # Set Auto Staking(USER_DATA)
102
- #
103
- # POST /sapi/v1/staking/setAutoStaking
104
- #
105
- # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
106
- # @param positionId [String]
107
- # @param renewable [String] true or false
108
- # @param kwargs [Hash]
109
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
110
- # @see https://binance-docs.github.io/apidocs/spot/en/#set-auto-staking-user_data
111
- def staking_set_auto(product:, positionId:, renewable:, **kwargs)
112
- Binance::Utils::Validation.require_param('product', product)
113
- Binance::Utils::Validation.require_param('positionId', positionId)
114
- Binance::Utils::Validation.require_param('renewable', renewable)
115
-
116
- @session.sign_request(:post, '/sapi/v1/staking/setAutoStaking', params: kwargs.merge(product: product, positionId: positionId, renewable: renewable))
117
- end
118
-
119
- # Get Personal Left Quota of Staking Product(USER_DATA)
120
- #
121
- # GET /sapi/v1/staking/personalLeftQuota
122
- #
123
- # @param product [String] "STAKING" for Locked Staking, "F_DEFI" for flexible DeFi Staking, "L_DEFI" for locked DeFi Staking
124
- # @param productId [String]
125
- # @param kwargs [Hash]
126
- # @option kwargs [Integer] :recvWindow The value cannot be greater than 60000
127
- # @see https://binance-docs.github.io/apidocs/spot/en/#get-staking-history-user_data
128
- def staking_personal_quota_remain(product:, productId:, **kwargs)
129
- Binance::Utils::Validation.require_param('product', product)
130
- Binance::Utils::Validation.require_param('productId', productId)
131
-
132
- @session.sign_request(:get, '/sapi/v1/staking/personalLeftQuota', params: kwargs.merge(product: product, productId: productId))
133
- end
134
- end
135
- end
136
- end