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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 29c7f3e3612cc7bc336a83b1eaf26480ec881b491e7e3c66d042b9a6a23efb71
|
|
4
|
+
data.tar.gz: 7d64066ef1795efbdfc0f13c11bda3f8ea5e99e6f0d627fb4a1baf28bd6de99c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e767a4025a6b105dad09bd0abb87ad04127183505981a35445e9d699c512ea9c699e769a77bd6b8a899fe7f2a91a073c70d823f822b08383f63ec9d3ef20a728
|
|
7
|
+
data.tar.gz: 312fd1a206d9513423767aa47d1a1009bbd28883d14367928df5799698c31205f72c661b9efcbfc36f1795b97434147c02a6ff3ba0235a744f616072f4e9213b
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,134 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.3] - 2026-11-06
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- `AlphaService#get_lp_order_list(...)`
|
|
12
|
+
- `AlphaService#get_lp_pay_token_list(...)`
|
|
13
|
+
- `AlphaService#get_lp_pay_token_price(...)`
|
|
14
|
+
- `AlphaService#get_lp_pool_info(...)`
|
|
15
|
+
- `AlphaService#get_lp_pool_list(...)`
|
|
16
|
+
- `AlphaService#get_lp_position_list(...)`
|
|
17
|
+
- `AlphaService#execute_lp_redeem(...)`
|
|
18
|
+
- `AlphaService#execute_lp_stake(...)`
|
|
19
|
+
- `AlphaService#execute_prediction_buy(...)`
|
|
20
|
+
- `AlphaService#get_prediction_engine_status(...)`
|
|
21
|
+
- `AlphaService#get_prediction_event_detail(...)`
|
|
22
|
+
- `AlphaService#get_prediction_order_book(...)`
|
|
23
|
+
- `AlphaService#get_prediction_order_estimate(...)`
|
|
24
|
+
- `AlphaService#get_prediction_order_list(...)`
|
|
25
|
+
- `AlphaService#get_prediction_pay_token_list(...)`
|
|
26
|
+
- `AlphaService#get_prediction_portfolio_summary(...)`
|
|
27
|
+
- `AlphaService#get_prediction_position_history(...)`
|
|
28
|
+
- `AlphaService#get_prediction_position_list(...)`
|
|
29
|
+
- `AlphaService#get_prediction_price_history(...)`
|
|
30
|
+
- `AlphaService#execute_prediction_sell(...)`
|
|
31
|
+
- `AlphaService#get_prediction_side_market_list(...)`
|
|
32
|
+
- `AlphaService#get_prediction_group_stage_detail(...)`
|
|
33
|
+
- `AlphaService#get_prediction_match_list(...)`
|
|
34
|
+
- `AlphaService#get_prediction_timeline_stages(...)`
|
|
35
|
+
- `AlphaService#get_prediction_token_price(...)`
|
|
36
|
+
- `AlphaService#get_asset_detail(...)`
|
|
37
|
+
- `AlphaService#get_asset_list(...)`
|
|
38
|
+
- `AlphaService#get_biz_token_details(...)`
|
|
39
|
+
- `AlphaService#get_biz_token_list(...)`
|
|
40
|
+
- `AlphaService#get_biz_token_price_list(...)`
|
|
41
|
+
- `AlphaService#get_order_list(...)`
|
|
42
|
+
- `AlphaService#get_pay_token_list(...)`
|
|
43
|
+
- `AlphaService#execute_purchase(...)`
|
|
44
|
+
- `AlphaService#get_trade_quote(...)`
|
|
45
|
+
- `AlphaService#execute_redeem(...)`
|
|
46
|
+
- `EventService#get_ec_order_history(...)`
|
|
47
|
+
- `EventService#get_ec_active_orders(...)`
|
|
48
|
+
- `EventService#get_ec_position_info(...)`
|
|
49
|
+
- `EventService#get_ec_settlements(...)`
|
|
50
|
+
- `EventService#get_ec_trade_history(...)`
|
|
51
|
+
- `TaxService#batch_create_tax_reports(...)`
|
|
52
|
+
- `TaxService#batch_query_tax_reports(...)`
|
|
53
|
+
- `FiatService#query_balance(...)`
|
|
54
|
+
- `FiatService#query_coin_list(...)`
|
|
55
|
+
- `FiatService#query_trade_history(...)`
|
|
56
|
+
- `FiatService#apply_quote(...)`
|
|
57
|
+
- `FiatService#get_reference_price(...)`
|
|
58
|
+
- `FiatService#confirm_quote(...)`
|
|
59
|
+
- `FiatService#query_trade(...)`
|
|
60
|
+
- `InstitutionalLoanService#ins_loan_coin_delta_amount(...)`
|
|
61
|
+
- `InstitutionalLoanService#ins_loan_delay_liq_status(...)`
|
|
62
|
+
- `ReferralService#get_campaign_rewards(...)`
|
|
63
|
+
- `ReferralService#get_commission_records(...)`
|
|
64
|
+
- `ReferralService#get_user_identity_profile(...)`
|
|
65
|
+
- `ReferralService#get_user_invitations(...)`
|
|
66
|
+
- `SpotMarginService#query_fixed_borrow_penalty_interest(...)`
|
|
67
|
+
- `SpotMarginService#cancel_fixed_borrow_order(...)`
|
|
68
|
+
- `SpotXService#get_launchpool_project_list(...)`
|
|
69
|
+
- `SpotXService#get_launchpool_user_activity_log(...)`
|
|
70
|
+
- `SpotXService#get_launchpool_user_current_staking(...)`
|
|
71
|
+
- `SpotXService#get_launchpool_user_history(...)`
|
|
72
|
+
- `SpotXService#get_puzzle_project_list(...)`
|
|
73
|
+
- `SpotXService#get_token_splash_project_list(...)`
|
|
74
|
+
- `SpotXService#get_token_splash_user_activity_params(...)`
|
|
75
|
+
- `SpreadTradeService#get_history(...)`
|
|
76
|
+
- `SpreadTradeService#get_spread_instruments_info(...)`
|
|
77
|
+
- `SpreadTradeService#get_spread_max_qty(...)`
|
|
78
|
+
- `SpreadTradeService#amend_spread_order(...)`
|
|
79
|
+
- `SpreadTradeService#cancel_spread_order(...)`
|
|
80
|
+
- `SpreadTradeService#cancel_all_spread_orders(...)`
|
|
81
|
+
- `SpreadTradeService#create_spread_order(...)`
|
|
82
|
+
- `SpreadTradeService#get_spread_order_history(...)`
|
|
83
|
+
- `SpreadTradeService#get_spread_open_orders(...)`
|
|
84
|
+
- `SpreadTradeService#get_spread_orderbook(...)`
|
|
85
|
+
- `SpreadTradeService#get_spread_recent_trades(...)`
|
|
86
|
+
- `SpreadTradeService#get_spread_tickers(...)`
|
|
87
|
+
- `StrategyService#create_strategy(...)`
|
|
88
|
+
- `StrategyService#query_list(...)`
|
|
89
|
+
- `StrategyService#query_order_list(...)`
|
|
90
|
+
- `StrategyService#stop_strategy(...)`
|
|
91
|
+
|
|
92
|
+
### Fixed
|
|
93
|
+
- `AlphaService#get_prediction_side_market_list(...)` now requires `event_id` and accepts the documented filters and pagination options.
|
|
94
|
+
|
|
95
|
+
### Sources
|
|
96
|
+
- OpenAPI: `705f49bf6dba27ecc5b9b402f46ab2423cfb5dd9`
|
|
97
|
+
- Docs: `9cde0843c270dd1e6009fb4593272f43f60cccf0`
|
|
98
|
+
|
|
99
|
+
## [0.1.2] - 2026-10-13
|
|
100
|
+
|
|
101
|
+
### Added
|
|
102
|
+
- `AccountService#demo_apply_money(...)`
|
|
103
|
+
- `AccountService#get_option_asset_info(...)`
|
|
104
|
+
- `AccountService#get_pay_info(...)`
|
|
105
|
+
- `AccountService#get_trade_info_for_analysis(...)`
|
|
106
|
+
- `AssetService#limit_order_callback(...)`
|
|
107
|
+
- `CryptoLoanService#get_fixed_available_inventory(...)`
|
|
108
|
+
- `CryptoLoanService#get_fixed_repayment_history(...)`
|
|
109
|
+
- `CryptoLoanService#supply_fixed(...)`
|
|
110
|
+
- `CryptoLoanService#get_flexible_available_inventory(...)`
|
|
111
|
+
- `EarnService#list_auto_savings(...)`
|
|
112
|
+
- `EarnService#edit_earn_auto_savings(...)`
|
|
113
|
+
- `MarketService#get_option_base_coins(...)`
|
|
114
|
+
- `PositionService#get_symbol_info(...)`
|
|
115
|
+
- `SpotMarginService#get_trade_coin_state(...)`
|
|
116
|
+
- `SpotMarginService#query_fixed_available_inventory(...)`
|
|
117
|
+
- `SpotMarginService#account_fixed_borrow(...)`
|
|
118
|
+
- `SpotMarginService#query_fixed_borrow_contracts(...)`
|
|
119
|
+
- `SpotMarginService#query_fixed_borrow_orders(...)`
|
|
120
|
+
- `SpotMarginService#query_fixed_borrow_market(...)`
|
|
121
|
+
- `SpotMarginService#renew_fixed_borrow(...)`
|
|
122
|
+
- `SpotMarginService#get_trade_flexible_available_inventory(...)`
|
|
123
|
+
- `SpotMarginService#get_trade_auto_repay_mode(...)`
|
|
124
|
+
- `SpotMarginService#query_borrow_liability(...)`
|
|
125
|
+
- `SpotMarginService#get_trade_max_borrowable(...)`
|
|
126
|
+
- `SpotMarginService#get_trade_repayment_available_amount(...)`
|
|
127
|
+
- `SpotMarginService#set_auto_repay_mode(...)`
|
|
128
|
+
- `SpotMarginService#spot_margin_set_leverage(...)`
|
|
129
|
+
- `SpotMarginService#get_trade_state(...)`
|
|
130
|
+
- `SpotMarginService#spot_margin_switch_mode(...)`
|
|
131
|
+
- `UserService#query_referral_code(...)`
|
|
132
|
+
|
|
133
|
+
### Sources
|
|
134
|
+
- OpenAPI: `08130d57323d390dea58f15418758e2667c74ce6`
|
|
135
|
+
- Docs: `59e3d457dea6b419a14987c19a3aabf4ffb38238`
|
|
8
136
|
|
|
9
137
|
## [0.1.1] - 2026-07-22
|
|
10
138
|
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# bybit-connector-ruby
|
|
2
2
|
|
|
3
|
+
[](https://rubygems.org/gems/bybit-connector-ruby) [](https://github.com/bybit-exchange/bybit.ruby.api/blob/main/LICENSE)
|
|
4
|
+
|
|
3
5
|
Official lightweight Ruby connector for the [Bybit V5 REST API](https://bybit-exchange.github.io/docs/v5/intro).
|
|
4
6
|
|
|
5
7
|
`bybit-connector-ruby` wraps the Bybit V5 HTTP endpoints as a set of typed Ruby methods with keyword-arg signatures.
|
|
@@ -126,18 +128,26 @@ Each API group is a property on `Bybit::Client`:
|
|
|
126
128
|
- `client.trade` — orders (create / amend / cancel / batch / history)
|
|
127
129
|
- `client.position` — positions, leverage, TP/SL, move-position
|
|
128
130
|
- `client.account` — wallet, margin, collateral, fee-rate, transaction log
|
|
131
|
+
- `client.alpha` — Alpha liquidity pools, prediction markets, and on-chain token trading
|
|
129
132
|
- `client.asset` — coin balance, coin greeks, funding history
|
|
130
133
|
- `client.user` — sub-accounts, API-key management
|
|
131
134
|
- `client.affiliate` — sub-affiliate lists
|
|
132
135
|
- `client.broker` — broker earnings, distributions
|
|
133
136
|
- `client.crypto_loan` — flexible / fixed crypto loans
|
|
137
|
+
- `client.event` — event contracts, positions, settlements, and executions
|
|
138
|
+
- `client.fiat` — fiat convert balances, quotes, trades, and history
|
|
134
139
|
- `client.institutional_loan` — /v5/ins-loan/* (OTC institutional loans)
|
|
135
140
|
- `client.rfq` — request-for-quote (block trades)
|
|
136
141
|
- `client.spot_margin` — UTA spot margin
|
|
142
|
+
- `client.spot_x` — Launchpool, Puzzle Hunt, and Token Splash
|
|
143
|
+
- `client.spread_trade` — spread instruments, orders, orderbook, and executions
|
|
144
|
+
- `client.strategy` — strategy creation, queries, and lifecycle operations
|
|
145
|
+
- `client.tax` — private tax report generation and status queries
|
|
137
146
|
- `client.earn` — earn, liquidity mining, RWA, PWM, hold-to-earn
|
|
138
147
|
- `client.p2p` — P2P advertise / order / chat
|
|
139
148
|
- `client.bot` — DCA / grid / futures-combo / futures-grid / martingale
|
|
140
149
|
- `client.pre_upgrade` — /v5/pre-upgrade/* historical queries for Classic → UTA upgrades
|
|
150
|
+
- `client.referral` — campaign rewards, commissions, profiles, and invitations
|
|
141
151
|
- `client.misc` — /v5/announcements/index, /v5/system/status
|
|
142
152
|
|
|
143
153
|
## Error Handling
|
data/lib/bybit/client.rb
CHANGED
|
@@ -18,6 +18,14 @@ require 'bybit/rest_api/rfq_service'
|
|
|
18
18
|
require 'bybit/rest_api/spot_margin_service'
|
|
19
19
|
require 'bybit/rest_api/trade_service'
|
|
20
20
|
require 'bybit/rest_api/user_service'
|
|
21
|
+
require 'bybit/rest_api/alpha_service'
|
|
22
|
+
require 'bybit/rest_api/event_service'
|
|
23
|
+
require 'bybit/rest_api/fiat_service'
|
|
24
|
+
require 'bybit/rest_api/referral_service'
|
|
25
|
+
require 'bybit/rest_api/spot_x_service'
|
|
26
|
+
require 'bybit/rest_api/spread_trade_service'
|
|
27
|
+
require 'bybit/rest_api/strategy_service'
|
|
28
|
+
require 'bybit/rest_api/tax_service'
|
|
21
29
|
# gen-sdk-ruby:service-requires:end
|
|
22
30
|
|
|
23
31
|
module Bybit
|
|
@@ -36,9 +44,10 @@ module Bybit
|
|
|
36
44
|
|
|
37
45
|
class Client
|
|
38
46
|
# gen-sdk-ruby:client-readers:start
|
|
39
|
-
attr_reader :account, :affiliate, :asset, :bot, :broker, :crypto_loan, :earn,
|
|
40
|
-
:institutional_loan, :market, :misc, :p2p, :position,
|
|
41
|
-
:rfq, :spot_margin, :
|
|
47
|
+
attr_reader :account, :affiliate, :alpha, :asset, :bot, :broker, :crypto_loan, :earn,
|
|
48
|
+
:event, :fiat, :institutional_loan, :market, :misc, :p2p, :position,
|
|
49
|
+
:pre_upgrade, :referral, :rfq, :spot_margin, :spot_x, :spread_trade,
|
|
50
|
+
:strategy, :tax, :trade, :user
|
|
42
51
|
|
|
43
52
|
# gen-sdk-ruby:client-readers:end
|
|
44
53
|
|
|
@@ -49,23 +58,35 @@ module Bybit
|
|
|
49
58
|
@config = cfg
|
|
50
59
|
|
|
51
60
|
# gen-sdk-ruby:client-inits:start
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
{
|
|
62
|
+
account: RestApi::AccountService,
|
|
63
|
+
affiliate: RestApi::AffiliateService,
|
|
64
|
+
alpha: RestApi::AlphaService,
|
|
65
|
+
asset: RestApi::AssetService,
|
|
66
|
+
bot: RestApi::BotService,
|
|
67
|
+
broker: RestApi::BrokerService,
|
|
68
|
+
crypto_loan: RestApi::CryptoLoanService,
|
|
69
|
+
earn: RestApi::EarnService,
|
|
70
|
+
event: RestApi::EventService,
|
|
71
|
+
fiat: RestApi::FiatService,
|
|
72
|
+
institutional_loan: RestApi::InstitutionalLoanService,
|
|
73
|
+
market: RestApi::MarketService,
|
|
74
|
+
misc: RestApi::MiscService,
|
|
75
|
+
p2p: RestApi::P2pService,
|
|
76
|
+
position: RestApi::PositionService,
|
|
77
|
+
pre_upgrade: RestApi::PreUpgradeService,
|
|
78
|
+
referral: RestApi::ReferralService,
|
|
79
|
+
rfq: RestApi::RfqService,
|
|
80
|
+
spot_margin: RestApi::SpotMarginService,
|
|
81
|
+
spot_x: RestApi::SpotXService,
|
|
82
|
+
spread_trade: RestApi::SpreadTradeService,
|
|
83
|
+
strategy: RestApi::StrategyService,
|
|
84
|
+
tax: RestApi::TaxService,
|
|
85
|
+
trade: RestApi::TradeService,
|
|
86
|
+
user: RestApi::UserService
|
|
87
|
+
}.each do |name, service_class|
|
|
88
|
+
instance_variable_set("@#{name}", service_class.new(session))
|
|
89
|
+
end
|
|
69
90
|
# gen-sdk-ruby:client-inits:end
|
|
70
91
|
end
|
|
71
92
|
|
|
@@ -327,6 +327,56 @@ module Bybit
|
|
|
327
327
|
params = Bybit::Utils::WireKeys.camelize(params)
|
|
328
328
|
@session.sign_request(method: :post, path: '/v5/account/upgrade-to-uta', body: params)
|
|
329
329
|
end
|
|
330
|
+
|
|
331
|
+
# Apply demo funds
|
|
332
|
+
#
|
|
333
|
+
# POST /v5/account/demo-apply-money
|
|
334
|
+
#
|
|
335
|
+
# @option kwargs [Integer] :adjust_type Adjustment type, 0-add funds, 1-deduct funds
|
|
336
|
+
# @option kwargs [Array] :uta_demo_apply_money Fund application config list
|
|
337
|
+
# @note This endpoint requires `base_url: 'https://api-demo.bybit.com'`.
|
|
338
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
339
|
+
# @see https://bybit-exchange.github.io/docs/v5/demo
|
|
340
|
+
def demo_apply_money(**kwargs)
|
|
341
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
342
|
+
@session.sign_request(method: :post, path: '/v5/account/demo-apply-money', body: params)
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# Get Option Asset Info
|
|
346
|
+
#
|
|
347
|
+
# GET /v5/account/option-asset-info
|
|
348
|
+
#
|
|
349
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
350
|
+
# @see https://bybit-exchange.github.io/docs/v5/account/option-asset-info
|
|
351
|
+
def get_option_asset_info
|
|
352
|
+
@session.sign_request(method: :get, path: '/v5/account/option-asset-info')
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
# Get Pay Info
|
|
356
|
+
#
|
|
357
|
+
# GET /v5/account/pay-info
|
|
358
|
+
#
|
|
359
|
+
# @option kwargs [String] :coin Coin name, e.g. `USDT`, `BTC`. If not passed, returns all repayment info.
|
|
360
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
361
|
+
# @see https://bybit-exchange.github.io/docs/v5/account/pay-info
|
|
362
|
+
def get_pay_info(**kwargs)
|
|
363
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs)
|
|
364
|
+
@session.sign_request(method: :get, path: '/v5/account/pay-info', params: params)
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
# Get Trade Info For Analysis
|
|
368
|
+
#
|
|
369
|
+
# GET /v5/account/trade-info-for-analysis
|
|
370
|
+
#
|
|
371
|
+
# @param symbol [String] Trading pair, e.g. `BTCUSDT`, `ETHUSDT`.
|
|
372
|
+
# @option kwargs [Integer] :start_time Query start time in milliseconds timestamp.
|
|
373
|
+
# @option kwargs [Integer] :end_time Query end time in milliseconds timestamp.
|
|
374
|
+
# @return [Hash] Bybit V5 ApiResponse envelope (retCode / retMsg / result / retExtInfo / time).
|
|
375
|
+
# @see https://bybit-exchange.github.io/docs/v5/account/trade-info-for-analysis
|
|
376
|
+
def get_trade_info_for_analysis(symbol:, **kwargs)
|
|
377
|
+
params = Bybit::Utils::WireKeys.camelize(kwargs.merge(symbol: symbol))
|
|
378
|
+
@session.sign_request(method: :get, path: '/v5/account/trade-info-for-analysis', params: params)
|
|
379
|
+
end
|
|
330
380
|
end
|
|
331
381
|
end
|
|
332
382
|
end
|