bybit-connector-ruby 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +128 -0
- data/README.md +10 -0
- data/lib/bybit/client.rb +41 -20
- data/lib/bybit/rest_api/account_service.rb +50 -0
- data/lib/bybit/rest_api/alpha_service.rb +545 -0
- data/lib/bybit/rest_api/asset_service.rb +17 -0
- data/lib/bybit/rest_api/crypto_loan_service.rb +60 -0
- data/lib/bybit/rest_api/earn_service.rb +31 -0
- data/lib/bybit/rest_api/event_service.rb +92 -0
- data/lib/bybit/rest_api/fiat_service.rb +110 -0
- data/lib/bybit/rest_api/institutional_loan_service.rb +23 -1
- data/lib/bybit/rest_api/market_service.rb +17 -0
- data/lib/bybit/rest_api/position_service.rb +15 -0
- data/lib/bybit/rest_api/referral_service.rb +61 -0
- data/lib/bybit/rest_api/spot_margin_service.rb +258 -0
- data/lib/bybit/rest_api/spot_x_service.rb +142 -0
- data/lib/bybit/rest_api/spread_trade_service.rb +202 -0
- data/lib/bybit/rest_api/strategy_service.rb +105 -0
- data/lib/bybit/rest_api/tax_service.rb +37 -0
- data/lib/bybit/rest_api/user_service.rb +10 -0
- data/lib/bybit/session.rb +5 -4
- data/lib/bybit/version.rb +1 -1
- metadata +11 -3
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bybit
|
|
4
|
+
module RestApi
|
|
5
|
+
class AlphaService < BaseService
|
|
6
|
+
# Get LP order history with status and execution details
|
|
7
|
+
#
|
|
8
|
+
# POST /v5/alpha/lp/order-list
|
|
9
|
+
#
|
|
10
|
+
# @option kwargs [Integer] :order_type Filter by order type.
|
|
11
|
+
# - `0`: All (default)
|
|
12
|
+
# - `1`: Stake
|
|
13
|
+
# - `2`: Redeem
|
|
14
|
+
# @option kwargs [String] :token_code Filter by token code.
|
|
15
|
+
# @option kwargs [Array] :order_status Filter by order status (multiple values allowed).
|
|
16
|
+
# - `1`: Processing
|
|
17
|
+
# - `2`: Success
|
|
18
|
+
# - `3`: Failed
|
|
19
|
+
# @option kwargs [Integer] :days Query last N days.
|
|
20
|
+
# @option kwargs [Integer] :limit Results per page.
|
|
21
|
+
# @option kwargs [Integer] :page_index Page number (1-based).
|
|
22
|
+
# @option kwargs [String] :pool_address Filter by pool address.
|
|
23
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
24
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/lp/order-list
|
|
25
|
+
def get_lp_order_list(**kwargs)
|
|
26
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
27
|
+
@session.sign_request(method: :post, path: '/v5/alpha/lp/order-list', body: params)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Get list of supported payment tokens
|
|
31
|
+
#
|
|
32
|
+
# POST /v5/alpha/lp/pay-token-list
|
|
33
|
+
#
|
|
34
|
+
# @option kwargs [String] :chain_code Optional - filter by blockchain identifier.
|
|
35
|
+
# @option kwargs [String] :token_address Optional - filter by token contract address.
|
|
36
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
37
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/lp/pay-token-list
|
|
38
|
+
def get_lp_pay_token_list(**kwargs)
|
|
39
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
40
|
+
@session.sign_request(method: :post, path: '/v5/alpha/lp/pay-token-list', body: params)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Get current prices for payment tokens
|
|
44
|
+
#
|
|
45
|
+
# POST /v5/alpha/lp/pay-token-price
|
|
46
|
+
#
|
|
47
|
+
# @param token_code [Array] Array of token codes to query (e.g., ["CEX_1", "CEX_2"]).
|
|
48
|
+
# @option kwargs [String] :chain_code Optional - filter by blockchain.
|
|
49
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
50
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/lp/pay-token-price
|
|
51
|
+
def get_lp_pay_token_price(token_code:, **kwargs)
|
|
52
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(tokenCode: token_code))
|
|
53
|
+
@session.sign_request(method: :post, path: '/v5/alpha/lp/pay-token-price', body: params)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Get detailed information for a specific LP pool
|
|
57
|
+
#
|
|
58
|
+
# POST /v5/alpha/lp/pool-info
|
|
59
|
+
#
|
|
60
|
+
# @param pool_address [String] Pool contract address (from getLPPoolList).
|
|
61
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
62
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/lp/pool-info
|
|
63
|
+
def get_lp_pool_info(pool_address:)
|
|
64
|
+
params = Bybit::Utils::WireKeys.camelize({ poolAddress: pool_address })
|
|
65
|
+
@session.sign_request(method: :post, path: '/v5/alpha/lp/pool-info', body: params)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Get LP pool list with optional filters
|
|
69
|
+
#
|
|
70
|
+
# POST /v5/alpha/lp/pool-list
|
|
71
|
+
#
|
|
72
|
+
# @option kwargs [String] :token_symbol Search pools containing this token symbol (e.g., "ETH", "USDC").
|
|
73
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
74
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/lp/pool-list
|
|
75
|
+
def get_lp_pool_list(**kwargs)
|
|
76
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
77
|
+
@session.sign_request(method: :post, path: '/v5/alpha/lp/pool-list', body: params)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Get user's LP positions with rewards and current value
|
|
81
|
+
#
|
|
82
|
+
# POST /v5/alpha/lp/position-list
|
|
83
|
+
#
|
|
84
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
85
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/lp/position-list
|
|
86
|
+
def get_lp_position_list
|
|
87
|
+
@session.sign_request(method: :post, path: '/v5/alpha/lp/position-list')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Redeem (withdraw) liquidity from a position
|
|
91
|
+
#
|
|
92
|
+
# POST /v5/alpha/lp/redeem
|
|
93
|
+
#
|
|
94
|
+
# @param position_id [Integer] Position ID (from getLPPositionList).
|
|
95
|
+
# @param pool_address [String] Pool contract address.
|
|
96
|
+
# @param derc_ratio [String] Reduction ratio (0-1).
|
|
97
|
+
# - "0.25" = redeem 25%
|
|
98
|
+
# - "0.5" = redeem 50%
|
|
99
|
+
# - "1" = close entire position (redeem 100%)
|
|
100
|
+
# @option kwargs [String] :receive_token_code Token code for receiving the redeemed amount.
|
|
101
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
102
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/lp/redeem
|
|
103
|
+
def execute_lp_redeem(position_id:, pool_address:, derc_ratio:, **kwargs)
|
|
104
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(positionId: position_id, poolAddress: pool_address, dercRatio: derc_ratio))
|
|
105
|
+
@session.sign_request(method: :post, path: '/v5/alpha/lp/redeem', body: params)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Stake tokens into an LP pool
|
|
109
|
+
#
|
|
110
|
+
# POST /v5/alpha/lp/stake
|
|
111
|
+
#
|
|
112
|
+
# @param position_id [Integer] Position ID. Use `0` to create a new position, or provide an existing position ID to add liquidity.
|
|
113
|
+
# @param pool_address [String] Pool contract address (from getLPPoolInfo).
|
|
114
|
+
# @param pay_token_amount [String] Payment token amount (positive decimal as string).
|
|
115
|
+
# @param pay_token_code [String] Payment token code (e.g., "CEX_1" for USDT).
|
|
116
|
+
# @option kwargs [String] :range_upper Range order - upper limit. Use this OR priceUpper, not both.
|
|
117
|
+
# @option kwargs [String] :range_lower Range order - lower limit. Use this OR priceLower, not both.
|
|
118
|
+
# @option kwargs [String] :price_upper Price order - upper limit (price priority). Use this OR rangeUpper, not both.
|
|
119
|
+
# @option kwargs [String] :price_lower Price order - lower limit (price priority). Use this OR rangeLower, not both.
|
|
120
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
121
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/lp/stake
|
|
122
|
+
def execute_lp_stake(position_id:, pool_address:, pay_token_amount:, pay_token_code:, **kwargs)
|
|
123
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(positionId: position_id, poolAddress: pool_address, payTokenAmount: pay_token_amount, payTokenCode: pay_token_code))
|
|
124
|
+
@session.sign_request(method: :post, path: '/v5/alpha/lp/stake', body: params)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Buy prediction outcome tokens with USDC
|
|
128
|
+
#
|
|
129
|
+
# POST /v5/alpha/prediction/buy
|
|
130
|
+
#
|
|
131
|
+
# @param token_id [String] Outcome token ID to buy (from getPredictionEventDetail).
|
|
132
|
+
# @param amount [String] USDC amount to invest (positive decimal as string).
|
|
133
|
+
# @param pay_token_code [String] Payment token code. Phase 1 fixed to "USDC".
|
|
134
|
+
# @param order_type [String]
|
|
135
|
+
# @param slippage [String] Maximum acceptable price slippage as decimal (e.g., "0.05" = 5% tolerance).
|
|
136
|
+
# @param event_id [String] Event ID associated with the token.
|
|
137
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
138
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/buy
|
|
139
|
+
def execute_prediction_buy(token_id:, amount:, pay_token_code:, order_type:, slippage:, event_id:)
|
|
140
|
+
params = Bybit::Utils::WireKeys.camelize({ tokenId: token_id, amount: amount, payTokenCode: pay_token_code, orderType: order_type, slippage: slippage, eventId: event_id })
|
|
141
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/buy', body: params)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Get prediction market matching engine availability status
|
|
145
|
+
#
|
|
146
|
+
# GET /v5/alpha/prediction/engine-status
|
|
147
|
+
#
|
|
148
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
149
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/engine-status
|
|
150
|
+
def get_prediction_engine_status
|
|
151
|
+
@session.sign_request(method: :get, path: '/v5/alpha/prediction/engine-status')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# Get prediction event detail with all markets and outcomes
|
|
155
|
+
#
|
|
156
|
+
# POST /v5/alpha/prediction/event-detail
|
|
157
|
+
#
|
|
158
|
+
# @option kwargs [String] :event_id Event ID. Use slug when available (takes priority).
|
|
159
|
+
# @option kwargs [String] :slug URL-friendly event slug. Takes priority over eventId when both provided.
|
|
160
|
+
# @option kwargs [Boolean] :has_more_markets Whether to merge markets from related sub-events. Default false.
|
|
161
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
162
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/event-detail
|
|
163
|
+
def get_prediction_event_detail(**kwargs)
|
|
164
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
165
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/event-detail', body: params)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Get full order book snapshot for prediction tokens
|
|
169
|
+
#
|
|
170
|
+
# POST /v5/alpha/prediction/order-book
|
|
171
|
+
#
|
|
172
|
+
# @param token_ids [Array] List of outcome token IDs. Maximum 20.
|
|
173
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
174
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/order-book
|
|
175
|
+
def get_prediction_order_book(token_ids:)
|
|
176
|
+
params = Bybit::Utils::WireKeys.camelize({ tokenIds: token_ids })
|
|
177
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/order-book', body: params)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# Estimate buy or sell order fill amount and fees before execution
|
|
181
|
+
#
|
|
182
|
+
# POST /v5/alpha/prediction/order-estimate
|
|
183
|
+
#
|
|
184
|
+
# @param token_id [String] Outcome token ID (from getPredictionEventDetail or getPredictionMarketList).
|
|
185
|
+
# @param side [String]
|
|
186
|
+
# @param event_id [String] Event ID associated with this token.
|
|
187
|
+
# @param amount [String] For BUY: USDC amount to invest (e.g., "100").
|
|
188
|
+
# For SELL: number of shares to sell (e.g., "50").
|
|
189
|
+
# @param order_type [String]
|
|
190
|
+
# @option kwargs [String] :pay_token_code Payment token code. Required for BUY. Phase 1 fixed to "USDC".
|
|
191
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
192
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/order-estimate
|
|
193
|
+
def get_prediction_order_estimate(token_id:, side:, event_id:, amount:, order_type:, **kwargs)
|
|
194
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(tokenId: token_id, side: side, eventId: event_id, amount: amount, orderType: order_type))
|
|
195
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/order-estimate', body: params)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Get user's prediction market order history
|
|
199
|
+
#
|
|
200
|
+
# POST /v5/alpha/prediction/order-list
|
|
201
|
+
#
|
|
202
|
+
# @option kwargs [String] :status
|
|
203
|
+
# @option kwargs [String] :token_id Optional. Filter by specific outcome token ID.
|
|
204
|
+
# @option kwargs [Integer] :limit Number of records per page.
|
|
205
|
+
# @option kwargs [Integer] :page_index Page number starting from 1.
|
|
206
|
+
# @option kwargs [String] :event_id Optional. Filter by event ID.
|
|
207
|
+
# @option kwargs [String] :side
|
|
208
|
+
# @option kwargs [Integer] :days Look back N days. Maximum 90.
|
|
209
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
210
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/order-list
|
|
211
|
+
def get_prediction_order_list(**kwargs)
|
|
212
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
213
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/order-list', body: params)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
# Get available payment tokens (USDC) for prediction market
|
|
217
|
+
#
|
|
218
|
+
# GET /v5/alpha/prediction/pay-token-list
|
|
219
|
+
#
|
|
220
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
221
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/pay-token-list
|
|
222
|
+
def get_prediction_pay_token_list
|
|
223
|
+
@session.sign_request(method: :get, path: '/v5/alpha/prediction/pay-token-list')
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# Get user's prediction market portfolio overview
|
|
227
|
+
#
|
|
228
|
+
# POST /v5/alpha/prediction/portfolio-summary
|
|
229
|
+
#
|
|
230
|
+
# @option kwargs [Integer] :event_type Optional sports event type filter.
|
|
231
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
232
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/portfolio-summary
|
|
233
|
+
def get_prediction_portfolio_summary(**kwargs)
|
|
234
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
235
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/portfolio-summary', body: params)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Get user's historical closed prediction market positions
|
|
239
|
+
#
|
|
240
|
+
# POST /v5/alpha/prediction/position-history
|
|
241
|
+
#
|
|
242
|
+
# @option kwargs [Integer] :limit Number of records per page.
|
|
243
|
+
# @option kwargs [Integer] :page_index Page number starting from 1.
|
|
244
|
+
# @option kwargs [String] :direction Pagination cursor direction.
|
|
245
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
246
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/position-history
|
|
247
|
+
def get_prediction_position_history(**kwargs)
|
|
248
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
249
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/position-history', body: params)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Get user's current open prediction market positions
|
|
253
|
+
#
|
|
254
|
+
# POST /v5/alpha/prediction/position-list
|
|
255
|
+
#
|
|
256
|
+
# @option kwargs [Integer] :limit Number of records per page.
|
|
257
|
+
# @option kwargs [Integer] :page_index Page number starting from 1.
|
|
258
|
+
# @option kwargs [String] :direction Pagination cursor direction.
|
|
259
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
260
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/position-list
|
|
261
|
+
def get_prediction_position_list(**kwargs)
|
|
262
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
263
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/position-list', body: params)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# Get historical price chart data for prediction tokens
|
|
267
|
+
#
|
|
268
|
+
# POST /v5/alpha/prediction/price-history
|
|
269
|
+
#
|
|
270
|
+
# @param token_id [String] Outcome token ID.
|
|
271
|
+
# @param interval [String] Price history interval.
|
|
272
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
273
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/price-history
|
|
274
|
+
def get_prediction_price_history(token_id:, interval:)
|
|
275
|
+
params = Bybit::Utils::WireKeys.camelize(tokenId: token_id, interval: interval)
|
|
276
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/price-history', body: params)
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# Sell prediction outcome token shares for USDC
|
|
280
|
+
#
|
|
281
|
+
# POST /v5/alpha/prediction/sell
|
|
282
|
+
#
|
|
283
|
+
# @param token_id [String] Outcome token ID to sell (from getPredictionPositionList).
|
|
284
|
+
# @param size [String] Number of shares to sell (positive decimal as string).
|
|
285
|
+
# @param order_type [String]
|
|
286
|
+
# @param slippage [String] Maximum acceptable price slippage as decimal (e.g., "0.05" = 5% tolerance).
|
|
287
|
+
# @param event_id [String] Event ID associated with the token.
|
|
288
|
+
# @option kwargs [String] :to_token_code Destination token code. Phase 1 fixed to "USDC".
|
|
289
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
290
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/sell
|
|
291
|
+
def execute_prediction_sell(token_id:, size:, order_type:, slippage:, event_id:, **kwargs)
|
|
292
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(tokenId: token_id, size: size, orderType: order_type, slippage: slippage, eventId: event_id))
|
|
293
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/sell', body: params)
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Get related side markets for a sports event
|
|
297
|
+
#
|
|
298
|
+
# POST /v5/alpha/prediction/side-market-list
|
|
299
|
+
#
|
|
300
|
+
# @param event_id [String] Event ID to query markets for.
|
|
301
|
+
# @option kwargs [String] :sort_by Sort by volume, liquidity, or endDate.
|
|
302
|
+
# @option kwargs [Integer] :market_type Filter by market type.
|
|
303
|
+
# @option kwargs [Integer] :limit Number of records per page.
|
|
304
|
+
# @option kwargs [Integer] :page_index Page number starting from 1.
|
|
305
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
306
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/side-market-list
|
|
307
|
+
def get_prediction_side_market_list(event_id:, **kwargs)
|
|
308
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(eventId: event_id))
|
|
309
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/side-market-list', body: params)
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
# Get group standings and results for a tournament stage
|
|
313
|
+
#
|
|
314
|
+
# POST /v5/alpha/prediction/sports/group-stage-detail
|
|
315
|
+
#
|
|
316
|
+
# @param event_type [Integer] Sports event type. `1` = FIFA_2026.
|
|
317
|
+
# @option kwargs [String] :group_name Optional group name filter.
|
|
318
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
319
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/sports-group-stage-detail
|
|
320
|
+
def get_prediction_group_stage_detail(event_type:, **kwargs)
|
|
321
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(eventType: event_type))
|
|
322
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/sports/group-stage-detail', body: params)
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
# Get match list for a sports prediction event
|
|
326
|
+
#
|
|
327
|
+
# POST /v5/alpha/prediction/sports/match-list
|
|
328
|
+
#
|
|
329
|
+
# @param event_type [Integer] Sports event type. `1` = FIFA_2026.
|
|
330
|
+
# @option kwargs [Integer] :status Optional match status filter.
|
|
331
|
+
# @option kwargs [Integer] :start_time Optional start timestamp in milliseconds.
|
|
332
|
+
# @option kwargs [Integer] :end_time Optional end timestamp in milliseconds.
|
|
333
|
+
# @option kwargs [String] :stage_code Optional tournament stage code.
|
|
334
|
+
# @option kwargs [Integer] :limit Number of records per page.
|
|
335
|
+
# @option kwargs [Integer] :page_index Page number starting from 1.
|
|
336
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
337
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/sports-match-list
|
|
338
|
+
def get_prediction_match_list(event_type:, **kwargs)
|
|
339
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(eventType: event_type))
|
|
340
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/sports/match-list', body: params)
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# Get tournament timeline stages for a sports event
|
|
344
|
+
#
|
|
345
|
+
# GET /v5/alpha/prediction/sports/timeline-stages
|
|
346
|
+
#
|
|
347
|
+
# @param event_type [Integer] Sports event type. `1` = FIFA_2026.
|
|
348
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
349
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/sports-timeline-stages
|
|
350
|
+
def get_prediction_timeline_stages(event_type:)
|
|
351
|
+
params = Bybit::Utils::WireKeys.camelize(eventType: event_type)
|
|
352
|
+
@session.sign_request(method: :get, path: '/v5/alpha/prediction/sports/timeline-stages', params: params)
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
# Get real-time prices for prediction outcome tokens
|
|
356
|
+
#
|
|
357
|
+
# POST /v5/alpha/prediction/token-price
|
|
358
|
+
#
|
|
359
|
+
# @param token_ids [Array] List of outcome token IDs to query. Maximum 20.
|
|
360
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
361
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/prediction/token-price
|
|
362
|
+
def get_prediction_token_price(token_ids:)
|
|
363
|
+
params = Bybit::Utils::WireKeys.camelize({ tokenIds: token_ids })
|
|
364
|
+
@session.sign_request(method: :post, path: '/v5/alpha/prediction/token-price', body: params)
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
# Get holding details for a specific token including quantity, PnL, and cost basis
|
|
368
|
+
#
|
|
369
|
+
# POST /v5/alpha/trade/asset-detail
|
|
370
|
+
#
|
|
371
|
+
# @param chain_code [String] Blockchain code (ETH, SOL, BSC, etc.).
|
|
372
|
+
# @param token_address [String] Token contract address on chain.
|
|
373
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
374
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/asset-detail
|
|
375
|
+
def get_asset_detail(chain_code:, token_address:)
|
|
376
|
+
params = Bybit::Utils::WireKeys.camelize({ chainCode: chain_code, tokenAddress: token_address })
|
|
377
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/asset-detail', body: params)
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
# Get user's on-chain token portfolio with holdings, PnL, and market value
|
|
381
|
+
#
|
|
382
|
+
# POST /v5/alpha/trade/asset-list
|
|
383
|
+
#
|
|
384
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
385
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/asset-list
|
|
386
|
+
def get_asset_list
|
|
387
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/asset-list')
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
# Get token project details including description, social links, risk flag, and order limits
|
|
391
|
+
#
|
|
392
|
+
# POST /v5/alpha/trade/biz-token-details
|
|
393
|
+
#
|
|
394
|
+
# @param chain_code [String] Blockchain code (ETH, SOL, BSC, etc.).
|
|
395
|
+
# @param token_address [String] Token contract address on chain.
|
|
396
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
397
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/biz-token-details
|
|
398
|
+
def get_biz_token_details(chain_code:, token_address:)
|
|
399
|
+
params = Bybit::Utils::WireKeys.camelize({ chainCode: chain_code, tokenAddress: token_address })
|
|
400
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/biz-token-details', body: params)
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
# Get on-chain tradable tokens with DEX token codes, risk flags, and order limits
|
|
404
|
+
#
|
|
405
|
+
# POST /v5/alpha/trade/biz-token-list
|
|
406
|
+
#
|
|
407
|
+
# @option kwargs [Integer] :token_tag Token tag filter.
|
|
408
|
+
# - `0`: All (no filter, default)
|
|
409
|
+
# - `1`: New token sniping
|
|
410
|
+
# - `2`: On-chain hot token
|
|
411
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
412
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/biz-token-list
|
|
413
|
+
def get_biz_token_list(**kwargs)
|
|
414
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
415
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/biz-token-list', body: params)
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
# Batch query token prices, 24h change, volume, market cap, liquidity, and holders by chain+address
|
|
419
|
+
#
|
|
420
|
+
# POST /v5/alpha/trade/biz-token-price-list
|
|
421
|
+
#
|
|
422
|
+
# @param token_address_info [Array] List of token identifiers to query. Maximum 20 items per request.
|
|
423
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
424
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/biz-token-price-list
|
|
425
|
+
def get_biz_token_price_list(token_address_info:)
|
|
426
|
+
params = Bybit::Utils::WireKeys.camelize({ tokenAddressInfo: token_address_info })
|
|
427
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/biz-token-price-list', body: params)
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
# Get trade order history with status, fees, and execution details
|
|
431
|
+
#
|
|
432
|
+
# POST /v5/alpha/trade/order-list
|
|
433
|
+
#
|
|
434
|
+
# @option kwargs [Integer] :trade_type Filter by trade type.
|
|
435
|
+
# - `0`: All (default)
|
|
436
|
+
# - `1`: Purchase (buy)
|
|
437
|
+
# - `2`: Redeem (sell)
|
|
438
|
+
# @option kwargs [String] :token_code Filter by token code.
|
|
439
|
+
# @option kwargs [Array] :order_status Filter by order status (multiple values allowed).
|
|
440
|
+
# - `1`: Processing
|
|
441
|
+
# - `2`: Success
|
|
442
|
+
# - `3`: Failed
|
|
443
|
+
# @option kwargs [Integer] :days Query last N days. Maximum 90. `0` means use system default (90 days).
|
|
444
|
+
# @option kwargs [Integer] :limit Results per page.
|
|
445
|
+
# @option kwargs [Integer] :page_index Page number (1-based).
|
|
446
|
+
# @option kwargs [String] :direction Pagination direction.
|
|
447
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
448
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/order-list
|
|
449
|
+
def get_order_list(**kwargs)
|
|
450
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
451
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/order-list', body: params)
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
# Get available payment tokens (USDT, USDC, etc.) with CEX token codes and supported chains
|
|
455
|
+
#
|
|
456
|
+
# POST /v5/alpha/trade/pay-token-list
|
|
457
|
+
#
|
|
458
|
+
# @param chain_code [String] Blockchain code (e.g. SOL, MANTLE).
|
|
459
|
+
# @param token_address [String] Token contract address on chain.
|
|
460
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
461
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/pay-token-list
|
|
462
|
+
def get_pay_token_list(chain_code:, token_address:)
|
|
463
|
+
params = Bybit::Utils::WireKeys.camelize({ chainCode: chain_code, tokenAddress: token_address })
|
|
464
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/pay-token-list', body: params)
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
# Execute a buy order to purchase on-chain tokens with USDT/USDC, returns order number
|
|
468
|
+
#
|
|
469
|
+
# POST /v5/alpha/trade/purchase
|
|
470
|
+
#
|
|
471
|
+
# @param from_token_code [String] Payment token code (`CEX_<id>`, e.g. `CEX_1` for USDT). Must match the quote request.
|
|
472
|
+
# @param from_token_amount [String] Payment amount (positive decimal as string). Must match the quote request.
|
|
473
|
+
# @param to_token_code [String] Target on-chain token code (`DEX_<id>`). Must match the quote request.
|
|
474
|
+
# @param slippage [String] Slippage tolerance as decimal.
|
|
475
|
+
# - `0.005` = 0.5%
|
|
476
|
+
# - `0.01` = 1%
|
|
477
|
+
# - `0.05` = 5%
|
|
478
|
+
# @param quote_data [String] Base64-encoded quote data. **Must pass as-is from `/quote` response.**
|
|
479
|
+
# @param gas [String] Estimated gas fee. **Must pass as-is from `/quote` response.**
|
|
480
|
+
# @param quote_mode [Integer] Quote mode. Must be consistent with the `/quote` request.
|
|
481
|
+
# - `0`: Auto
|
|
482
|
+
# - `1`: Price Priority
|
|
483
|
+
# - `2`: Success Rate Priority
|
|
484
|
+
# @param correcting_code [String] MD5 checksum for data integrity. **Must pass as-is from `/quote` response.**
|
|
485
|
+
# @option kwargs [String] :tenant Optional tenant identifier.
|
|
486
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
487
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/trade-purchase
|
|
488
|
+
def execute_purchase(from_token_code:, from_token_amount:, to_token_code:, slippage:, quote_data:, gas:, quote_mode:, correcting_code:, **kwargs)
|
|
489
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(fromTokenCode: from_token_code, fromTokenAmount: from_token_amount, toTokenCode: to_token_code, slippage: slippage, quoteData: quote_data, gas: gas, quoteMode: quote_mode, correctingCode: correcting_code))
|
|
490
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/purchase', body: params)
|
|
491
|
+
end
|
|
492
|
+
|
|
493
|
+
# Get estimated price, fees, slippage, and gas for an on-chain token trade
|
|
494
|
+
#
|
|
495
|
+
# POST /v5/alpha/trade/quote
|
|
496
|
+
#
|
|
497
|
+
# @param trade_type [Integer] Trade type.
|
|
498
|
+
# - `1`: Purchase (buy on-chain token with payment token)
|
|
499
|
+
# - `2`: Redeem (sell on-chain token for payment token)
|
|
500
|
+
# @param from_token_code [String] Source token code. Format: `CEX_<id>` or `DEX_<id>`.
|
|
501
|
+
# - Purchase: CEX token code (e.g. `CEX_1` for USDT). Get from `getPayTokenList`.
|
|
502
|
+
# - Redeem: DEX token code (e.g. `DEX_123`). Get from `getBizTokenList` or `getAssetList`.
|
|
503
|
+
# @param from_token_amount [String] Amount to pay (string-formatted positive decimal for precision). Must be greater than 0.
|
|
504
|
+
# @param to_token_code [String] Target token code. Format: `CEX_<id>` or `DEX_<id>`.
|
|
505
|
+
# - Purchase: DEX token code (e.g. `DEX_123`). Get from `getBizTokenList`.
|
|
506
|
+
# - Redeem: CEX token code (e.g. `CEX_1` for USDT). Get from `getPayTokenList`.
|
|
507
|
+
# @option kwargs [Integer] :quote_mode Quote mode.
|
|
508
|
+
# - `0`: Auto (default) - system selects optimal mode
|
|
509
|
+
# - `1`: Price Priority - best price, may have higher failure rate
|
|
510
|
+
# - `2`: Success Rate Priority - guaranteed execution, price may be slightly worse
|
|
511
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
512
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/trade-quote
|
|
513
|
+
def get_trade_quote(trade_type:, from_token_code:, from_token_amount:, to_token_code:, **kwargs)
|
|
514
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(tradeType: trade_type, fromTokenCode: from_token_code, fromTokenAmount: from_token_amount, toTokenCode: to_token_code))
|
|
515
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/quote', body: params)
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
# Execute a sell order to redeem on-chain tokens for USDT/USDC, returns order number
|
|
519
|
+
#
|
|
520
|
+
# POST /v5/alpha/trade/redeem
|
|
521
|
+
#
|
|
522
|
+
# @param from_token_code [String] On-chain token to sell (`DEX_<id>`). Must match the quote request.
|
|
523
|
+
# @param from_token_amount [String] Amount to sell (positive decimal as string). Must match the quote request.
|
|
524
|
+
# @param to_token_code [String] Payment token to receive (`CEX_<id>`, e.g. `CEX_1` for USDT). Must match the quote request.
|
|
525
|
+
# @param slippage [String] Slippage tolerance as decimal.
|
|
526
|
+
# - `0.005` = 0.5%
|
|
527
|
+
# - `0.01` = 1%
|
|
528
|
+
# - `0.05` = 5%
|
|
529
|
+
# @param quote_data [String] Base64-encoded quote data. **Must pass as-is from `/quote` response.**
|
|
530
|
+
# @param gas [String] Estimated gas fee. **Must pass as-is from `/quote` response.**
|
|
531
|
+
# @param quote_mode [Integer] Quote mode. Must be consistent with the `/quote` request.
|
|
532
|
+
# - `0`: Auto
|
|
533
|
+
# - `1`: Price Priority
|
|
534
|
+
# - `2`: Success Rate Priority
|
|
535
|
+
# @param correcting_code [String] MD5 checksum for data integrity. **Must pass as-is from `/quote` response.**
|
|
536
|
+
# @option kwargs [String] :tenant Optional tenant identifier.
|
|
537
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
538
|
+
# @see https://bybit-exchange.github.io/docs/v5/alpha/trade/trade-redeem
|
|
539
|
+
def execute_redeem(from_token_code:, from_token_amount:, to_token_code:, slippage:, quote_data:, gas:, quote_mode:, correcting_code:, **kwargs)
|
|
540
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(fromTokenCode: from_token_code, fromTokenAmount: from_token_amount, toTokenCode: to_token_code, slippage: slippage, quoteData: quote_data, gas: gas, quoteMode: quote_mode, correctingCode: correcting_code))
|
|
541
|
+
@session.sign_request(method: :post, path: '/v5/alpha/trade/redeem', body: params)
|
|
542
|
+
end
|
|
543
|
+
end
|
|
544
|
+
end
|
|
545
|
+
end
|
|
@@ -633,6 +633,23 @@ module Bybit
|
|
|
633
633
|
params = Bybit::Utils::WireKeys.camelize(params)
|
|
634
634
|
@session.sign_request(method: :post, path: '/v5/asset/covert/get-quote', body: params)
|
|
635
635
|
end
|
|
636
|
+
|
|
637
|
+
# Limit order callback notification
|
|
638
|
+
#
|
|
639
|
+
# POST /v5/asset/exchange/limit-order/callback
|
|
640
|
+
#
|
|
641
|
+
# @param exchange_tx_id [String] Convert order number
|
|
642
|
+
# @param option_type [Integer] Callback type: 1=filled, 2=canceled, 3=failed
|
|
643
|
+
# @param time_stamp [Integer] Callback timestamp (milliseconds)
|
|
644
|
+
# @param sign [String] Callback signature data
|
|
645
|
+
# @param app_id [String] appId of callback business, currently only supports: TimeResearch
|
|
646
|
+
# @option kwargs [String] :error_code Error code on failure
|
|
647
|
+
# @note This endpoint is generated from the Bybit OpenAPI specification and is not in the public documentation.
|
|
648
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
649
|
+
def limit_order_callback(exchange_tx_id:, option_type:, time_stamp:, sign:, app_id:, **kwargs)
|
|
650
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(exchangeTxId: exchange_tx_id, optionType: option_type, timeStamp: time_stamp, sign: sign, appId: app_id))
|
|
651
|
+
@session.sign_request(method: :post, path: '/v5/asset/exchange/limit-order/callback', body: params)
|
|
652
|
+
end
|
|
636
653
|
end
|
|
637
654
|
end
|
|
638
655
|
end
|
|
@@ -370,6 +370,66 @@ module Bybit
|
|
|
370
370
|
params = Bybit::Utils::WireKeys.camelize(params)
|
|
371
371
|
@session.sign_request(method: :post, path: '/v5/crypto-loan-flexible/repay-collateral', body: params)
|
|
372
372
|
end
|
|
373
|
+
|
|
374
|
+
# Get Available Inventory
|
|
375
|
+
#
|
|
376
|
+
# GET /v5/crypto-loan-fixed/available-inventory
|
|
377
|
+
#
|
|
378
|
+
# @param currency [String] Coin name, uppercase only
|
|
379
|
+
# @param term [String] Fixed term 7: 7 days; 14: 14 days; 30: 30 days; 90: 90 days; 180: 180 days
|
|
380
|
+
# @param annual_rate [String] Customizable annual interest rate, e.g., 0.02 means 2%
|
|
381
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
382
|
+
# @see https://bybit-exchange.github.io/docs/v5/new-crypto-loan/fixed/available-inventory
|
|
383
|
+
def get_fixed_available_inventory(currency:, term:, annual_rate:)
|
|
384
|
+
params = Bybit::Utils::WireKeys.camelize({ currency: currency, term: term, annualRate: annual_rate })
|
|
385
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-fixed/available-inventory', params: params)
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
# Get Repayment History
|
|
389
|
+
#
|
|
390
|
+
# GET /v5/crypto-loan-fixed/repayment-history
|
|
391
|
+
#
|
|
392
|
+
# @option kwargs [String] :repay_id Repayment ID
|
|
393
|
+
# @option kwargs [String] :loan_currency Loan currency filter
|
|
394
|
+
# @option kwargs [String] :limit Page size
|
|
395
|
+
# @option kwargs [String] :cursor Page cursor
|
|
396
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
397
|
+
# @see https://bybit-exchange.github.io/docs/v5/new-crypto-loan/fixed/repay-history
|
|
398
|
+
def get_fixed_repayment_history(**kwargs)
|
|
399
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
400
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-fixed/repayment-history', params: params)
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
# Create Supply Order
|
|
404
|
+
#
|
|
405
|
+
# POST /v5/crypto-loan-fixed/supply
|
|
406
|
+
#
|
|
407
|
+
# @param order_currency [String] Currency to lend
|
|
408
|
+
# @param order_amount [String] Amount to lend
|
|
409
|
+
# @param annual_rate [String] Annual interest rate
|
|
410
|
+
# @param term [String] Term in days (7, 14, 30, 90, 180)
|
|
411
|
+
# @option kwargs [String] :available_source Fund source for supply order:
|
|
412
|
+
# - `0`: Funding account (default)
|
|
413
|
+
# - `1`: Flexible savings
|
|
414
|
+
# - `2`: Mixed (funding account + flexible savings)
|
|
415
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
416
|
+
# @see https://bybit-exchange.github.io/docs/v5/new-crypto-loan/fixed/supply
|
|
417
|
+
def supply_fixed(order_currency:, order_amount:, annual_rate:, term:, **kwargs)
|
|
418
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(orderCurrency: order_currency, orderAmount: order_amount, annualRate: annual_rate, term: term))
|
|
419
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-fixed/supply', body: params)
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
# Get Available Inventory
|
|
423
|
+
#
|
|
424
|
+
# GET /v5/crypto-loan-flexible/available-inventory
|
|
425
|
+
#
|
|
426
|
+
# @param currency [String] Coin name, uppercase only
|
|
427
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
428
|
+
# @see https://bybit-exchange.github.io/docs/v5/new-crypto-loan/flexible/available-inventory
|
|
429
|
+
def get_flexible_available_inventory(currency:)
|
|
430
|
+
params = Bybit::Utils::WireKeys.camelize({ currency: currency })
|
|
431
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-flexible/available-inventory', params: params)
|
|
432
|
+
end
|
|
373
433
|
end
|
|
374
434
|
end
|
|
375
435
|
end
|