bybit-connector-ruby 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1047 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bybit
4
+ module RestApi
5
+ class EarnService < BaseService
6
+ # Add Liquidity to a liquidity mining position.
7
+ #
8
+ # POST /v5/earn/liquidity-mining/add-liquidity
9
+ #
10
+ # @param product_id [String] Product ID
11
+ # @param order_link_id [String] Client order id
12
+ # @option kwargs [String] :quote_account_type Quote coin account type
13
+ # @option kwargs [String] :base_account_type Base coin account type
14
+ # @option kwargs [String] :quote_amount Quote coin amount
15
+ # @option kwargs [String] :base_amount Base coin amount
16
+ # @option kwargs [String] :leverage Leverage
17
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
18
+ def add_liquidity(product_id:, order_link_id:, **kwargs)
19
+ params = kwargs.merge(product_id: product_id, order_link_id: order_link_id)
20
+ params = Bybit::Utils::WireKeys.camelize(params)
21
+ @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/add-liquidity', body: params)
22
+ end
23
+
24
+ # Add Margin to a liquidity mining position.
25
+ #
26
+ # POST /v5/earn/liquidity-mining/add-margin
27
+ #
28
+ # @param product_id [String] Product ID
29
+ # @param order_link_id [String] Client order id
30
+ # @param position_id [String] Position ID
31
+ # @param amount [String] Margin amount
32
+ # @param quote_account_type [String] Quote coin account type
33
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
34
+ def add_margin(product_id:, order_link_id:, position_id:, amount:, quote_account_type:, **kwargs)
35
+ params = kwargs.merge(product_id: product_id, order_link_id: order_link_id, position_id: position_id, amount: amount, quote_account_type: quote_account_type)
36
+ params = Bybit::Utils::WireKeys.camelize(params)
37
+ @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/add-margin', body: params)
38
+ end
39
+
40
+ # Claim Interest earned on liquidity mining product.
41
+ #
42
+ # POST /v5/earn/liquidity-mining/claim-interest
43
+ #
44
+ # @param product_id [String] Product ID
45
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
46
+ def claim_liquidity_interest(product_id:, **kwargs)
47
+ params = kwargs.merge(product_id: product_id)
48
+ params = Bybit::Utils::WireKeys.camelize(params)
49
+ @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/claim-interest', body: params)
50
+ end
51
+
52
+ # Get advance earn orders.
53
+ #
54
+ # GET /v5/earn/advance/order
55
+ #
56
+ # @param category [String] Product category
57
+ # @option kwargs [Integer] :product_id Product ID
58
+ # @option kwargs [String] :order_id Order ID
59
+ # @option kwargs [String] :order_link_id User-defined order link ID
60
+ # @option kwargs [Integer] :start_time Start timestamp in milliseconds
61
+ # @option kwargs [Integer] :end_time End timestamp in milliseconds
62
+ # @option kwargs [Integer] :limit Page size limit
63
+ # @option kwargs [String] :cursor Pagination cursor
64
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
65
+ def get_advance_earn_order(category:, **kwargs)
66
+ params = kwargs.merge(category: category)
67
+ params = Bybit::Utils::WireKeys.camelize(params)
68
+ @session.sign_request(method: :get, path: '/v5/earn/advance/order', params: params)
69
+ end
70
+
71
+ # Get advance earn positions.
72
+ #
73
+ # GET /v5/earn/advance/position
74
+ #
75
+ # @param category [String] Product category
76
+ # @option kwargs [Integer] :product_id Product ID
77
+ # @option kwargs [String] :coin Coin
78
+ # @option kwargs [Integer] :limit Page size limit
79
+ # @option kwargs [String] :cursor Pagination cursor
80
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
81
+ def get_advance_earn_position(category:, **kwargs)
82
+ params = kwargs.merge(category: category)
83
+ params = Bybit::Utils::WireKeys.camelize(params)
84
+ @session.sign_request(method: :get, path: '/v5/earn/advance/position', params: params)
85
+ end
86
+
87
+ # Get advance earn product info.
88
+ #
89
+ # GET /v5/earn/advance/product
90
+ #
91
+ # @param category [String] Product category
92
+ # @option kwargs [String] :coin Coin
93
+ # @option kwargs [String] :duration Product duration
94
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
95
+ def get_advance_earn_product(category:, **kwargs)
96
+ params = kwargs.merge(category: category)
97
+ params = Bybit::Utils::WireKeys.camelize(params)
98
+ @session.public_request(path: '/v5/earn/advance/product', params: params)
99
+ end
100
+
101
+ # Get advance earn product extra info.
102
+ #
103
+ # GET /v5/earn/advance/product-extra-info
104
+ #
105
+ # @param category [String] Product category
106
+ # @option kwargs [Integer] :product_id Product ID
107
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
108
+ def get_advance_earn_product_extra_info(category:, **kwargs)
109
+ params = kwargs.merge(category: category)
110
+ params = Bybit::Utils::WireKeys.camelize(params)
111
+ @session.public_request(path: '/v5/earn/advance/product-extra-info', params: params)
112
+ end
113
+
114
+ # Get double win leverage information.
115
+ #
116
+ # GET /v5/earn/advance/double-win-leverage
117
+ #
118
+ # @param product_id [Integer] Product ID
119
+ # @param initial_price [String] Initial price
120
+ # @param lower_price [String] Lower price bound
121
+ # @param upper_price [String] Upper price bound
122
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
123
+ def get_double_win_leverage(product_id:, initial_price:, lower_price:, upper_price:, **kwargs)
124
+ params = kwargs.merge(product_id: product_id, initial_price: initial_price, lower_price: lower_price, upper_price: upper_price)
125
+ params = Bybit::Utils::WireKeys.camelize(params)
126
+ @session.sign_request(method: :get, path: '/v5/earn/advance/double-win-leverage', params: params)
127
+ end
128
+
129
+ # Get earn APR history.
130
+ #
131
+ # GET /v5/earn/apr-history
132
+ #
133
+ # @param category [String] Product category
134
+ # @param product_id [String] Product ID
135
+ # @param start_time [Integer] Start timestamp in milliseconds
136
+ # @param end_time [Integer] End timestamp in milliseconds
137
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
138
+ def get_apr_history(category:, product_id:, start_time:, end_time:, **kwargs)
139
+ params = kwargs.merge(category: category, product_id: product_id, start_time: start_time, end_time: end_time)
140
+ params = Bybit::Utils::WireKeys.camelize(params)
141
+ @session.public_request(path: '/v5/earn/apr-history', params: params)
142
+ end
143
+
144
+ # Get earn hourly yield history.
145
+ #
146
+ # GET /v5/earn/hourly-yield
147
+ #
148
+ # @param category [String] Product category
149
+ # @option kwargs [String] :product_id Product ID
150
+ # @option kwargs [Integer] :start_time Start timestamp in milliseconds
151
+ # @option kwargs [Integer] :end_time End timestamp in milliseconds
152
+ # @option kwargs [Integer] :limit Page size limit
153
+ # @option kwargs [String] :cursor Pagination cursor
154
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
155
+ def get_hourly_yield_history(category:, **kwargs)
156
+ params = kwargs.merge(category: category)
157
+ params = Bybit::Utils::WireKeys.camelize(params)
158
+ @session.sign_request(method: :get, path: '/v5/earn/hourly-yield', params: params)
159
+ end
160
+
161
+ # Get stake or redeem order history.
162
+ #
163
+ # GET /v5/earn/order
164
+ #
165
+ # @param category [String] Product category
166
+ # @option kwargs [String] :order_id Order ID
167
+ # @option kwargs [String] :order_link_id User-defined order link ID
168
+ # @option kwargs [String] :product_id Product ID
169
+ # @option kwargs [Integer] :start_time Start timestamp in milliseconds
170
+ # @option kwargs [Integer] :end_time End timestamp in milliseconds
171
+ # @option kwargs [Integer] :limit Page size limit
172
+ # @option kwargs [String] :cursor Pagination cursor
173
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
174
+ def get_order_history(category:, **kwargs)
175
+ params = kwargs.merge(category: category)
176
+ params = Bybit::Utils::WireKeys.camelize(params)
177
+ @session.sign_request(method: :get, path: '/v5/earn/order', params: params)
178
+ end
179
+
180
+ # Get staked positions.
181
+ #
182
+ # GET /v5/earn/position
183
+ #
184
+ # @param category [String] Product category
185
+ # @option kwargs [String] :product_id Product ID
186
+ # @option kwargs [String] :coin Coin
187
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
188
+ def get_position(category:, **kwargs)
189
+ params = kwargs.merge(category: category)
190
+ params = Bybit::Utils::WireKeys.camelize(params)
191
+ @session.sign_request(method: :get, path: '/v5/earn/position', params: params)
192
+ end
193
+
194
+ # Get earn product info.
195
+ #
196
+ # GET /v5/earn/product
197
+ #
198
+ # @param category [String] Product category
199
+ # @option kwargs [String] :coin Coin
200
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
201
+ def get_product(category:, **kwargs)
202
+ params = kwargs.merge(category: category)
203
+ params = Bybit::Utils::WireKeys.camelize(params)
204
+ @session.public_request(path: '/v5/earn/product', params: params)
205
+ end
206
+
207
+ # Get earn yield history.
208
+ #
209
+ # GET /v5/earn/yield
210
+ #
211
+ # @param category [String] Product category
212
+ # @option kwargs [Integer] :product_id Product ID
213
+ # @option kwargs [Integer] :start_time Start timestamp in milliseconds
214
+ # @option kwargs [Integer] :end_time End timestamp in milliseconds
215
+ # @option kwargs [Integer] :limit Page size limit
216
+ # @option kwargs [String] :cursor Pagination cursor
217
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
218
+ def get_yield_history(category:, **kwargs)
219
+ params = kwargs.merge(category: category)
220
+ params = Bybit::Utils::WireKeys.camelize(params)
221
+ @session.sign_request(method: :get, path: '/v5/earn/yield', params: params)
222
+ end
223
+
224
+ # Get fixed-term earn order history.
225
+ #
226
+ # GET /v5/earn/fixed-term/order
227
+ #
228
+ # @option kwargs [String] :order_type Order type
229
+ # @option kwargs [String] :product_id Product ID
230
+ # @option kwargs [String] :category Product category
231
+ # @option kwargs [String] :order_id Order ID
232
+ # @option kwargs [Integer] :start_time Start timestamp in ms
233
+ # @option kwargs [Integer] :end_time End timestamp in ms
234
+ # @option kwargs [Integer] :limit Result limit per page
235
+ # @option kwargs [String] :cursor Cursor for pagination
236
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
237
+ def get_fixed_term_order(**kwargs)
238
+ params = kwargs.dup
239
+ params = Bybit::Utils::WireKeys.camelize(params)
240
+ @session.sign_request(method: :get, path: '/v5/earn/fixed-term/order', params: params)
241
+ end
242
+
243
+ # Get fixed-term earn positions.
244
+ #
245
+ # GET /v5/earn/fixed-term/position
246
+ #
247
+ # @option kwargs [String] :product_id Product ID
248
+ # @option kwargs [String] :category Product category
249
+ # @option kwargs [String] :coin Coin name
250
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
251
+ def get_fixed_term_position(**kwargs)
252
+ params = kwargs.dup
253
+ params = Bybit::Utils::WireKeys.camelize(params)
254
+ @session.sign_request(method: :get, path: '/v5/earn/fixed-term/position', params: params)
255
+ end
256
+
257
+ # Get fixed-term earn product list.
258
+ #
259
+ # GET /v5/earn/fixed-term/product
260
+ #
261
+ # @option kwargs [String] :coin Coin name
262
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
263
+ def get_fixed_term_product(**kwargs)
264
+ params = kwargs.dup
265
+ params = Bybit::Utils::WireKeys.camelize(params)
266
+ @session.public_request(path: '/v5/earn/fixed-term/product', params: params)
267
+ end
268
+
269
+ # Get Hold-to-Earn Product List.
270
+ #
271
+ # GET /v5/earn/hold-to-earn/product
272
+ def get_hold_to_earn_product
273
+ @session.public_request(path: '/v5/earn/hold-to-earn/product')
274
+ end
275
+
276
+ # Get Hold-to-Earn Yield History.
277
+ #
278
+ # GET /v5/earn/hold-to-earn/yield-history
279
+ #
280
+ # @param limit [Integer] Limit for data size per page
281
+ # @option kwargs [Integer] :time_start Start time in ms
282
+ # @option kwargs [Integer] :time_end End time in ms
283
+ # @option kwargs [String] :cursor Cursor for pagination
284
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
285
+ def get_hold_to_earn_yield_history(limit:, **kwargs)
286
+ params = kwargs.merge(limit: limit)
287
+ params = Bybit::Utils::WireKeys.camelize(params)
288
+ @session.sign_request(method: :get, path: '/v5/earn/hold-to-earn/yield-history', params: params)
289
+ end
290
+
291
+ # Get liquidity mining liquidation records with optional filters and pagination.
292
+ #
293
+ # GET /v5/earn/liquidity-mining/liquidation-records
294
+ #
295
+ # @option kwargs [String] :base_coin Base coin filter
296
+ # @option kwargs [String] :quote_coin Quote coin filter
297
+ # @option kwargs [Integer] :start_time Start timestamp in milliseconds
298
+ # @option kwargs [Integer] :end_time End timestamp in milliseconds
299
+ # @option kwargs [Integer] :limit Result page size
300
+ # @option kwargs [String] :cursor Pagination cursor
301
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
302
+ def get_liquidity_mining_liquidation_records(**kwargs)
303
+ params = kwargs.dup
304
+ params = Bybit::Utils::WireKeys.camelize(params)
305
+ @session.sign_request(method: :get, path: '/v5/earn/liquidity-mining/liquidation-records', params: params)
306
+ end
307
+
308
+ # Get Liquidity Mining Order History.
309
+ #
310
+ # GET /v5/earn/liquidity-mining/order
311
+ #
312
+ # @option kwargs [String] :order_id Order ID
313
+ # @option kwargs [String] :order_link_id Client order id
314
+ # @option kwargs [String] :product_id Product ID
315
+ # @option kwargs [String] :order_type Order type
316
+ # @option kwargs [String] :status Order status
317
+ # @option kwargs [Integer] :start_time Start time in ms
318
+ # @option kwargs [Integer] :end_time End time in ms
319
+ # @option kwargs [Integer] :limit Limit for data size per page
320
+ # @option kwargs [String] :cursor Cursor for pagination
321
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
322
+ def get_liquidity_mining_orders(**kwargs)
323
+ params = kwargs.dup
324
+ params = Bybit::Utils::WireKeys.camelize(params)
325
+ @session.sign_request(method: :get, path: '/v5/earn/liquidity-mining/order', params: params)
326
+ end
327
+
328
+ # Get Liquidity Mining Active Positions.
329
+ #
330
+ # GET /v5/earn/liquidity-mining/position
331
+ #
332
+ # @option kwargs [String] :product_id Product ID
333
+ # @option kwargs [String] :base_coin Base coin
334
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
335
+ def get_liquidity_mining_positions(**kwargs)
336
+ params = kwargs.dup
337
+ params = Bybit::Utils::WireKeys.camelize(params)
338
+ @session.sign_request(method: :get, path: '/v5/earn/liquidity-mining/position', params: params)
339
+ end
340
+
341
+ # Get Liquidity Mining Product List.
342
+ #
343
+ # GET /v5/earn/liquidity-mining/product
344
+ #
345
+ # @option kwargs [String] :base_coin Base coin
346
+ # @option kwargs [String] :quote_coin Quote coin
347
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
348
+ def get_liquidity_mining_products(**kwargs)
349
+ params = kwargs.dup
350
+ params = Bybit::Utils::WireKeys.camelize(params)
351
+ @session.public_request(path: '/v5/earn/liquidity-mining/product', params: params)
352
+ end
353
+
354
+ # Get Liquidity Mining Yield Claim Records.
355
+ #
356
+ # GET /v5/earn/liquidity-mining/yield-records
357
+ #
358
+ # @option kwargs [String] :base_coin Base coin
359
+ # @option kwargs [String] :quote_coin Quote coin
360
+ # @option kwargs [Integer] :start_time Start time in ms
361
+ # @option kwargs [Integer] :end_time End time in ms
362
+ # @option kwargs [Integer] :limit Limit for data size per page
363
+ # @option kwargs [String] :cursor Cursor for pagination
364
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
365
+ def get_liquidity_mining_yield_records(**kwargs)
366
+ params = kwargs.dup
367
+ params = Bybit::Utils::WireKeys.camelize(params)
368
+ @session.sign_request(method: :get, path: '/v5/earn/liquidity-mining/yield-records', params: params)
369
+ end
370
+
371
+ # Get RWA NAV Chart.
372
+ #
373
+ # GET /v5/earn/rwa/nav-chart
374
+ #
375
+ # @param product_id [Integer] Product ID
376
+ # @option kwargs [Integer] :start_time Start time in ms
377
+ # @option kwargs [Integer] :end_time End time in ms
378
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
379
+ def get_rwa_nav_chart(product_id:, **kwargs)
380
+ params = kwargs.merge(product_id: product_id)
381
+ params = Bybit::Utils::WireKeys.camelize(params)
382
+ @session.public_request(path: '/v5/earn/rwa/nav-chart', params: params)
383
+ end
384
+
385
+ # Get RWA Order List.
386
+ #
387
+ # GET /v5/earn/rwa/order
388
+ #
389
+ # @option kwargs [String] :order_id Order ID
390
+ # @option kwargs [String] :order_link_id Client order id
391
+ # @option kwargs [String] :order_type Order type: Stake / Redeem
392
+ # @option kwargs [Integer] :product_id Product ID
393
+ # @option kwargs [Integer] :start_time Start time in ms
394
+ # @option kwargs [Integer] :end_time End time in ms
395
+ # @option kwargs [Integer] :limit Limit for data size per page
396
+ # @option kwargs [String] :cursor Cursor for pagination
397
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
398
+ def get_rwa_order_list(**kwargs)
399
+ params = kwargs.dup
400
+ params = Bybit::Utils::WireKeys.camelize(params)
401
+ @session.sign_request(method: :get, path: '/v5/earn/rwa/order', params: params)
402
+ end
403
+
404
+ # Get RWA Position List.
405
+ #
406
+ # GET /v5/earn/rwa/position
407
+ def get_rwa_position_list
408
+ @session.sign_request(method: :get, path: '/v5/earn/rwa/position')
409
+ end
410
+
411
+ # Get RWA earn product list.
412
+ #
413
+ # GET /v5/earn/rwa/product
414
+ #
415
+ # @option kwargs [String] :coin Coin name
416
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
417
+ def get_rwa_product_list(**kwargs)
418
+ params = kwargs.dup
419
+ params = Bybit::Utils::WireKeys.camelize(params)
420
+ @session.public_request(path: '/v5/earn/rwa/product', params: params)
421
+ end
422
+
423
+ # Get smart leverage redeem estimation amount list.
424
+ #
425
+ # GET /v5/earn/advance/get-redeem-est-amount-list
426
+ #
427
+ # @param category [String] Product category
428
+ # @param position_ids [String] Position IDs
429
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
430
+ def get_smart_leverage_redeem_est_amount_list(category:, position_ids:, **kwargs)
431
+ params = kwargs.merge(category: category, position_ids: position_ids)
432
+ params = Bybit::Utils::WireKeys.camelize(params)
433
+ @session.sign_request(method: :get, path: '/v5/earn/advance/get-redeem-est-amount-list', params: params)
434
+ end
435
+
436
+ # Get daily yield records for a token earn position.
437
+ #
438
+ # GET /v5/earn/token/yield
439
+ #
440
+ # @param coin [String] Coin name
441
+ # @option kwargs [Integer] :start_time Start timestamp in ms
442
+ # @option kwargs [Integer] :end_time End timestamp in ms
443
+ # @option kwargs [String] :cursor Cursor for pagination
444
+ # @option kwargs [Integer] :limit Result limit per page
445
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
446
+ def get_token_daily_yield(coin:, **kwargs)
447
+ params = kwargs.merge(coin: coin)
448
+ params = Bybit::Utils::WireKeys.camelize(params)
449
+ @session.sign_request(method: :get, path: '/v5/earn/token/yield', params: params)
450
+ end
451
+
452
+ # Get historical APR for a token earn product.
453
+ #
454
+ # GET /v5/earn/token/history-apr
455
+ #
456
+ # @param coin [String] Coin name
457
+ # @param range [Integer] Range window for APR history
458
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
459
+ def get_token_historical_apr(coin:, range:, **kwargs)
460
+ params = kwargs.merge(coin: coin, range: range)
461
+ params = Bybit::Utils::WireKeys.camelize(params)
462
+ @session.public_request(path: '/v5/earn/token/history-apr', params: params)
463
+ end
464
+
465
+ # Get hourly yield records for a token earn position.
466
+ #
467
+ # GET /v5/earn/token/hourly-yield
468
+ #
469
+ # @param coin [String] Coin name
470
+ # @option kwargs [Integer] :start_time Start timestamp in ms
471
+ # @option kwargs [Integer] :end_time End timestamp in ms
472
+ # @option kwargs [String] :cursor Cursor for pagination
473
+ # @option kwargs [Integer] :limit Result limit per page
474
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
475
+ def get_token_hourly_yield(coin:, **kwargs)
476
+ params = kwargs.merge(coin: coin)
477
+ params = Bybit::Utils::WireKeys.camelize(params)
478
+ @session.sign_request(method: :get, path: '/v5/earn/token/hourly-yield', params: params)
479
+ end
480
+
481
+ # Query token earn order history.
482
+ #
483
+ # GET /v5/earn/token/order
484
+ #
485
+ # @param coin [String] Coin name
486
+ # @option kwargs [String] :order_link_id Client-supplied order link ID
487
+ # @option kwargs [String] :order_id Order ID
488
+ # @option kwargs [String] :order_type Order type (mint or redeem)
489
+ # @option kwargs [Integer] :start_time Start timestamp in ms
490
+ # @option kwargs [Integer] :end_time End timestamp in ms
491
+ # @option kwargs [String] :cursor Cursor for pagination
492
+ # @option kwargs [Integer] :limit Result limit per page
493
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
494
+ def get_token_order_list(coin:, **kwargs)
495
+ params = kwargs.merge(coin: coin)
496
+ params = Bybit::Utils::WireKeys.camelize(params)
497
+ @session.sign_request(method: :get, path: '/v5/earn/token/order', params: params)
498
+ end
499
+
500
+ # Get current token earn position for a coin.
501
+ #
502
+ # GET /v5/earn/token/position
503
+ #
504
+ # @param coin [String] Coin name
505
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
506
+ def get_token_position(coin:, **kwargs)
507
+ params = kwargs.merge(coin: coin)
508
+ params = Bybit::Utils::WireKeys.camelize(params)
509
+ @session.sign_request(method: :get, path: '/v5/earn/token/position', params: params)
510
+ end
511
+
512
+ # Get info for a token earn product.
513
+ #
514
+ # GET /v5/earn/token/product
515
+ #
516
+ # @param coin [String] Coin name
517
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
518
+ def get_token_product(coin:, **kwargs)
519
+ params = kwargs.merge(coin: coin)
520
+ params = Bybit::Utils::WireKeys.camelize(params)
521
+ @session.public_request(path: '/v5/earn/token/product', params: params)
522
+ end
523
+
524
+ # List available earn coupons for the given category.
525
+ #
526
+ # GET /v5/earn/coupons
527
+ #
528
+ # @param category [String] Product category
529
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
530
+ def list_coupons(category:, **kwargs)
531
+ params = kwargs.merge(category: category)
532
+ params = Bybit::Utils::WireKeys.camelize(params)
533
+ @session.sign_request(method: :get, path: '/v5/earn/coupons', params: params)
534
+ end
535
+
536
+ # Modify an earn position.
537
+ #
538
+ # POST /v5/earn/position/modify
539
+ #
540
+ # @param category [String] Product category
541
+ # @param product_id [Integer] Product ID
542
+ # @param position_id [Integer] Position ID
543
+ # @param auto_reinvest [Integer] Auto-reinvest flag
544
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
545
+ def modify_earn_position(category:, product_id:, position_id:, auto_reinvest:, **kwargs)
546
+ params = kwargs.merge(category: category, product_id: product_id, position_id: position_id, auto_reinvest: auto_reinvest)
547
+ params = Bybit::Utils::WireKeys.camelize(params)
548
+ @session.sign_request(method: :post, path: '/v5/earn/position/modify', body: params)
549
+ end
550
+
551
+ # Place an advance earn order.
552
+ #
553
+ # POST /v5/earn/advance/place-order
554
+ #
555
+ # @param category [String] Product category
556
+ # @param product_id [Integer] Product ID
557
+ # @param order_type [String] Order type
558
+ # @param amount [String] Order amount
559
+ # @param account_type [String] Account type
560
+ # @param coin [String] Coin
561
+ # @param order_link_id [String] User-defined order link ID
562
+ # @option kwargs [Hash] :dual_assets_extra Dual assets extra info
563
+ # @option kwargs [Hash] :interest_card Interest card info
564
+ # @option kwargs [Hash] :smart_leverage_stake_extra Smart leverage stake extra info
565
+ # @option kwargs [Hash] :smart_leverage_redeem_extra Smart leverage redeem extra info
566
+ # @option kwargs [Hash] :double_win_stake_extra Double win stake extra info
567
+ # @option kwargs [Hash] :double_win_redeem_extra Double win redeem extra info
568
+ # @option kwargs [Hash] :discount_buy_extra Discount buy extra info
569
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
570
+ def place_advance_earn_order(category:, product_id:, order_type:, amount:, account_type:, coin:, order_link_id:, **kwargs)
571
+ params = kwargs.merge(category: category, product_id: product_id, order_type: order_type, amount: amount, account_type: account_type, coin: coin, order_link_id: order_link_id)
572
+ params = Bybit::Utils::WireKeys.camelize(params)
573
+ @session.sign_request(method: :post, path: '/v5/earn/advance/place-order', body: params)
574
+ end
575
+
576
+ # Stake or redeem an earn order.
577
+ #
578
+ # POST /v5/earn/place-order
579
+ #
580
+ # @param category [String] Product category
581
+ # @param order_type [String] Order type: Stake or Redeem
582
+ # @param account_type [String] Account type
583
+ # @param amount [String] Order amount
584
+ # @param coin [String] Coin
585
+ # @param product_id [String] Product ID
586
+ # @param order_link_id [String] User-defined order link ID
587
+ # @option kwargs [String] :redeem_position_id Redeem position ID
588
+ # @option kwargs [String] :to_account_type Destination account type
589
+ # @option kwargs [Hash] :interest_card Interest card info
590
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
591
+ def place_order(category:, order_type:, account_type:, amount:, coin:, product_id:, order_link_id:, **kwargs)
592
+ params = kwargs.merge(category: category, order_type: order_type, account_type: account_type, amount: amount, coin: coin, product_id: product_id, order_link_id: order_link_id)
593
+ params = Bybit::Utils::WireKeys.camelize(params)
594
+ @session.sign_request(method: :post, path: '/v5/earn/place-order', body: params)
595
+ end
596
+
597
+ # Place a fixed-term earn order.
598
+ #
599
+ # POST /v5/earn/fixed-term/place-order
600
+ #
601
+ # @param product_id [String] Product ID
602
+ # @param category [String] Product category
603
+ # @param coin [String] Coin name
604
+ # @param amount [String] Order amount
605
+ # @param account_type [String] Account type
606
+ # @param order_link_id [String] Client-supplied order link ID
607
+ # @option kwargs [Boolean] :auto_invest Whether to enable auto-invest
608
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
609
+ def place_fixed_term_order(product_id:, category:, coin:, amount:, account_type:, order_link_id:, **kwargs)
610
+ params = kwargs.merge(product_id: product_id, category: category, coin: coin, amount: amount, account_type: account_type, order_link_id: order_link_id)
611
+ params = Bybit::Utils::WireKeys.camelize(params)
612
+ @session.sign_request(method: :post, path: '/v5/earn/fixed-term/place-order', body: params)
613
+ end
614
+
615
+ # Place Order (Stake / Redeem) for RWA earn products.
616
+ #
617
+ # POST /v5/earn/rwa/place-order
618
+ #
619
+ # @param product_id [Integer] Product ID
620
+ # @param order_type [String] Order type: Stake / Redeem
621
+ # @param coin [String] Coin name
622
+ # @param order_link_id [String] Client order id
623
+ # @option kwargs [String] :stake_amount Stake amount, required when orderType is Stake
624
+ # @option kwargs [String] :redeem_shares Redeem shares, required when orderType is Redeem
625
+ # @option kwargs [String] :account_type Account type
626
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
627
+ def place_rwa_order(product_id:, order_type:, coin:, order_link_id:, **kwargs)
628
+ params = kwargs.merge(product_id: product_id, order_type: order_type, coin: coin, order_link_id: order_link_id)
629
+ params = Bybit::Utils::WireKeys.camelize(params)
630
+ @session.sign_request(method: :post, path: '/v5/earn/rwa/place-order', body: params)
631
+ end
632
+
633
+ # Place a mint or redeem order for a token earn product.
634
+ #
635
+ # POST /v5/earn/token/place-order
636
+ #
637
+ # @param coin [String] Coin name
638
+ # @param order_link_id [String] Client-supplied order link ID
639
+ # @param order_type [String] Order type (mint or redeem)
640
+ # @param amount [String] Order amount
641
+ # @param account_type [String] Account type
642
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
643
+ def place_token_order(coin:, order_link_id:, order_type:, amount:, account_type:, **kwargs)
644
+ params = kwargs.merge(coin: coin, order_link_id: order_link_id, order_type: order_type, amount: amount, account_type: account_type)
645
+ params = Bybit::Utils::WireKeys.camelize(params)
646
+ @session.sign_request(method: :post, path: '/v5/earn/token/place-order', body: params)
647
+ end
648
+
649
+ # Get PWM investment plan asset trend over time.
650
+ #
651
+ # GET /v5/earn/pwm/investment-plan/asset-trend
652
+ #
653
+ # @param plan_id [String] Investment plan ID
654
+ # @option kwargs [Integer] :start_time Start timestamp (ms)
655
+ # @option kwargs [Integer] :end_time End timestamp (ms)
656
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
657
+ def pwm_asset_trend(plan_id:, **kwargs)
658
+ params = kwargs.merge(plan_id: plan_id)
659
+ params = Bybit::Utils::WireKeys.camelize(params)
660
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/asset-trend', params: params)
661
+ end
662
+
663
+ # Claim available funds from a PWM investment plan.
664
+ #
665
+ # POST /v5/earn/pwm/investment-plan/claim
666
+ #
667
+ # @param plan_id [String] Investment plan ID
668
+ # @param order_link_id [String] Client-generated unique order link ID
669
+ # @option kwargs [String] :to_account_type Destination account type
670
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
671
+ def pwm_claim(plan_id:, order_link_id:, **kwargs)
672
+ params = kwargs.merge(plan_id: plan_id, order_link_id: order_link_id)
673
+ params = Bybit::Utils::WireKeys.camelize(params)
674
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/investment-plan/claim', body: params)
675
+ end
676
+
677
+ # Create a custom PWM investment plan in Direct Mode.
678
+ #
679
+ # POST /v5/earn/pwm/customize-plan/create
680
+ #
681
+ # @param products [Array] List of products to include in the plan
682
+ # @param order_link_id [String] Client-generated unique order link ID
683
+ # @option kwargs [String] :account_type Source account type
684
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
685
+ def pwm_create_custom_plan(products:, order_link_id:, **kwargs)
686
+ params = kwargs.merge(products: products, order_link_id: order_link_id)
687
+ params = Bybit::Utils::WireKeys.camelize(params)
688
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/customize-plan/create', body: params)
689
+ end
690
+
691
+ # Get historical NAV data for a PWM fund.
692
+ #
693
+ # GET /v5/earn/pwm/investment-plan/fund-nav
694
+ #
695
+ # @param fund_id [String] Fund ID
696
+ # @option kwargs [Integer] :start_time Start timestamp (ms)
697
+ # @option kwargs [Integer] :end_time End timestamp (ms)
698
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
699
+ def pwm_fund_nav(fund_id:, **kwargs)
700
+ params = kwargs.merge(fund_id: fund_id)
701
+ params = Bybit::Utils::WireKeys.camelize(params)
702
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/fund-nav', params: params)
703
+ end
704
+
705
+ # Transfer funds between custody sub-accounts.
706
+ #
707
+ # POST /v5/earn/pwm/fund-transfer
708
+ #
709
+ # @param transfer_id [String] Client-supplied transfer identifier
710
+ # @param from_user_id [Integer] Source sub-account UID
711
+ # @param to_user_id [Integer] Destination sub-account UID
712
+ # @param amount [String] Transfer amount
713
+ # @param coin [String] Coin symbol
714
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
715
+ def pwm_fund_transfer(transfer_id:, from_user_id:, to_user_id:, amount:, coin:, **kwargs)
716
+ params = kwargs.merge(transfer_id: transfer_id, from_user_id: from_user_id, to_user_id: to_user_id, amount: amount, coin: coin)
717
+ params = Bybit::Utils::WireKeys.camelize(params)
718
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/fund-transfer', body: params)
719
+ end
720
+
721
+ # Get the detail of a pending-subscription investment plan.
722
+ #
723
+ # GET /v5/earn/pwm/investment-plan/new-plan
724
+ #
725
+ # @param plan_id [String] Investment plan identifier
726
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
727
+ def pwm_get_new_plan_detail(plan_id:, **kwargs)
728
+ params = kwargs.merge(plan_id: plan_id)
729
+ params = Bybit::Utils::WireKeys.camelize(params)
730
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/new-plan', params: params)
731
+ end
732
+
733
+ # Get the detail of an active or closed investment plan.
734
+ #
735
+ # GET /v5/earn/pwm/investment-plan/detail
736
+ #
737
+ # @param plan_id [String] Investment plan identifier
738
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
739
+ def pwm_get_plan_detail(plan_id:, **kwargs)
740
+ params = kwargs.merge(plan_id: plan_id)
741
+ params = Bybit::Utils::WireKeys.camelize(params)
742
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/detail', params: params)
743
+ end
744
+
745
+ # Create a pending-subscription fund for the institution.
746
+ #
747
+ # POST /v5/earn/pwm/asset-manager/create-fund
748
+ #
749
+ # @param fund_name [String] Fund display name
750
+ # @param coin [String] Base coin of the fund
751
+ # @param profit_share_rate [String] Profit share rate
752
+ # @param management_fee_rate [String] Management fee rate
753
+ # @param req_link_id [String] Client-supplied idempotency key
754
+ # @option kwargs [String] :fund_introduction Fund introduction text
755
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
756
+ def pwm_inst_create_fund(fund_name:, coin:, profit_share_rate:, management_fee_rate:, req_link_id:, **kwargs)
757
+ params = kwargs.merge(fund_name: fund_name, coin: coin, profit_share_rate: profit_share_rate, management_fee_rate: management_fee_rate, req_link_id: req_link_id)
758
+ params = Bybit::Utils::WireKeys.camelize(params)
759
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/create-fund', body: params)
760
+ end
761
+
762
+ # Create an investment plan for a client account.
763
+ #
764
+ # POST /v5/earn/pwm/asset-manager/create-investment-plan
765
+ #
766
+ # @param account_uid [String] Client account UID
767
+ # @param plan_name [String] Investment plan name
768
+ # @param plan_type [String] Investment plan type
769
+ # @param investment_distribution [Array] Fund allocation distribution
770
+ # @param req_link_id [String] Client-supplied idempotency key
771
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
772
+ def pwm_inst_create_investment_plan(account_uid:, plan_name:, plan_type:, investment_distribution:, req_link_id:, **kwargs)
773
+ params = kwargs.merge(account_uid: account_uid, plan_name: plan_name, plan_type: plan_type, investment_distribution: investment_distribution, req_link_id: req_link_id)
774
+ params = Bybit::Utils::WireKeys.camelize(params)
775
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/create-investment-plan', body: params)
776
+ end
777
+
778
+ # Create a fund custody sub-account.
779
+ #
780
+ # POST /v5/earn/pwm/asset-manager/create-sub-account
781
+ #
782
+ # @param fund_id [String] Fund identifier
783
+ # @param req_link_id [String] Client-supplied idempotency key
784
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
785
+ def pwm_inst_create_sub_account(fund_id:, req_link_id:, **kwargs)
786
+ params = kwargs.merge(fund_id: fund_id, req_link_id: req_link_id)
787
+ params = Bybit::Utils::WireKeys.camelize(params)
788
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/create-sub-account', body: params)
789
+ end
790
+
791
+ # Query the institution's investment plans with optional filters.
792
+ #
793
+ # GET /v5/earn/pwm/asset-manager/get-investment-plan
794
+ #
795
+ # @option kwargs [String] :plan_id Investment plan identifier
796
+ # @option kwargs [String] :status Plan status filter
797
+ # @option kwargs [String] :subscription_uid Subscription account UID
798
+ # @option kwargs [Integer] :limit Result page size
799
+ # @option kwargs [String] :cursor Pagination cursor
800
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
801
+ def pwm_inst_get_investment_plans(**kwargs)
802
+ params = kwargs.dup
803
+ params = Bybit::Utils::WireKeys.camelize(params)
804
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/asset-manager/get-investment-plan', params: params)
805
+ end
806
+
807
+ # Query the institution's managed funds with optional filters.
808
+ #
809
+ # GET /v5/earn/pwm/asset-manager/all-funds
810
+ #
811
+ # @option kwargs [String] :fund_id Fund identifier
812
+ # @option kwargs [String] :coin Coin filter
813
+ # @option kwargs [String] :status Fund status filter
814
+ # @option kwargs [Integer] :limit Result page size
815
+ # @option kwargs [String] :cursor Pagination cursor
816
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
817
+ def pwm_inst_list_funds(**kwargs)
818
+ params = kwargs.dup
819
+ params = Bybit::Utils::WireKeys.camelize(params)
820
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/asset-manager/all-funds', params: params)
821
+ end
822
+
823
+ # Query fund subscription and redemption orders.
824
+ #
825
+ # GET /v5/earn/pwm/asset-manager/all-order
826
+ #
827
+ # @option kwargs [String] :fund_id Fund identifier
828
+ # @option kwargs [String] :order_type Order type filter
829
+ # @option kwargs [String] :status Order status filter
830
+ # @option kwargs [Integer] :start_time Start timestamp in milliseconds
831
+ # @option kwargs [Integer] :end_time End timestamp in milliseconds
832
+ # @option kwargs [Integer] :limit Result page size
833
+ # @option kwargs [String] :cursor Pagination cursor
834
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
835
+ def pwm_inst_list_orders(**kwargs)
836
+ params = kwargs.dup
837
+ params = Bybit::Utils::WireKeys.camelize(params)
838
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/asset-manager/all-order', params: params)
839
+ end
840
+
841
+ # Update the status and fund allocation of an investment plan.
842
+ #
843
+ # POST /v5/earn/pwm/asset-manager/manage-investment-plan
844
+ #
845
+ # @param plan_id [String] Investment plan identifier
846
+ # @param req_link_id [String] Client-supplied idempotency key
847
+ # @option kwargs [String] :update_status New plan status
848
+ # @option kwargs [Array] :update_funds Updated fund allocation
849
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
850
+ def pwm_inst_manage_investment_plan(plan_id:, req_link_id:, **kwargs)
851
+ params = kwargs.merge(plan_id: plan_id, req_link_id: req_link_id)
852
+ params = Bybit::Utils::WireKeys.camelize(params)
853
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/manage-investment-plan', body: params)
854
+ end
855
+
856
+ # Approve or reject a fund subscription or redemption order.
857
+ #
858
+ # POST /v5/earn/pwm/asset-manager/manage-order
859
+ #
860
+ # @param order_id [String] Order identifier
861
+ # @param action [String] Approve or reject action
862
+ # @param req_link_id [String] Client-supplied idempotency key
863
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
864
+ def pwm_inst_manage_order(order_id:, action:, req_link_id:, **kwargs)
865
+ params = kwargs.merge(order_id: order_id, action: action, req_link_id: req_link_id)
866
+ params = Bybit::Utils::WireKeys.camelize(params)
867
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/manage-order', body: params)
868
+ end
869
+
870
+ # Execute profit settlement for the specified fund.
871
+ #
872
+ # POST /v5/earn/pwm/asset-manager/settle-profit
873
+ #
874
+ # @param fund_id [String] Fund identifier
875
+ # @param req_link_id [String] Client-supplied idempotency key
876
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
877
+ def pwm_inst_settle_profit(fund_id:, req_link_id:, **kwargs)
878
+ params = kwargs.merge(fund_id: fund_id, req_link_id: req_link_id)
879
+ params = Bybit::Utils::WireKeys.camelize(params)
880
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/settle-profit', body: params)
881
+ end
882
+
883
+ # Invest more funds into an active PWM investment plan.
884
+ #
885
+ # POST /v5/earn/pwm/investment-plan/invest-more
886
+ #
887
+ # @param plan_id [String] Investment plan ID
888
+ # @param category [String] Product category
889
+ # @param product_id [String] Product ID
890
+ # @param amount [String] Investment amount
891
+ # @param order_link_id [String] Client-generated unique order link ID
892
+ # @option kwargs [String] :account_type Source account type
893
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
894
+ def pwm_invest_more(plan_id:, category:, product_id:, amount:, order_link_id:, **kwargs)
895
+ params = kwargs.merge(plan_id: plan_id, category: category, product_id: product_id, amount: amount, order_link_id: order_link_id)
896
+ params = Bybit::Utils::WireKeys.camelize(params)
897
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/investment-plan/invest-more', body: params)
898
+ end
899
+
900
+ # List investment plans for the account.
901
+ #
902
+ # GET /v5/earn/pwm/investment-plan/all
903
+ #
904
+ # @option kwargs [String] :plan_id Investment plan identifier
905
+ # @option kwargs [String] :status Plan status filter
906
+ # @option kwargs [Integer] :limit Result page size
907
+ # @option kwargs [String] :cursor Pagination cursor
908
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
909
+ def pwm_list_investment_plans(**kwargs)
910
+ params = kwargs.dup
911
+ params = Bybit::Utils::WireKeys.camelize(params)
912
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/all', params: params)
913
+ end
914
+
915
+ # List PWM investment plan orders with optional filters.
916
+ #
917
+ # GET /v5/earn/pwm/investment-plan/order
918
+ #
919
+ # @option kwargs [String] :plan_id Investment plan ID
920
+ # @option kwargs [String] :category Product category
921
+ # @option kwargs [String] :type Order type
922
+ # @option kwargs [String] :status Order status
923
+ # @option kwargs [Integer] :start_time Start timestamp (ms)
924
+ # @option kwargs [Integer] :end_time End timestamp (ms)
925
+ # @option kwargs [Integer] :limit Result limit per page
926
+ # @option kwargs [String] :cursor Pagination cursor
927
+ # @option kwargs [String] :order_link_id Client order link ID
928
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
929
+ def pwm_list_order(**kwargs)
930
+ params = kwargs.dup
931
+ params = Bybit::Utils::WireKeys.camelize(params)
932
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/order', params: params)
933
+ end
934
+
935
+ # List available product cards for PWM Direct Mode custom plans.
936
+ #
937
+ # GET /v5/earn/pwm/customize-plan/product
938
+ def pwm_list_product_cards
939
+ @session.public_request(path: '/v5/earn/pwm/customize-plan/product')
940
+ end
941
+
942
+ # Query fund transfer records between custody sub-accounts.
943
+ #
944
+ # GET /v5/earn/pwm/query-fund-transfer-result
945
+ #
946
+ # @option kwargs [String] :transfer_id Client-supplied transfer identifier
947
+ # @option kwargs [Integer] :from_user_id Source sub-account UID
948
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
949
+ def pwm_query_fund_transfer_result(**kwargs)
950
+ params = kwargs.dup
951
+ params = Bybit::Utils::WireKeys.camelize(params)
952
+ @session.sign_request(method: :get, path: '/v5/earn/pwm/query-fund-transfer-result', params: params)
953
+ end
954
+
955
+ # Redeem shares or amount from a PWM investment plan.
956
+ #
957
+ # POST /v5/earn/pwm/investment-plan/redeem
958
+ #
959
+ # @param plan_id [String] Investment plan ID
960
+ # @param category [String] Product category
961
+ # @param product_id [String] Product ID
962
+ # @param order_link_id [String] Client-generated unique order link ID
963
+ # @option kwargs [String] :shares Number of shares to redeem
964
+ # @option kwargs [String] :amount Amount to redeem
965
+ # @option kwargs [Integer] :position_id Position ID
966
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
967
+ def pwm_redeem(plan_id:, category:, product_id:, order_link_id:, **kwargs)
968
+ params = kwargs.merge(plan_id: plan_id, category: category, product_id: product_id, order_link_id: order_link_id)
969
+ params = Bybit::Utils::WireKeys.camelize(params)
970
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/investment-plan/redeem', body: params)
971
+ end
972
+
973
+ # One-click subscribe to a pending PWM investment plan.
974
+ #
975
+ # POST /v5/earn/pwm/investment-plan/subscribe
976
+ #
977
+ # @param plan_id [String] Investment plan ID
978
+ # @param order_link_id [String] Client-generated unique order link ID
979
+ # @option kwargs [String] :account_type Source account type
980
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
981
+ def pwm_subscribe(plan_id:, order_link_id:, **kwargs)
982
+ params = kwargs.merge(plan_id: plan_id, order_link_id: order_link_id)
983
+ params = Bybit::Utils::WireKeys.camelize(params)
984
+ @session.sign_request(method: :post, path: '/v5/earn/pwm/investment-plan/subscribe', body: params)
985
+ end
986
+
987
+ # Redeem a fixed-term earn position.
988
+ #
989
+ # POST /v5/earn/fixed-term/redeem
990
+ #
991
+ # @param product_id [String] Product ID
992
+ # @param category [String] Product category
993
+ # @param position_id [String] Position ID
994
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
995
+ def redeem_fixed_term(product_id:, category:, position_id:, **kwargs)
996
+ params = kwargs.merge(product_id: product_id, category: category, position_id: position_id)
997
+ params = Bybit::Utils::WireKeys.camelize(params)
998
+ @session.sign_request(method: :post, path: '/v5/earn/fixed-term/redeem', body: params)
999
+ end
1000
+
1001
+ # Reinvest Interest for a liquidity mining position.
1002
+ #
1003
+ # POST /v5/earn/liquidity-mining/reinvest
1004
+ #
1005
+ # @param product_id [String] Product ID
1006
+ # @param order_link_id [String] Client order id
1007
+ # @param position_id [String] Position ID
1008
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
1009
+ def reinvest_liquidity(product_id:, order_link_id:, position_id:, **kwargs)
1010
+ params = kwargs.merge(product_id: product_id, order_link_id: order_link_id, position_id: position_id)
1011
+ params = Bybit::Utils::WireKeys.camelize(params)
1012
+ @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/reinvest', body: params)
1013
+ end
1014
+
1015
+ # Remove Liquidity from a liquidity mining position.
1016
+ #
1017
+ # POST /v5/earn/liquidity-mining/remove-liquidity
1018
+ #
1019
+ # @param product_id [String] Product ID
1020
+ # @param order_link_id [String] Client order id
1021
+ # @param position_id [String] Position ID
1022
+ # @option kwargs [Integer] :remove_rate Remove rate percent
1023
+ # @option kwargs [String] :remove_type Remove type
1024
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
1025
+ def remove_liquidity(product_id:, order_link_id:, position_id:, **kwargs)
1026
+ params = kwargs.merge(product_id: product_id, order_link_id: order_link_id, position_id: position_id)
1027
+ params = Bybit::Utils::WireKeys.camelize(params)
1028
+ @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/remove-liquidity', body: params)
1029
+ end
1030
+
1031
+ # Enable or disable auto-invest for a fixed-term earn position.
1032
+ #
1033
+ # POST /v5/earn/fixed-term/position/auto-invest
1034
+ #
1035
+ # @param product_id [String] Product ID
1036
+ # @param category [String] Product category
1037
+ # @param position_id [String] Position ID
1038
+ # @param status [String] Auto-invest status
1039
+ # @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
1040
+ def set_fixed_term_auto_invest(product_id:, category:, position_id:, status:, **kwargs)
1041
+ params = kwargs.merge(product_id: product_id, category: category, position_id: position_id, status: status)
1042
+ params = Bybit::Utils::WireKeys.camelize(params)
1043
+ @session.sign_request(method: :post, path: '/v5/earn/fixed-term/position/auto-invest', body: params)
1044
+ end
1045
+ end
1046
+ end
1047
+ end