Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,97 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.3] - 2026-11-06

### Added
- `AlphaService#get_lp_order_list(...)`
- `AlphaService#get_lp_pay_token_list(...)`
- `AlphaService#get_lp_pay_token_price(...)`
- `AlphaService#get_lp_pool_info(...)`
- `AlphaService#get_lp_pool_list(...)`
- `AlphaService#get_lp_position_list(...)`
- `AlphaService#execute_lp_redeem(...)`
- `AlphaService#execute_lp_stake(...)`
- `AlphaService#execute_prediction_buy(...)`
- `AlphaService#get_prediction_engine_status(...)`
- `AlphaService#get_prediction_event_detail(...)`
- `AlphaService#get_prediction_order_book(...)`
- `AlphaService#get_prediction_order_estimate(...)`
- `AlphaService#get_prediction_order_list(...)`
- `AlphaService#get_prediction_pay_token_list(...)`
- `AlphaService#get_prediction_portfolio_summary(...)`
- `AlphaService#get_prediction_position_history(...)`
- `AlphaService#get_prediction_position_list(...)`
- `AlphaService#get_prediction_price_history(...)`
- `AlphaService#execute_prediction_sell(...)`
- `AlphaService#get_prediction_side_market_list(...)`
- `AlphaService#get_prediction_group_stage_detail(...)`
- `AlphaService#get_prediction_match_list(...)`
- `AlphaService#get_prediction_timeline_stages(...)`
- `AlphaService#get_prediction_token_price(...)`
- `AlphaService#get_asset_detail(...)`
- `AlphaService#get_asset_list(...)`
- `AlphaService#get_biz_token_details(...)`
- `AlphaService#get_biz_token_list(...)`
- `AlphaService#get_biz_token_price_list(...)`
- `AlphaService#get_order_list(...)`
- `AlphaService#get_pay_token_list(...)`
- `AlphaService#execute_purchase(...)`
- `AlphaService#get_trade_quote(...)`
- `AlphaService#execute_redeem(...)`
- `EventService#get_ec_order_history(...)`
- `EventService#get_ec_active_orders(...)`
- `EventService#get_ec_position_info(...)`
- `EventService#get_ec_settlements(...)`
- `EventService#get_ec_trade_history(...)`
- `TaxService#batch_create_tax_reports(...)`
- `TaxService#batch_query_tax_reports(...)`
- `FiatService#query_balance(...)`
- `FiatService#query_coin_list(...)`
- `FiatService#query_trade_history(...)`
- `FiatService#apply_quote(...)`
- `FiatService#get_reference_price(...)`
- `FiatService#confirm_quote(...)`
- `FiatService#query_trade(...)`
- `InstitutionalLoanService#ins_loan_coin_delta_amount(...)`
- `InstitutionalLoanService#ins_loan_delay_liq_status(...)`
- `ReferralService#get_campaign_rewards(...)`
- `ReferralService#get_commission_records(...)`
- `ReferralService#get_user_identity_profile(...)`
- `ReferralService#get_user_invitations(...)`
- `SpotMarginService#query_fixed_borrow_penalty_interest(...)`
- `SpotMarginService#cancel_fixed_borrow_order(...)`
- `SpotXService#get_launchpool_project_list(...)`
- `SpotXService#get_launchpool_user_activity_log(...)`
- `SpotXService#get_launchpool_user_current_staking(...)`
- `SpotXService#get_launchpool_user_history(...)`
- `SpotXService#get_puzzle_project_list(...)`
- `SpotXService#get_token_splash_project_list(...)`
- `SpotXService#get_token_splash_user_activity_params(...)`
- `SpreadTradeService#get_history(...)`
- `SpreadTradeService#get_spread_instruments_info(...)`
- `SpreadTradeService#get_spread_max_qty(...)`
- `SpreadTradeService#amend_spread_order(...)`
- `SpreadTradeService#cancel_spread_order(...)`
- `SpreadTradeService#cancel_all_spread_orders(...)`
- `SpreadTradeService#create_spread_order(...)`
- `SpreadTradeService#get_spread_order_history(...)`
- `SpreadTradeService#get_spread_open_orders(...)`
- `SpreadTradeService#get_spread_orderbook(...)`
- `SpreadTradeService#get_spread_recent_trades(...)`
- `SpreadTradeService#get_spread_tickers(...)`
- `StrategyService#create_strategy(...)`
- `StrategyService#query_list(...)`
- `StrategyService#query_order_list(...)`
- `StrategyService#stop_strategy(...)`

### Fixed
- `AlphaService#get_prediction_side_market_list(...)` now requires `event_id` and accepts the documented filters and pagination options.

### Sources
- OpenAPI: `705f49bf6dba27ecc5b9b402f46ab2423cfb5dd9`
- Docs: `9cde0843c270dd1e6009fb4593272f43f60cccf0`

## [0.1.2] - 2026-10-13

### Added
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,26 @@ Each API group is a property on `Bybit::Client`:
- `client.trade` — orders (create / amend / cancel / batch / history)
- `client.position` — positions, leverage, TP/SL, move-position
- `client.account` — wallet, margin, collateral, fee-rate, transaction log
- `client.alpha` — Alpha liquidity pools, prediction markets, and on-chain token trading
- `client.asset` — coin balance, coin greeks, funding history
- `client.user` — sub-accounts, API-key management
- `client.affiliate` — sub-affiliate lists
- `client.broker` — broker earnings, distributions
- `client.crypto_loan` — flexible / fixed crypto loans
- `client.event` — event contracts, positions, settlements, and executions
- `client.fiat` — fiat convert balances, quotes, trades, and history
- `client.institutional_loan` — /v5/ins-loan/* (OTC institutional loans)
- `client.rfq` — request-for-quote (block trades)
- `client.spot_margin` — UTA spot margin
- `client.spot_x` — Launchpool, Puzzle Hunt, and Token Splash
- `client.spread_trade` — spread instruments, orders, orderbook, and executions
- `client.strategy` — strategy creation, queries, and lifecycle operations
- `client.tax` — private tax report generation and status queries
- `client.earn` — earn, liquidity mining, RWA, PWM, hold-to-earn
- `client.p2p` — P2P advertise / order / chat
- `client.bot` — DCA / grid / futures-combo / futures-grid / martingale
- `client.pre_upgrade` — /v5/pre-upgrade/* historical queries for Classic → UTA upgrades
- `client.referral` — campaign rewards, commissions, profiles, and invitations
- `client.misc` — /v5/announcements/index, /v5/system/status

## Error Handling
Expand Down
150 changes: 150 additions & 0 deletions docs/superpowers/plans/2026-11-06-remove-stocks-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Remove Stocks API Implementation Plan

> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** Remove every `/v5/rwa/stocks/*` endpoint and the `client.stocks` public surface from the unreleased Ruby SDK.

**Architecture:** Remove the dedicated service at its client composition boundary, then remove its generated request contracts and public documentation. A negative client-surface regression example prevents the service from remaining accidentally exposed.

**Tech Stack:** Ruby 3.3, RSpec 3, RuboCop, generated REST contract specs.

---

### Task 1: Lock the removed client surface with a failing example

**Files:**
- Modify: `spec/bybit_spec.rb`

- [x] **Step 1: Add the negative public-surface example**

Add this example inside `RSpec.describe Bybit`:

```ruby
it 'does not expose the deferred Stocks API' do
client = Bybit::Client.new

expect(client).not_to respond_to(:stocks)
end
```

- [x] **Step 2: Run the example and verify RED**

Run:

```bash
bundle exec rspec spec/bybit_spec.rb
```

Expected: the new example fails because the current client still responds to
`stocks`. Ignore the repository-wide coverage gate from a focused run; inspect
the RSpec example result itself.

### Task 2: Remove the Stocks runtime and generated contracts

**Files:**
- Delete: `lib/bybit/rest_api/stocks_service.rb`
- Modify: `lib/bybit/client.rb`
- Modify: `spec/generated/rest_api_generated_spec.rb`
- Modify: `README.md`
- Modify: `CHANGELOG.md`

- [x] **Step 1: Remove the service from client composition**

Delete this require:

```ruby
require 'bybit/rest_api/stocks_service'
```

Remove `:stocks` from `Client`'s `attr_reader` declaration and remove this
initializer entry:

```ruby
stocks: RestApi::StocksService,
```

- [x] **Step 2: Delete the dedicated service implementation**

Delete `lib/bybit/rest_api/stocks_service.rb` in full. Do not move its methods
or retain a compatibility constant.

- [x] **Step 3: Delete every generated Stocks contract example**

From `spec/generated/rest_api_generated_spec.rb`, delete all nine complete
examples whose endpoint comments are:

```text
GET /v5/rwa/stocks/convert/detail
GET /v5/rwa/stocks/convert/list
GET /v5/rwa/stocks/market/getMultiplierList
GET /v5/rwa/stocks/market/session
GET /v5/rwa/stocks/order/detail
GET /v5/rwa/stocks/positions
POST /v5/rwa/stocks/convert/submit
POST /v5/rwa/stocks/order
POST /v5/rwa/stocks/order/cancel
```

- [x] **Step 4: Remove public documentation entries**

Delete this README inventory line:

```markdown
- `client.stocks` — RWA stock conversion, trading, and positions
```

Delete all nine `StocksService#...` entries from the 0.1.3 `Added` section in
`CHANGELOG.md`.

- [x] **Step 5: Verify the focused client example is GREEN**

Run:

```bash
bundle exec rspec spec/bybit_spec.rb
```

Expected: all examples in `spec/bybit_spec.rb` pass. The focused command may
still exit nonzero only because the global SimpleCov thresholds require the
complete suite.

### Task 3: Prove complete removal and run project gates

**Files:**
- Verify only.

- [x] **Step 1: Search for remaining public/runtime references**

Run:

```bash
rg -n -i 'StocksService|client\.stocks|/v5/rwa/stocks' \
README.md CHANGELOG.md lib spec
```

Expected: no matches.

- [x] **Step 2: Run the complete test and lint gates**

Run:

```bash
bundle exec rspec
bundle exec rubocop
```

Expected: zero RSpec failures, coverage gates pass, and RuboCop reports no
offenses.

- [x] **Step 3: Check whitespace and final scope**

Run:

```bash
git diff --check main
rg -n '[[:blank:]]+$' spec/bybit_spec.rb docs/superpowers/plans/2026-11-06-remove-stocks-api.md
git status --short
```

Expected: no whitespace matches or errors. Confirm the existing staged state
is preserved and SDK changes remain uncommitted.
Loading
Loading