Class: Bybit::RestApi::EarnService

Inherits:
BaseService show all
Defined in:
lib/bybit/rest_api/earn_service.rb

Instance Method Summary collapse

Methods inherited from BaseService

#initialize

Constructor Details

This class inherits a constructor from Bybit::RestApi::BaseService

Instance Method Details

#add_liquidity(product_id:, order_link_id:, **kwargs) ⇒ Hash

Add Liquidity to a liquidity mining position.

POST /v5/earn/liquidity-mining/add-liquidity

Parameters:

  • product_id (String)

    Product ID

  • order_link_id (String)

    Client order id

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :quote_account_type (String)

    Quote coin account type

  • :base_account_type (String)

    Base coin account type

  • :quote_amount (String)

    Quote coin amount

  • :base_amount (String)

    Base coin amount

  • :leverage (String)

    Leverage

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



18
19
20
21
22
# File 'lib/bybit/rest_api/earn_service.rb', line 18

def add_liquidity(product_id:, order_link_id:, **kwargs)
  params = kwargs.merge(product_id: product_id, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/add-liquidity', body: params)
end

#add_margin(product_id:, order_link_id:, position_id:, amount:, quote_account_type:, **kwargs) ⇒ Hash

Add Margin to a liquidity mining position.

POST /v5/earn/liquidity-mining/add-margin

Parameters:

  • product_id (String)

    Product ID

  • order_link_id (String)

    Client order id

  • position_id (String)

    Position ID

  • amount (String)

    Margin amount

  • quote_account_type (String)

    Quote coin account type

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



34
35
36
37
38
# File 'lib/bybit/rest_api/earn_service.rb', line 34

def add_margin(product_id:, order_link_id:, position_id:, amount:, quote_account_type:, **kwargs)
  params = kwargs.merge(product_id: product_id, order_link_id: order_link_id, position_id: position_id, amount: amount, quote_account_type: )
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/add-margin', body: params)
end

#claim_liquidity_interest(product_id:, **kwargs) ⇒ Hash

Claim Interest earned on liquidity mining product.

POST /v5/earn/liquidity-mining/claim-interest

Parameters:

  • product_id (String)

    Product ID

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



46
47
48
49
50
# File 'lib/bybit/rest_api/earn_service.rb', line 46

def claim_liquidity_interest(product_id:, **kwargs)
  params = kwargs.merge(product_id: product_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/claim-interest', body: params)
end

#get_advance_earn_order(category:, **kwargs) ⇒ Hash

Get advance earn orders.

GET /v5/earn/advance/order

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :product_id (Integer)

    Product ID

  • :order_id (String)

    Order ID

  • :order_link_id (String)

    User-defined order link ID

  • :start_time (Integer)

    Start timestamp in milliseconds

  • :end_time (Integer)

    End timestamp in milliseconds

  • :limit (Integer)

    Page size limit

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



65
66
67
68
69
# File 'lib/bybit/rest_api/earn_service.rb', line 65

def get_advance_earn_order(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/advance/order', params: params)
end

#get_advance_earn_position(category:, **kwargs) ⇒ Hash

Get advance earn positions.

GET /v5/earn/advance/position

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :product_id (Integer)

    Product ID

  • :coin (String)

    Coin

  • :limit (Integer)

    Page size limit

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



81
82
83
84
85
# File 'lib/bybit/rest_api/earn_service.rb', line 81

def get_advance_earn_position(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/advance/position', params: params)
end

#get_advance_earn_product(category:, **kwargs) ⇒ Hash

Get advance earn product info.

GET /v5/earn/advance/product

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :coin (String)

    Coin

  • :duration (String)

    Product duration

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



95
96
97
98
99
# File 'lib/bybit/rest_api/earn_service.rb', line 95

def get_advance_earn_product(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/advance/product', params: params)
end

#get_advance_earn_product_extra_info(category:, **kwargs) ⇒ Hash

Get advance earn product extra info.

GET /v5/earn/advance/product-extra-info

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :product_id (Integer)

    Product ID

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



108
109
110
111
112
# File 'lib/bybit/rest_api/earn_service.rb', line 108

def get_advance_earn_product_extra_info(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/advance/product-extra-info', params: params)
end

#get_apr_history(category:, product_id:, start_time:, end_time:, **kwargs) ⇒ Hash

Get earn APR history.

GET /v5/earn/apr-history

Parameters:

  • category (String)

    Product category

  • product_id (String)

    Product ID

  • start_time (Integer)

    Start timestamp in milliseconds

  • end_time (Integer)

    End timestamp in milliseconds

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



138
139
140
141
142
# File 'lib/bybit/rest_api/earn_service.rb', line 138

def get_apr_history(category:, product_id:, start_time:, end_time:, **kwargs)
  params = kwargs.merge(category: category, product_id: product_id, start_time: start_time, end_time: end_time)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/apr-history', params: params)
end

#get_double_win_leverage(product_id:, initial_price:, lower_price:, upper_price:, **kwargs) ⇒ Hash

Get double win leverage information.

GET /v5/earn/advance/double-win-leverage

Parameters:

  • product_id (Integer)

    Product ID

  • initial_price (String)

    Initial price

  • lower_price (String)

    Lower price bound

  • upper_price (String)

    Upper price bound

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



123
124
125
126
127
# File 'lib/bybit/rest_api/earn_service.rb', line 123

def get_double_win_leverage(product_id:, initial_price:, lower_price:, upper_price:, **kwargs)
  params = kwargs.merge(product_id: product_id, initial_price: initial_price, lower_price: lower_price, upper_price: upper_price)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/advance/double-win-leverage', params: params)
end

#get_fixed_term_order(**kwargs) ⇒ Hash

Get fixed-term earn order history.

GET /v5/earn/fixed-term/order

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :order_type (String)

    Order type

  • :product_id (String)

    Product ID

  • :category (String)

    Product category

  • :order_id (String)

    Order ID

  • :start_time (Integer)

    Start timestamp in ms

  • :end_time (Integer)

    End timestamp in ms

  • :limit (Integer)

    Result limit per page

  • :cursor (String)

    Cursor for pagination

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



237
238
239
240
241
# File 'lib/bybit/rest_api/earn_service.rb', line 237

def get_fixed_term_order(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/fixed-term/order', params: params)
end

#get_fixed_term_position(**kwargs) ⇒ Hash

Get fixed-term earn positions.

GET /v5/earn/fixed-term/position

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :product_id (String)

    Product ID

  • :category (String)

    Product category

  • :coin (String)

    Coin name

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



251
252
253
254
255
# File 'lib/bybit/rest_api/earn_service.rb', line 251

def get_fixed_term_position(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/fixed-term/position', params: params)
end

#get_fixed_term_product(**kwargs) ⇒ Hash

Get fixed-term earn product list.

GET /v5/earn/fixed-term/product

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :coin (String)

    Coin name

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



263
264
265
266
267
# File 'lib/bybit/rest_api/earn_service.rb', line 263

def get_fixed_term_product(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/fixed-term/product', params: params)
end

#get_hold_to_earn_productObject

Get Hold-to-Earn Product List.

GET /v5/earn/hold-to-earn/product



272
273
274
# File 'lib/bybit/rest_api/earn_service.rb', line 272

def get_hold_to_earn_product
  @session.public_request(path: '/v5/earn/hold-to-earn/product')
end

#get_hold_to_earn_yield_history(limit:, **kwargs) ⇒ Hash

Get Hold-to-Earn Yield History.

GET /v5/earn/hold-to-earn/yield-history

Parameters:

  • limit (Integer)

    Limit for data size per page

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :time_start (Integer)

    Start time in ms

  • :time_end (Integer)

    End time in ms

  • :cursor (String)

    Cursor for pagination

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



285
286
287
288
289
# File 'lib/bybit/rest_api/earn_service.rb', line 285

def get_hold_to_earn_yield_history(limit:, **kwargs)
  params = kwargs.merge(limit: limit)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/hold-to-earn/yield-history', params: params)
end

#get_hourly_yield_history(category:, **kwargs) ⇒ Hash

Get earn hourly yield history.

GET /v5/earn/hourly-yield

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :product_id (String)

    Product ID

  • :start_time (Integer)

    Start timestamp in milliseconds

  • :end_time (Integer)

    End timestamp in milliseconds

  • :limit (Integer)

    Page size limit

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



155
156
157
158
159
# File 'lib/bybit/rest_api/earn_service.rb', line 155

def get_hourly_yield_history(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/hourly-yield', params: params)
end

#get_liquidity_mining_liquidation_records(**kwargs) ⇒ Hash

Get liquidity mining liquidation records with optional filters and pagination.

GET /v5/earn/liquidity-mining/liquidation-records

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :base_coin (String)

    Base coin filter

  • :quote_coin (String)

    Quote coin filter

  • :start_time (Integer)

    Start timestamp in milliseconds

  • :end_time (Integer)

    End timestamp in milliseconds

  • :limit (Integer)

    Result page size

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



302
303
304
305
306
# File 'lib/bybit/rest_api/earn_service.rb', line 302

def get_liquidity_mining_liquidation_records(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/liquidity-mining/liquidation-records', params: params)
end

#get_liquidity_mining_orders(**kwargs) ⇒ Hash

Get Liquidity Mining Order History.

GET /v5/earn/liquidity-mining/order

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :order_id (String)

    Order ID

  • :order_link_id (String)

    Client order id

  • :product_id (String)

    Product ID

  • :order_type (String)

    Order type

  • :status (String)

    Order status

  • :start_time (Integer)

    Start time in ms

  • :end_time (Integer)

    End time in ms

  • :limit (Integer)

    Limit for data size per page

  • :cursor (String)

    Cursor for pagination

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



322
323
324
325
326
# File 'lib/bybit/rest_api/earn_service.rb', line 322

def get_liquidity_mining_orders(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/liquidity-mining/order', params: params)
end

#get_liquidity_mining_positions(**kwargs) ⇒ Hash

Get Liquidity Mining Active Positions.

GET /v5/earn/liquidity-mining/position

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :product_id (String)

    Product ID

  • :base_coin (String)

    Base coin

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



335
336
337
338
339
# File 'lib/bybit/rest_api/earn_service.rb', line 335

def get_liquidity_mining_positions(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/liquidity-mining/position', params: params)
end

#get_liquidity_mining_products(**kwargs) ⇒ Hash

Get Liquidity Mining Product List.

GET /v5/earn/liquidity-mining/product

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :base_coin (String)

    Base coin

  • :quote_coin (String)

    Quote coin

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



348
349
350
351
352
# File 'lib/bybit/rest_api/earn_service.rb', line 348

def get_liquidity_mining_products(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/liquidity-mining/product', params: params)
end

#get_liquidity_mining_yield_records(**kwargs) ⇒ Hash

Get Liquidity Mining Yield Claim Records.

GET /v5/earn/liquidity-mining/yield-records

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :base_coin (String)

    Base coin

  • :quote_coin (String)

    Quote coin

  • :start_time (Integer)

    Start time in ms

  • :end_time (Integer)

    End time in ms

  • :limit (Integer)

    Limit for data size per page

  • :cursor (String)

    Cursor for pagination

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



365
366
367
368
369
# File 'lib/bybit/rest_api/earn_service.rb', line 365

def get_liquidity_mining_yield_records(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/liquidity-mining/yield-records', params: params)
end

#get_order_history(category:, **kwargs) ⇒ Hash

Get stake or redeem order history.

GET /v5/earn/order

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :order_id (String)

    Order ID

  • :order_link_id (String)

    User-defined order link ID

  • :product_id (String)

    Product ID

  • :start_time (Integer)

    Start timestamp in milliseconds

  • :end_time (Integer)

    End timestamp in milliseconds

  • :limit (Integer)

    Page size limit

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



174
175
176
177
178
# File 'lib/bybit/rest_api/earn_service.rb', line 174

def get_order_history(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/order', params: params)
end

#get_position(category:, **kwargs) ⇒ Hash

Get staked positions.

GET /v5/earn/position

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :product_id (String)

    Product ID

  • :coin (String)

    Coin

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



188
189
190
191
192
# File 'lib/bybit/rest_api/earn_service.rb', line 188

def get_position(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/position', params: params)
end

#get_product(category:, **kwargs) ⇒ Hash

Get earn product info.

GET /v5/earn/product

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :coin (String)

    Coin

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



201
202
203
204
205
# File 'lib/bybit/rest_api/earn_service.rb', line 201

def get_product(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/product', params: params)
end

#get_rwa_nav_chart(product_id:, **kwargs) ⇒ Hash

Get RWA NAV Chart.

GET /v5/earn/rwa/nav-chart

Parameters:

  • product_id (Integer)

    Product ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :start_time (Integer)

    Start time in ms

  • :end_time (Integer)

    End time in ms

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



379
380
381
382
383
# File 'lib/bybit/rest_api/earn_service.rb', line 379

def get_rwa_nav_chart(product_id:, **kwargs)
  params = kwargs.merge(product_id: product_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/rwa/nav-chart', params: params)
end

#get_rwa_order_list(**kwargs) ⇒ Hash

Get RWA Order List.

GET /v5/earn/rwa/order

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :order_id (String)

    Order ID

  • :order_link_id (String)

    Client order id

  • :order_type (String)

    Order type: Stake / Redeem

  • :product_id (Integer)

    Product ID

  • :start_time (Integer)

    Start time in ms

  • :end_time (Integer)

    End time in ms

  • :limit (Integer)

    Limit for data size per page

  • :cursor (String)

    Cursor for pagination

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



398
399
400
401
402
# File 'lib/bybit/rest_api/earn_service.rb', line 398

def get_rwa_order_list(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/rwa/order', params: params)
end

#get_rwa_position_listObject

Get RWA Position List.

GET /v5/earn/rwa/position



407
408
409
# File 'lib/bybit/rest_api/earn_service.rb', line 407

def get_rwa_position_list
  @session.sign_request(method: :get, path: '/v5/earn/rwa/position')
end

#get_rwa_product_list(**kwargs) ⇒ Hash

Get RWA earn product list.

GET /v5/earn/rwa/product

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :coin (String)

    Coin name

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



417
418
419
420
421
# File 'lib/bybit/rest_api/earn_service.rb', line 417

def get_rwa_product_list(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/rwa/product', params: params)
end

#get_smart_leverage_redeem_est_amount_list(category:, position_ids:, **kwargs) ⇒ Hash

Get smart leverage redeem estimation amount list.

GET /v5/earn/advance/get-redeem-est-amount-list

Parameters:

  • category (String)

    Product category

  • position_ids (String)

    Position IDs

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



430
431
432
433
434
# File 'lib/bybit/rest_api/earn_service.rb', line 430

def get_smart_leverage_redeem_est_amount_list(category:, position_ids:, **kwargs)
  params = kwargs.merge(category: category, position_ids: position_ids)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/advance/get-redeem-est-amount-list', params: params)
end

#get_token_daily_yield(coin:, **kwargs) ⇒ Hash

Get daily yield records for a token earn position.

GET /v5/earn/token/yield

Parameters:

  • coin (String)

    Coin name

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :start_time (Integer)

    Start timestamp in ms

  • :end_time (Integer)

    End timestamp in ms

  • :cursor (String)

    Cursor for pagination

  • :limit (Integer)

    Result limit per page

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



446
447
448
449
450
# File 'lib/bybit/rest_api/earn_service.rb', line 446

def get_token_daily_yield(coin:, **kwargs)
  params = kwargs.merge(coin: coin)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/token/yield', params: params)
end

#get_token_historical_apr(coin:, range:, **kwargs) ⇒ Hash

Get historical APR for a token earn product.

GET /v5/earn/token/history-apr

Parameters:

  • coin (String)

    Coin name

  • range (Integer)

    Range window for APR history

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



459
460
461
462
463
# File 'lib/bybit/rest_api/earn_service.rb', line 459

def get_token_historical_apr(coin:, range:, **kwargs)
  params = kwargs.merge(coin: coin, range: range)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/token/history-apr', params: params)
end

#get_token_hourly_yield(coin:, **kwargs) ⇒ Hash

Get hourly yield records for a token earn position.

GET /v5/earn/token/hourly-yield

Parameters:

  • coin (String)

    Coin name

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :start_time (Integer)

    Start timestamp in ms

  • :end_time (Integer)

    End timestamp in ms

  • :cursor (String)

    Cursor for pagination

  • :limit (Integer)

    Result limit per page

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



475
476
477
478
479
# File 'lib/bybit/rest_api/earn_service.rb', line 475

def get_token_hourly_yield(coin:, **kwargs)
  params = kwargs.merge(coin: coin)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/token/hourly-yield', params: params)
end

#get_token_order_list(coin:, **kwargs) ⇒ Hash

Query token earn order history.

GET /v5/earn/token/order

Parameters:

  • coin (String)

    Coin name

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :order_link_id (String)

    Client-supplied order link ID

  • :order_id (String)

    Order ID

  • :order_type (String)

    Order type (mint or redeem)

  • :start_time (Integer)

    Start timestamp in ms

  • :end_time (Integer)

    End timestamp in ms

  • :cursor (String)

    Cursor for pagination

  • :limit (Integer)

    Result limit per page

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



494
495
496
497
498
# File 'lib/bybit/rest_api/earn_service.rb', line 494

def get_token_order_list(coin:, **kwargs)
  params = kwargs.merge(coin: coin)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/token/order', params: params)
end

#get_token_position(coin:, **kwargs) ⇒ Hash

Get current token earn position for a coin.

GET /v5/earn/token/position

Parameters:

  • coin (String)

    Coin name

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



506
507
508
509
510
# File 'lib/bybit/rest_api/earn_service.rb', line 506

def get_token_position(coin:, **kwargs)
  params = kwargs.merge(coin: coin)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/token/position', params: params)
end

#get_token_product(coin:, **kwargs) ⇒ Hash

Get info for a token earn product.

GET /v5/earn/token/product

Parameters:

  • coin (String)

    Coin name

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



518
519
520
521
522
# File 'lib/bybit/rest_api/earn_service.rb', line 518

def get_token_product(coin:, **kwargs)
  params = kwargs.merge(coin: coin)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.public_request(path: '/v5/earn/token/product', params: params)
end

#get_yield_history(category:, **kwargs) ⇒ Hash

Get earn yield history.

GET /v5/earn/yield

Parameters:

  • category (String)

    Product category

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :product_id (Integer)

    Product ID

  • :start_time (Integer)

    Start timestamp in milliseconds

  • :end_time (Integer)

    End timestamp in milliseconds

  • :limit (Integer)

    Page size limit

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



218
219
220
221
222
# File 'lib/bybit/rest_api/earn_service.rb', line 218

def get_yield_history(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/yield', params: params)
end

#list_coupons(category:, **kwargs) ⇒ Hash

List available earn coupons for the given category.

GET /v5/earn/coupons

Parameters:

  • category (String)

    Product category

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



530
531
532
533
534
# File 'lib/bybit/rest_api/earn_service.rb', line 530

def list_coupons(category:, **kwargs)
  params = kwargs.merge(category: category)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/coupons', params: params)
end

#modify_earn_position(category:, product_id:, position_id:, auto_reinvest:, **kwargs) ⇒ Hash

Modify an earn position.

POST /v5/earn/position/modify

Parameters:

  • category (String)

    Product category

  • product_id (Integer)

    Product ID

  • position_id (Integer)

    Position ID

  • auto_reinvest (Integer)

    Auto-reinvest flag

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



545
546
547
548
549
# File 'lib/bybit/rest_api/earn_service.rb', line 545

def modify_earn_position(category:, product_id:, position_id:, auto_reinvest:, **kwargs)
  params = kwargs.merge(category: category, product_id: product_id, position_id: position_id, auto_reinvest: auto_reinvest)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/position/modify', body: params)
end

#place_advance_earn_order(category:, product_id:, order_type:, amount:, account_type:, coin:, order_link_id:, **kwargs) ⇒ Hash

Place an advance earn order.

POST /v5/earn/advance/place-order

Parameters:

  • category (String)

    Product category

  • product_id (Integer)

    Product ID

  • order_type (String)

    Order type

  • amount (String)

    Order amount

  • account_type (String)

    Account type

  • coin (String)

    Coin

  • order_link_id (String)

    User-defined order link ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :dual_assets_extra (Hash)

    Dual assets extra info

  • :interest_card (Hash)

    Interest card info

  • :smart_leverage_stake_extra (Hash)

    Smart leverage stake extra info

  • :smart_leverage_redeem_extra (Hash)

    Smart leverage redeem extra info

  • :double_win_stake_extra (Hash)

    Double win stake extra info

  • :double_win_redeem_extra (Hash)

    Double win redeem extra info

  • :discount_buy_extra (Hash)

    Discount buy extra info

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



570
571
572
573
574
# File 'lib/bybit/rest_api/earn_service.rb', line 570

def place_advance_earn_order(category:, product_id:, order_type:, amount:, account_type:, coin:, order_link_id:, **kwargs)
  params = kwargs.merge(category: category, product_id: product_id, order_type: order_type, amount: amount, account_type: , coin: coin, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/advance/place-order', body: params)
end

#place_fixed_term_order(product_id:, category:, coin:, amount:, account_type:, order_link_id:, **kwargs) ⇒ Hash

Place a fixed-term earn order.

POST /v5/earn/fixed-term/place-order

Parameters:

  • product_id (String)

    Product ID

  • category (String)

    Product category

  • coin (String)

    Coin name

  • amount (String)

    Order amount

  • account_type (String)

    Account type

  • order_link_id (String)

    Client-supplied order link ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :auto_invest (Boolean)

    Whether to enable auto-invest

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



609
610
611
612
613
# File 'lib/bybit/rest_api/earn_service.rb', line 609

def place_fixed_term_order(product_id:, category:, coin:, amount:, account_type:, order_link_id:, **kwargs)
  params = kwargs.merge(product_id: product_id, category: category, coin: coin, amount: amount, account_type: , order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/fixed-term/place-order', body: params)
end

#place_order(category:, order_type:, account_type:, amount:, coin:, product_id:, order_link_id:, **kwargs) ⇒ Hash

Stake or redeem an earn order.

POST /v5/earn/place-order

Parameters:

  • category (String)

    Product category

  • order_type (String)

    Order type: Stake or Redeem

  • account_type (String)

    Account type

  • amount (String)

    Order amount

  • coin (String)

    Coin

  • product_id (String)

    Product ID

  • order_link_id (String)

    User-defined order link ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :redeem_position_id (String)

    Redeem position ID

  • :to_account_type (String)

    Destination account type

  • :interest_card (Hash)

    Interest card info

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



591
592
593
594
595
# File 'lib/bybit/rest_api/earn_service.rb', line 591

def place_order(category:, order_type:, account_type:, amount:, coin:, product_id:, order_link_id:, **kwargs)
  params = kwargs.merge(category: category, order_type: order_type, account_type: , amount: amount, coin: coin, product_id: product_id, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/place-order', body: params)
end

#place_rwa_order(product_id:, order_type:, coin:, order_link_id:, **kwargs) ⇒ Hash

Place Order (Stake / Redeem) for RWA earn products.

POST /v5/earn/rwa/place-order

Parameters:

  • product_id (Integer)

    Product ID

  • order_type (String)

    Order type: Stake / Redeem

  • coin (String)

    Coin name

  • order_link_id (String)

    Client order id

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :stake_amount (String)

    Stake amount, required when orderType is Stake

  • :redeem_shares (String)

    Redeem shares, required when orderType is Redeem

  • :account_type (String)

    Account type

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



627
628
629
630
631
# File 'lib/bybit/rest_api/earn_service.rb', line 627

def place_rwa_order(product_id:, order_type:, coin:, order_link_id:, **kwargs)
  params = kwargs.merge(product_id: product_id, order_type: order_type, coin: coin, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/rwa/place-order', body: params)
end

#place_token_order(coin:, order_link_id:, order_type:, amount:, account_type:, **kwargs) ⇒ Hash

Place a mint or redeem order for a token earn product.

POST /v5/earn/token/place-order

Parameters:

  • coin (String)

    Coin name

  • order_link_id (String)

    Client-supplied order link ID

  • order_type (String)

    Order type (mint or redeem)

  • amount (String)

    Order amount

  • account_type (String)

    Account type

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



643
644
645
646
647
# File 'lib/bybit/rest_api/earn_service.rb', line 643

def place_token_order(coin:, order_link_id:, order_type:, amount:, account_type:, **kwargs)
  params = kwargs.merge(coin: coin, order_link_id: order_link_id, order_type: order_type, amount: amount, account_type: )
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/token/place-order', body: params)
end

#pwm_asset_trend(plan_id:, **kwargs) ⇒ Hash

Get PWM investment plan asset trend over time.

GET /v5/earn/pwm/investment-plan/asset-trend

Parameters:

  • plan_id (String)

    Investment plan ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :start_time (Integer)

    Start timestamp (ms)

  • :end_time (Integer)

    End timestamp (ms)

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



657
658
659
660
661
# File 'lib/bybit/rest_api/earn_service.rb', line 657

def pwm_asset_trend(plan_id:, **kwargs)
  params = kwargs.merge(plan_id: plan_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/asset-trend', params: params)
end

#pwm_claim(plan_id:, order_link_id:, **kwargs) ⇒ Hash

Claim available funds from a PWM investment plan.

POST /v5/earn/pwm/investment-plan/claim

Parameters:

  • plan_id (String)

    Investment plan ID

  • order_link_id (String)

    Client-generated unique order link ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :to_account_type (String)

    Destination account type

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



671
672
673
674
675
# File 'lib/bybit/rest_api/earn_service.rb', line 671

def pwm_claim(plan_id:, order_link_id:, **kwargs)
  params = kwargs.merge(plan_id: plan_id, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/investment-plan/claim', body: params)
end

#pwm_create_custom_plan(products:, order_link_id:, **kwargs) ⇒ Hash

Create a custom PWM investment plan in Direct Mode.

POST /v5/earn/pwm/customize-plan/create

Parameters:

  • products (Array)

    List of products to include in the plan

  • order_link_id (String)

    Client-generated unique order link ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :account_type (String)

    Source account type

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



685
686
687
688
689
# File 'lib/bybit/rest_api/earn_service.rb', line 685

def pwm_create_custom_plan(products:, order_link_id:, **kwargs)
  params = kwargs.merge(products: products, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/customize-plan/create', body: params)
end

#pwm_fund_nav(fund_id:, **kwargs) ⇒ Hash

Get historical NAV data for a PWM fund.

GET /v5/earn/pwm/investment-plan/fund-nav

Parameters:

  • fund_id (String)

    Fund ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :start_time (Integer)

    Start timestamp (ms)

  • :end_time (Integer)

    End timestamp (ms)

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



699
700
701
702
703
# File 'lib/bybit/rest_api/earn_service.rb', line 699

def pwm_fund_nav(fund_id:, **kwargs)
  params = kwargs.merge(fund_id: fund_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/fund-nav', params: params)
end

#pwm_fund_transfer(transfer_id:, from_user_id:, to_user_id:, amount:, coin:, **kwargs) ⇒ Hash

Transfer funds between custody sub-accounts.

POST /v5/earn/pwm/fund-transfer

Parameters:

  • transfer_id (String)

    Client-supplied transfer identifier

  • from_user_id (Integer)

    Source sub-account UID

  • to_user_id (Integer)

    Destination sub-account UID

  • amount (String)

    Transfer amount

  • coin (String)

    Coin symbol

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



715
716
717
718
719
# File 'lib/bybit/rest_api/earn_service.rb', line 715

def pwm_fund_transfer(transfer_id:, from_user_id:, to_user_id:, amount:, coin:, **kwargs)
  params = kwargs.merge(transfer_id: transfer_id, from_user_id: from_user_id, to_user_id: to_user_id, amount: amount, coin: coin)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/fund-transfer', body: params)
end

#pwm_get_new_plan_detail(plan_id:, **kwargs) ⇒ Hash

Get the detail of a pending-subscription investment plan.

GET /v5/earn/pwm/investment-plan/new-plan

Parameters:

  • plan_id (String)

    Investment plan identifier

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



727
728
729
730
731
# File 'lib/bybit/rest_api/earn_service.rb', line 727

def pwm_get_new_plan_detail(plan_id:, **kwargs)
  params = kwargs.merge(plan_id: plan_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/new-plan', params: params)
end

#pwm_get_plan_detail(plan_id:, **kwargs) ⇒ Hash

Get the detail of an active or closed investment plan.

GET /v5/earn/pwm/investment-plan/detail

Parameters:

  • plan_id (String)

    Investment plan identifier

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



739
740
741
742
743
# File 'lib/bybit/rest_api/earn_service.rb', line 739

def pwm_get_plan_detail(plan_id:, **kwargs)
  params = kwargs.merge(plan_id: plan_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/detail', params: params)
end

#pwm_inst_create_fund(fund_name:, coin:, profit_share_rate:, management_fee_rate:, req_link_id:, **kwargs) ⇒ Hash

Create a pending-subscription fund for the institution.

POST /v5/earn/pwm/asset-manager/create-fund

Parameters:

  • fund_name (String)

    Fund display name

  • coin (String)

    Base coin of the fund

  • profit_share_rate (String)

    Profit share rate

  • management_fee_rate (String)

    Management fee rate

  • req_link_id (String)

    Client-supplied idempotency key

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :fund_introduction (String)

    Fund introduction text

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



756
757
758
759
760
# File 'lib/bybit/rest_api/earn_service.rb', line 756

def pwm_inst_create_fund(fund_name:, coin:, profit_share_rate:, management_fee_rate:, req_link_id:, **kwargs)
  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)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/create-fund', body: params)
end

#pwm_inst_create_investment_plan(account_uid:, plan_name:, plan_type:, investment_distribution:, req_link_id:, **kwargs) ⇒ Hash

Create an investment plan for a client account.

POST /v5/earn/pwm/asset-manager/create-investment-plan

Parameters:

  • account_uid (String)

    Client account UID

  • plan_name (String)

    Investment plan name

  • plan_type (String)

    Investment plan type

  • investment_distribution (Array)

    Fund allocation distribution

  • req_link_id (String)

    Client-supplied idempotency key

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



772
773
774
775
776
# File 'lib/bybit/rest_api/earn_service.rb', line 772

def pwm_inst_create_investment_plan(account_uid:, plan_name:, plan_type:, investment_distribution:, req_link_id:, **kwargs)
  params = kwargs.merge(account_uid: , plan_name: plan_name, plan_type: plan_type, investment_distribution: investment_distribution, req_link_id: req_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/create-investment-plan', body: params)
end

#pwm_inst_create_sub_account(fund_id:, req_link_id:, **kwargs) ⇒ Hash

Create a fund custody sub-account.

POST /v5/earn/pwm/asset-manager/create-sub-account

Parameters:

  • fund_id (String)

    Fund identifier

  • req_link_id (String)

    Client-supplied idempotency key

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



785
786
787
788
789
# File 'lib/bybit/rest_api/earn_service.rb', line 785

def (fund_id:, req_link_id:, **kwargs)
  params = kwargs.merge(fund_id: fund_id, req_link_id: req_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/create-sub-account', body: params)
end

#pwm_inst_get_investment_plans(**kwargs) ⇒ Hash

Query the institution's investment plans with optional filters.

GET /v5/earn/pwm/asset-manager/get-investment-plan

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :plan_id (String)

    Investment plan identifier

  • :status (String)

    Plan status filter

  • :subscription_uid (String)

    Subscription account UID

  • :limit (Integer)

    Result page size

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



801
802
803
804
805
# File 'lib/bybit/rest_api/earn_service.rb', line 801

def pwm_inst_get_investment_plans(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/asset-manager/get-investment-plan', params: params)
end

#pwm_inst_list_funds(**kwargs) ⇒ Hash

Query the institution's managed funds with optional filters.

GET /v5/earn/pwm/asset-manager/all-funds

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :fund_id (String)

    Fund identifier

  • :coin (String)

    Coin filter

  • :status (String)

    Fund status filter

  • :limit (Integer)

    Result page size

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



817
818
819
820
821
# File 'lib/bybit/rest_api/earn_service.rb', line 817

def pwm_inst_list_funds(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/asset-manager/all-funds', params: params)
end

#pwm_inst_list_orders(**kwargs) ⇒ Hash

Query fund subscription and redemption orders.

GET /v5/earn/pwm/asset-manager/all-order

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :fund_id (String)

    Fund identifier

  • :order_type (String)

    Order type filter

  • :status (String)

    Order status filter

  • :start_time (Integer)

    Start timestamp in milliseconds

  • :end_time (Integer)

    End timestamp in milliseconds

  • :limit (Integer)

    Result page size

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



835
836
837
838
839
# File 'lib/bybit/rest_api/earn_service.rb', line 835

def pwm_inst_list_orders(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/asset-manager/all-order', params: params)
end

#pwm_inst_manage_investment_plan(plan_id:, req_link_id:, **kwargs) ⇒ Hash

Update the status and fund allocation of an investment plan.

POST /v5/earn/pwm/asset-manager/manage-investment-plan

Parameters:

  • plan_id (String)

    Investment plan identifier

  • req_link_id (String)

    Client-supplied idempotency key

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :update_status (String)

    New plan status

  • :update_funds (Array)

    Updated fund allocation

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



850
851
852
853
854
# File 'lib/bybit/rest_api/earn_service.rb', line 850

def pwm_inst_manage_investment_plan(plan_id:, req_link_id:, **kwargs)
  params = kwargs.merge(plan_id: plan_id, req_link_id: req_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/manage-investment-plan', body: params)
end

#pwm_inst_manage_order(order_id:, action:, req_link_id:, **kwargs) ⇒ Hash

Approve or reject a fund subscription or redemption order.

POST /v5/earn/pwm/asset-manager/manage-order

Parameters:

  • order_id (String)

    Order identifier

  • action (String)

    Approve or reject action

  • req_link_id (String)

    Client-supplied idempotency key

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



864
865
866
867
868
# File 'lib/bybit/rest_api/earn_service.rb', line 864

def pwm_inst_manage_order(order_id:, action:, req_link_id:, **kwargs)
  params = kwargs.merge(order_id: order_id, action: action, req_link_id: req_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/manage-order', body: params)
end

#pwm_inst_settle_profit(fund_id:, req_link_id:, **kwargs) ⇒ Hash

Execute profit settlement for the specified fund.

POST /v5/earn/pwm/asset-manager/settle-profit

Parameters:

  • fund_id (String)

    Fund identifier

  • req_link_id (String)

    Client-supplied idempotency key

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



877
878
879
880
881
# File 'lib/bybit/rest_api/earn_service.rb', line 877

def pwm_inst_settle_profit(fund_id:, req_link_id:, **kwargs)
  params = kwargs.merge(fund_id: fund_id, req_link_id: req_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/asset-manager/settle-profit', body: params)
end

#pwm_invest_more(plan_id:, category:, product_id:, amount:, order_link_id:, **kwargs) ⇒ Hash

Invest more funds into an active PWM investment plan.

POST /v5/earn/pwm/investment-plan/invest-more

Parameters:

  • plan_id (String)

    Investment plan ID

  • category (String)

    Product category

  • product_id (String)

    Product ID

  • amount (String)

    Investment amount

  • order_link_id (String)

    Client-generated unique order link ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :account_type (String)

    Source account type

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



894
895
896
897
898
# File 'lib/bybit/rest_api/earn_service.rb', line 894

def pwm_invest_more(plan_id:, category:, product_id:, amount:, order_link_id:, **kwargs)
  params = kwargs.merge(plan_id: plan_id, category: category, product_id: product_id, amount: amount, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/investment-plan/invest-more', body: params)
end

#pwm_list_investment_plans(**kwargs) ⇒ Hash

List investment plans for the account.

GET /v5/earn/pwm/investment-plan/all

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :plan_id (String)

    Investment plan identifier

  • :status (String)

    Plan status filter

  • :limit (Integer)

    Result page size

  • :cursor (String)

    Pagination cursor

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



909
910
911
912
913
# File 'lib/bybit/rest_api/earn_service.rb', line 909

def pwm_list_investment_plans(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/all', params: params)
end

#pwm_list_order(**kwargs) ⇒ Hash

List PWM investment plan orders with optional filters.

GET /v5/earn/pwm/investment-plan/order

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :plan_id (String)

    Investment plan ID

  • :category (String)

    Product category

  • :type (String)

    Order type

  • :status (String)

    Order status

  • :start_time (Integer)

    Start timestamp (ms)

  • :end_time (Integer)

    End timestamp (ms)

  • :limit (Integer)

    Result limit per page

  • :cursor (String)

    Pagination cursor

  • :order_link_id (String)

    Client order link ID

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



929
930
931
932
933
# File 'lib/bybit/rest_api/earn_service.rb', line 929

def pwm_list_order(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/investment-plan/order', params: params)
end

#pwm_list_product_cardsObject

List available product cards for PWM Direct Mode custom plans.

GET /v5/earn/pwm/customize-plan/product



938
939
940
# File 'lib/bybit/rest_api/earn_service.rb', line 938

def pwm_list_product_cards
  @session.public_request(path: '/v5/earn/pwm/customize-plan/product')
end

#pwm_query_fund_transfer_result(**kwargs) ⇒ Hash

Query fund transfer records between custody sub-accounts.

GET /v5/earn/pwm/query-fund-transfer-result

Parameters:

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :transfer_id (String)

    Client-supplied transfer identifier

  • :from_user_id (Integer)

    Source sub-account UID

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



949
950
951
952
953
# File 'lib/bybit/rest_api/earn_service.rb', line 949

def pwm_query_fund_transfer_result(**kwargs)
  params = kwargs.dup
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :get, path: '/v5/earn/pwm/query-fund-transfer-result', params: params)
end

#pwm_redeem(plan_id:, category:, product_id:, order_link_id:, **kwargs) ⇒ Hash

Redeem shares or amount from a PWM investment plan.

POST /v5/earn/pwm/investment-plan/redeem

Parameters:

  • plan_id (String)

    Investment plan ID

  • category (String)

    Product category

  • product_id (String)

    Product ID

  • order_link_id (String)

    Client-generated unique order link ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :shares (String)

    Number of shares to redeem

  • :amount (String)

    Amount to redeem

  • :position_id (Integer)

    Position ID

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



967
968
969
970
971
# File 'lib/bybit/rest_api/earn_service.rb', line 967

def pwm_redeem(plan_id:, category:, product_id:, order_link_id:, **kwargs)
  params = kwargs.merge(plan_id: plan_id, category: category, product_id: product_id, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/investment-plan/redeem', body: params)
end

#pwm_subscribe(plan_id:, order_link_id:, **kwargs) ⇒ Hash

One-click subscribe to a pending PWM investment plan.

POST /v5/earn/pwm/investment-plan/subscribe

Parameters:

  • plan_id (String)

    Investment plan ID

  • order_link_id (String)

    Client-generated unique order link ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :account_type (String)

    Source account type

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



981
982
983
984
985
# File 'lib/bybit/rest_api/earn_service.rb', line 981

def pwm_subscribe(plan_id:, order_link_id:, **kwargs)
  params = kwargs.merge(plan_id: plan_id, order_link_id: order_link_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/pwm/investment-plan/subscribe', body: params)
end

#redeem_fixed_term(product_id:, category:, position_id:, **kwargs) ⇒ Hash

Redeem a fixed-term earn position.

POST /v5/earn/fixed-term/redeem

Parameters:

  • product_id (String)

    Product ID

  • category (String)

    Product category

  • position_id (String)

    Position ID

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



995
996
997
998
999
# File 'lib/bybit/rest_api/earn_service.rb', line 995

def redeem_fixed_term(product_id:, category:, position_id:, **kwargs)
  params = kwargs.merge(product_id: product_id, category: category, position_id: position_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/fixed-term/redeem', body: params)
end

#reinvest_liquidity(product_id:, order_link_id:, position_id:, **kwargs) ⇒ Hash

Reinvest Interest for a liquidity mining position.

POST /v5/earn/liquidity-mining/reinvest

Parameters:

  • product_id (String)

    Product ID

  • order_link_id (String)

    Client order id

  • position_id (String)

    Position ID

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



1009
1010
1011
1012
1013
# File 'lib/bybit/rest_api/earn_service.rb', line 1009

def reinvest_liquidity(product_id:, order_link_id:, position_id:, **kwargs)
  params = kwargs.merge(product_id: product_id, order_link_id: order_link_id, position_id: position_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/reinvest', body: params)
end

#remove_liquidity(product_id:, order_link_id:, position_id:, **kwargs) ⇒ Hash

Remove Liquidity from a liquidity mining position.

POST /v5/earn/liquidity-mining/remove-liquidity

Parameters:

  • product_id (String)

    Product ID

  • order_link_id (String)

    Client order id

  • position_id (String)

    Position ID

  • kwargs (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :remove_rate (Integer)

    Remove rate percent

  • :remove_type (String)

    Remove type

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



1025
1026
1027
1028
1029
# File 'lib/bybit/rest_api/earn_service.rb', line 1025

def remove_liquidity(product_id:, order_link_id:, position_id:, **kwargs)
  params = kwargs.merge(product_id: product_id, order_link_id: order_link_id, position_id: position_id)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/liquidity-mining/remove-liquidity', body: params)
end

#set_fixed_term_auto_invest(product_id:, category:, position_id:, status:, **kwargs) ⇒ Hash

Enable or disable auto-invest for a fixed-term earn position.

POST /v5/earn/fixed-term/position/auto-invest

Parameters:

  • product_id (String)

    Product ID

  • category (String)

    Product category

  • position_id (String)

    Position ID

  • status (String)

    Auto-invest status

Returns:

  • (Hash)

    Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).



1040
1041
1042
1043
1044
# File 'lib/bybit/rest_api/earn_service.rb', line 1040

def set_fixed_term_auto_invest(product_id:, category:, position_id:, status:, **kwargs)
  params = kwargs.merge(product_id: product_id, category: category, position_id: position_id, status: status)
  params = Bybit::Utils::WireKeys.camelize(params)
  @session.sign_request(method: :post, path: '/v5/earn/fixed-term/position/auto-invest', body: params)
end