bybit-connector-ruby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +259 -0
- data/LICENSE +21 -0
- data/README.md +173 -0
- data/examples/quickstart.rb +35 -0
- data/lib/bybit/authentication.rb +16 -0
- data/lib/bybit/client.rb +71 -0
- data/lib/bybit/configuration.rb +74 -0
- data/lib/bybit/error.rb +67 -0
- data/lib/bybit/rest_api/account_service.rb +332 -0
- data/lib/bybit/rest_api/affiliate_service.rb +42 -0
- data/lib/bybit/rest_api/asset_service.rb +638 -0
- data/lib/bybit/rest_api/base_service.rb +11 -0
- data/lib/bybit/rest_api/bot_service.rb +386 -0
- data/lib/bybit/rest_api/broker_service.rb +109 -0
- data/lib/bybit/rest_api/crypto_loan_service.rb +375 -0
- data/lib/bybit/rest_api/earn_service.rb +1047 -0
- data/lib/bybit/rest_api/market_service.rb +359 -0
- data/lib/bybit/rest_api/p2p_service.rb +256 -0
- data/lib/bybit/rest_api/position_service.rb +202 -0
- data/lib/bybit/rest_api/rfq_service.rb +221 -0
- data/lib/bybit/rest_api/spot_margin_service.rb +62 -0
- data/lib/bybit/rest_api/trade_service.rb +289 -0
- data/lib/bybit/rest_api/user_service.rb +254 -0
- data/lib/bybit/session.rb +199 -0
- data/lib/bybit/utils/wire_keys.rb +66 -0
- data/lib/bybit/version.rb +5 -0
- data/lib/bybit.rb +10 -0
- metadata +158 -0
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Bybit
|
|
4
|
+
module RestApi
|
|
5
|
+
class CryptoLoanService < BaseService
|
|
6
|
+
# Adjust collateral by adding or removing amount for crypto loan.
|
|
7
|
+
#
|
|
8
|
+
# POST /v5/crypto-loan-common/adjust-ltv
|
|
9
|
+
#
|
|
10
|
+
# @param currency [String] Collateral currency
|
|
11
|
+
# @param amount [String] Amount to adjust
|
|
12
|
+
# @param direction [Integer] Adjustment direction: add or remove collateral
|
|
13
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
14
|
+
def adjust_ltv(currency:, amount:, direction:, **kwargs)
|
|
15
|
+
params = kwargs.merge(currency: currency, amount: amount, direction: direction)
|
|
16
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
17
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-common/adjust-ltv', body: params)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Get collateral adjustment history for crypto loan positions.
|
|
21
|
+
#
|
|
22
|
+
# GET /v5/crypto-loan-common/adjustment-history
|
|
23
|
+
#
|
|
24
|
+
# @option kwargs [Integer] :adjust_id Adjustment record ID
|
|
25
|
+
# @option kwargs [String] :collateral_currency Collateral currency filter
|
|
26
|
+
# @option kwargs [Integer] :limit Number of records per page
|
|
27
|
+
# @option kwargs [Integer] :cursor Pagination cursor
|
|
28
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
29
|
+
def get_adjustment_history(**kwargs)
|
|
30
|
+
params = kwargs.dup
|
|
31
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
32
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-common/adjustment-history', params: params)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Get collateral currency data for crypto loan.
|
|
36
|
+
#
|
|
37
|
+
# GET /v5/crypto-loan-common/collateral-data
|
|
38
|
+
#
|
|
39
|
+
# @option kwargs [String] :currency Collateral currency filter
|
|
40
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
41
|
+
def get_collateral_data(**kwargs)
|
|
42
|
+
params = kwargs.dup
|
|
43
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
44
|
+
@session.public_request(path: '/v5/crypto-loan-common/collateral-data', params: params)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Get loanable currency data for crypto loan.
|
|
48
|
+
#
|
|
49
|
+
# GET /v5/crypto-loan-common/loanable-data
|
|
50
|
+
#
|
|
51
|
+
# @option kwargs [String] :currency Loanable currency filter
|
|
52
|
+
# @option kwargs [String] :vip_level VIP level filter
|
|
53
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
54
|
+
def get_loanable_data(**kwargs)
|
|
55
|
+
params = kwargs.dup
|
|
56
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
57
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-common/loanable-data', params: params)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Get maximum collateral redeem amount for a currency.
|
|
61
|
+
#
|
|
62
|
+
# GET /v5/crypto-loan-common/max-collateral-amount
|
|
63
|
+
#
|
|
64
|
+
# @param currency [String] Collateral currency
|
|
65
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
66
|
+
def get_max_collateral_amount(currency:, **kwargs)
|
|
67
|
+
params = kwargs.merge(currency: currency)
|
|
68
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
69
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-common/max-collateral-amount', params: params)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Calculate the maximum borrowable amount given collateral list.
|
|
73
|
+
#
|
|
74
|
+
# POST /v5/crypto-loan-common/max-loan
|
|
75
|
+
#
|
|
76
|
+
# @param currency [String] Loan currency
|
|
77
|
+
# @param collateral_list [Array] List of collateral currencies and amounts
|
|
78
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
79
|
+
def get_max_loan(currency:, collateral_list:, **kwargs)
|
|
80
|
+
params = kwargs.merge(currency: currency, collateral_list: collateral_list)
|
|
81
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
82
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-common/max-loan', body: params)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
# Get current crypto loan position.
|
|
86
|
+
#
|
|
87
|
+
# GET /v5/crypto-loan-common/position
|
|
88
|
+
def get_position
|
|
89
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-common/position')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Get Borrow Contract Info
|
|
93
|
+
#
|
|
94
|
+
# GET /v5/crypto-loan-fixed/borrow-contract-info
|
|
95
|
+
#
|
|
96
|
+
# @option kwargs [String] :order_id Order ID
|
|
97
|
+
# @option kwargs [String] :loan_id Loan ID
|
|
98
|
+
# @option kwargs [String] :order_currency Order currency
|
|
99
|
+
# @option kwargs [String] :term Loan term
|
|
100
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
101
|
+
# @option kwargs [Integer] :cursor Cursor used for pagination
|
|
102
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
103
|
+
def get_fixed_borrow_contract_info(**kwargs)
|
|
104
|
+
params = kwargs.dup
|
|
105
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
106
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-fixed/borrow-contract-info', params: params)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Get Borrow Order Info
|
|
110
|
+
#
|
|
111
|
+
# GET /v5/crypto-loan-fixed/borrow-order-info
|
|
112
|
+
#
|
|
113
|
+
# @option kwargs [String] :order_id Order ID
|
|
114
|
+
# @option kwargs [String] :order_currency Order currency
|
|
115
|
+
# @option kwargs [String] :state Order state
|
|
116
|
+
# @option kwargs [String] :term Loan term
|
|
117
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
118
|
+
# @option kwargs [Integer] :cursor Cursor used for pagination
|
|
119
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
120
|
+
def get_fixed_borrow_order_info(**kwargs)
|
|
121
|
+
params = kwargs.dup
|
|
122
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
123
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-fixed/borrow-order-info', params: params)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Get Borrow Market Quotes
|
|
127
|
+
#
|
|
128
|
+
# GET /v5/crypto-loan-fixed/borrow-order-quote
|
|
129
|
+
#
|
|
130
|
+
# @option kwargs [String] :order_currency Order currency
|
|
131
|
+
# @option kwargs [String] :term Loan term
|
|
132
|
+
# @option kwargs [String] :order_by Order by field
|
|
133
|
+
# @option kwargs [Integer] :sort Sort direction
|
|
134
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
135
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
136
|
+
def get_fixed_borrow_order_quote(**kwargs)
|
|
137
|
+
params = kwargs.dup
|
|
138
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
139
|
+
@session.public_request(path: '/v5/crypto-loan-fixed/borrow-order-quote', params: params)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Get Renewal Information
|
|
143
|
+
#
|
|
144
|
+
# GET /v5/crypto-loan-fixed/renew-info
|
|
145
|
+
#
|
|
146
|
+
# @option kwargs [String] :order_id Order ID
|
|
147
|
+
# @option kwargs [String] :order_currency Order currency
|
|
148
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
149
|
+
# @option kwargs [Integer] :cursor Cursor used for pagination
|
|
150
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
151
|
+
def get_fixed_renew_info(**kwargs)
|
|
152
|
+
params = kwargs.dup
|
|
153
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
154
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-fixed/renew-info', params: params)
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# Get Supply Contract Info
|
|
158
|
+
#
|
|
159
|
+
# GET /v5/crypto-loan-fixed/supply-contract-info
|
|
160
|
+
#
|
|
161
|
+
# @option kwargs [String] :order_id Order ID
|
|
162
|
+
# @option kwargs [String] :supply_id Supply ID
|
|
163
|
+
# @option kwargs [String] :supply_currency Supply currency
|
|
164
|
+
# @option kwargs [String] :term Loan term
|
|
165
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
166
|
+
# @option kwargs [Integer] :cursor Cursor used for pagination
|
|
167
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
168
|
+
def get_fixed_supply_contract_info(**kwargs)
|
|
169
|
+
params = kwargs.dup
|
|
170
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
171
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-fixed/supply-contract-info', params: params)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Get Supply Order Info
|
|
175
|
+
#
|
|
176
|
+
# GET /v5/crypto-loan-fixed/supply-order-info
|
|
177
|
+
#
|
|
178
|
+
# @option kwargs [String] :order_id Order ID
|
|
179
|
+
# @option kwargs [String] :order_currency Order currency
|
|
180
|
+
# @option kwargs [String] :state Order state
|
|
181
|
+
# @option kwargs [String] :term Loan term
|
|
182
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
183
|
+
# @option kwargs [Integer] :cursor Cursor used for pagination
|
|
184
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
185
|
+
def get_fixed_supply_order_info(**kwargs)
|
|
186
|
+
params = kwargs.dup
|
|
187
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
188
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-fixed/supply-order-info', params: params)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Get Supply Market Quotes
|
|
192
|
+
#
|
|
193
|
+
# GET /v5/crypto-loan-fixed/supply-order-quote
|
|
194
|
+
#
|
|
195
|
+
# @option kwargs [String] :order_currency Order currency
|
|
196
|
+
# @option kwargs [String] :term Loan term
|
|
197
|
+
# @option kwargs [String] :order_by Order by field
|
|
198
|
+
# @option kwargs [Integer] :sort Sort direction
|
|
199
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
200
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
201
|
+
def get_fixed_supply_order_quote(**kwargs)
|
|
202
|
+
params = kwargs.dup
|
|
203
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
204
|
+
@session.public_request(path: '/v5/crypto-loan-fixed/supply-order-quote', params: params)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Create Fixed-Term Borrow Order
|
|
208
|
+
#
|
|
209
|
+
# POST /v5/crypto-loan-fixed/borrow
|
|
210
|
+
#
|
|
211
|
+
# @param order_currency [String] Order currency
|
|
212
|
+
# @param order_amount [String] Order amount
|
|
213
|
+
# @param annual_rate [String] Annual interest rate
|
|
214
|
+
# @param term [String] Loan term
|
|
215
|
+
# @param collateral_list [Array] List of collateral
|
|
216
|
+
# @option kwargs [String] :auto_repay Auto repay flag
|
|
217
|
+
# @option kwargs [String] :repay_type Repay type
|
|
218
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
219
|
+
def borrow_fixed(order_currency:, order_amount:, annual_rate:, term:, collateral_list:, **kwargs)
|
|
220
|
+
params = kwargs.merge(order_currency: order_currency, order_amount: order_amount, annual_rate: annual_rate, term: term, collateral_list: collateral_list)
|
|
221
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
222
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-fixed/borrow', body: params)
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Cancel Borrow Order
|
|
226
|
+
#
|
|
227
|
+
# POST /v5/crypto-loan-fixed/borrow-order-cancel
|
|
228
|
+
#
|
|
229
|
+
# @param order_id [String] Order ID
|
|
230
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
231
|
+
def cancel_fixed_borrow_order(order_id:, **kwargs)
|
|
232
|
+
params = kwargs.merge(order_id: order_id)
|
|
233
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
234
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-fixed/borrow-order-cancel', body: params)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Fully Repay Loan
|
|
238
|
+
#
|
|
239
|
+
# POST /v5/crypto-loan-fixed/fully-repay
|
|
240
|
+
#
|
|
241
|
+
# @param loan_id [String] Loan ID
|
|
242
|
+
# @param loan_currency [String] Loan currency
|
|
243
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
244
|
+
def repay_fixed_fully(loan_id:, loan_currency:, **kwargs)
|
|
245
|
+
params = kwargs.merge(loan_id: loan_id, loan_currency: loan_currency)
|
|
246
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
247
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-fixed/fully-repay', body: params)
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# Renew Loan
|
|
251
|
+
#
|
|
252
|
+
# POST /v5/crypto-loan-fixed/renew
|
|
253
|
+
#
|
|
254
|
+
# @param loan_id [String] Loan ID
|
|
255
|
+
# @param collateral_list [Array] List of collateral
|
|
256
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
257
|
+
def renew_fixed(loan_id:, collateral_list:, **kwargs)
|
|
258
|
+
params = kwargs.merge(loan_id: loan_id, collateral_list: collateral_list)
|
|
259
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
260
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-fixed/renew', body: params)
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
# Repay with Collateral
|
|
264
|
+
#
|
|
265
|
+
# POST /v5/crypto-loan-fixed/repay-collateral
|
|
266
|
+
#
|
|
267
|
+
# @param loan_id [Integer] Loan ID
|
|
268
|
+
# @param loan_currency [String] Loan currency
|
|
269
|
+
# @param collateral_coin [String] Collateral coin
|
|
270
|
+
# @param amount [String] Repay amount
|
|
271
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
272
|
+
def repay_fixed_with_collateral(loan_id:, loan_currency:, collateral_coin:, amount:, **kwargs)
|
|
273
|
+
params = kwargs.merge(loan_id: loan_id, loan_currency: loan_currency, collateral_coin: collateral_coin, amount: amount)
|
|
274
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
275
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-fixed/repay-collateral', body: params)
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Cancel Supply Order
|
|
279
|
+
#
|
|
280
|
+
# POST /v5/crypto-loan-fixed/supply-order-cancel
|
|
281
|
+
#
|
|
282
|
+
# @param order_id [String] Order ID
|
|
283
|
+
# @option kwargs [Integer] :refunded_account Refunded account
|
|
284
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
285
|
+
def cancel_fixed_supply_order(order_id:, **kwargs)
|
|
286
|
+
params = kwargs.merge(order_id: order_id)
|
|
287
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
288
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-fixed/supply-order-cancel', body: params)
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Get Flexible Borrow History
|
|
292
|
+
#
|
|
293
|
+
# GET /v5/crypto-loan-flexible/borrow-history
|
|
294
|
+
#
|
|
295
|
+
# @option kwargs [String] :order_id Order ID of the borrow order
|
|
296
|
+
# @option kwargs [String] :loan_currency Loan currency
|
|
297
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
298
|
+
# @option kwargs [Integer] :cursor Cursor for pagination
|
|
299
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
300
|
+
def get_flexible_borrow_history(**kwargs)
|
|
301
|
+
params = kwargs.dup
|
|
302
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
303
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-flexible/borrow-history', params: params)
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
# Get Ongoing Flexible Borrow Info
|
|
307
|
+
#
|
|
308
|
+
# GET /v5/crypto-loan-flexible/ongoing-coin
|
|
309
|
+
#
|
|
310
|
+
# @option kwargs [String] :loan_currency Loan currency
|
|
311
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
312
|
+
def get_flexible_ongoing_coin(**kwargs)
|
|
313
|
+
params = kwargs.dup
|
|
314
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
315
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-flexible/ongoing-coin', params: params)
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
# Get Flexible Repayment History
|
|
319
|
+
#
|
|
320
|
+
# GET /v5/crypto-loan-flexible/repayment-history
|
|
321
|
+
#
|
|
322
|
+
# @option kwargs [String] :repay_id Repayment ID
|
|
323
|
+
# @option kwargs [String] :loan_currency Loan currency
|
|
324
|
+
# @option kwargs [Integer] :limit Limit for data size per page
|
|
325
|
+
# @option kwargs [Integer] :cursor Cursor for pagination
|
|
326
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
327
|
+
def get_flexible_repayment_history(**kwargs)
|
|
328
|
+
params = kwargs.dup
|
|
329
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
330
|
+
@session.sign_request(method: :get, path: '/v5/crypto-loan-flexible/repayment-history', params: params)
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# Create Flexible Borrow Order
|
|
334
|
+
#
|
|
335
|
+
# POST /v5/crypto-loan-flexible/borrow
|
|
336
|
+
#
|
|
337
|
+
# @param loan_currency [String] Loan currency
|
|
338
|
+
# @param loan_amount [String] Loan amount
|
|
339
|
+
# @param collateral_list [Array] Collateral coin list
|
|
340
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
341
|
+
def borrow_flexible(loan_currency:, loan_amount:, collateral_list:, **kwargs)
|
|
342
|
+
params = kwargs.merge(loan_currency: loan_currency, loan_amount: loan_amount, collateral_list: collateral_list)
|
|
343
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
344
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-flexible/borrow', body: params)
|
|
345
|
+
end
|
|
346
|
+
|
|
347
|
+
# Repay Flexible Loan
|
|
348
|
+
#
|
|
349
|
+
# POST /v5/crypto-loan-flexible/repay
|
|
350
|
+
#
|
|
351
|
+
# @param loan_currency [String] Loan currency
|
|
352
|
+
# @param amount [String] Repayment amount
|
|
353
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
354
|
+
def repay_flexible(loan_currency:, amount:, **kwargs)
|
|
355
|
+
params = kwargs.merge(loan_currency: loan_currency, amount: amount)
|
|
356
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
357
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-flexible/repay', body: params)
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Repay with Collateral
|
|
361
|
+
#
|
|
362
|
+
# POST /v5/crypto-loan-flexible/repay-collateral
|
|
363
|
+
#
|
|
364
|
+
# @param loan_currency [String] Loan currency
|
|
365
|
+
# @param collateral_coin [String] Collateral coin
|
|
366
|
+
# @param amount [String] Repayment amount
|
|
367
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
368
|
+
def repay_flexible_with_collateral(loan_currency:, collateral_coin:, amount:, **kwargs)
|
|
369
|
+
params = kwargs.merge(loan_currency: loan_currency, collateral_coin: collateral_coin, amount: amount)
|
|
370
|
+
params = Bybit::Utils::WireKeys.camelize(params)
|
|
371
|
+
@session.sign_request(method: :post, path: '/v5/crypto-loan-flexible/repay-collateral', body: params)
|
|
372
|
+
end
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
end
|