Skip to content

Releases

v1.4.3

Choose a tag to compare

@tigusigalpa tigusigalpa released this 09 Sep 16:22

v1.4.3 — Pest Tests & CI Compatibility

Added

  • Pest unit test suite covering REST request signing, protected headers, API errors, Demo Trading, derivative orders, TradFi helpers, and WebSocket endpoint selection.
  • composer test:unit command for running Pest tests locally.
  • Isolated Pest test environment in tests/pest with a committed dependency lock file.
  • Combined compatibility and Pest coverage uploads to Codecov.

Changed

  • GitHub Actions now runs compatibility checks on PHP 7.4–8.2 and Pest tests on PHP 8.3–8.4.
  • Pest dependencies are isolated from the package’s root Composer requirements, preserving installation compatibility for PHP 7.4–8.2.
  • Coverage and test workflows install locked Pest dependencies reproducibly.
  • PHP syntax checks exclude test-tool dependencies.
  • Testing instructions were added to the English and Russian READMEs.

Verification

  • composer update --no-dev --prefer-dist --no-interaction --no-progress passes.
  • Compatibility test suite passes.
  • Pest suite passes: 16 tests, 39 assertions.

v1.4.2

Choose a tag to compare

@tigusigalpa tigusigalpa released this 09 Sep 16:07

v1.4.2 — Testing & CI Improvements

This release strengthens the project’s automated quality checks and makes future development safer.

Added

  • Pest unit test suite for REST client behavior, Demo Trading, TradFi helpers, and WebSocket endpoint selection.
  • Isolated HTTP tests using Guzzle mock transports — no real API keys or network requests are required.
  • composer test:unit command for running Pest tests locally.
  • PHPUnit/Pest configuration with coverage restricted to the package source code.

Changed

  • GitHub Actions now runs:
    • compatibility tests on PHP 7.4–8.2;
    • Pest unit tests on PHP 8.3 and 8.4;
    • syntax validation across source, configuration, and tests.
  • Codecov now receives reports from both the compatibility suite and Pest unit tests.
  • Composer explicitly permits the official Pest Composer plugin during CI installation.
  • README documentation now includes local commands for compatibility and Pest test suites.
  • PHP support badge now reflects the tested PHP 7.4–8.4 range.

Verification

  • Existing compatibility test suite passes.
  • Pest suite passes with 16 tests and 39 assertions.
  • Composer metadata validation and PHP syntax checks pass.

v1.4.1

Choose a tag to compare

@tigusigalpa tigusigalpa released this 09 Sep 12:26

v1.4.1 — Correct Demo Trading Isolation

This release aligns the PHP SDK’s Demo Trading behavior with Bybit’s actual environment model: Demo Trading and Testnet are separate services with separate credentials and endpoints.

Fixed

  • Testnet now always uses Bybit’s official global endpoints:
    • REST: https://api-testnet.bybit.com
    • WebSocket: wss://stream-testnet.bybit.com
  • Removed unsupported regional Testnet routing for Japan and Hong Kong.
  • Preserved strict separation between Testnet and Demo Trading; they cannot be enabled together.

Added

  • BybitClient::demo() factory for creating an isolated Demo Trading client without manually configuring flags.
  • requestDemoFundsSimple() helper for requesting or reducing funds for one supported Demo Trading coin: BTC, ETH, USDT, or USDC.
  • getDemoApiKeyInfo() helper for reading the active Demo Trading API key information.
  • subscribeGreeks() for the Demo Trading private WebSocket stream.
  • Tests covering Demo Trading routing, the simplified funding payload, Demo API key access, and Testnet endpoint selection.

Notes

  • Demo Trading REST requests use https://api-demo.bybit.com.
  • Demo private WebSocket streams use wss://stream-demo.bybit.com/v5/private.
  • Public Demo market data is served through the mainnet public WebSocket.
  • Bybit WebSocket Trade is not available in Demo Trading.

See the Bybit Demo Trading documentation for the complete list of supported operations and service limitations.

v1.4.0

Choose a tag to compare

@tigusigalpa tigusigalpa released this 09 Sep 11:16

v1.4.0 — Bybit V5 reliability, Demo Trading, and CI

This release modernizes the SDK around the current Bybit V5 API, strengthens signed-request handling, and adds automated quality and security checks.

Highlights

  • Signed REST requests now send the exact canonical query string or JSON payload used for signature generation.
  • Added typed BybitHttpException errors for non-successful HTTP responses.
  • Added current regional REST and WebSocket endpoints for EU, Indonesia, Japan, Hong Kong, and Turkey.
  • Demo Trading now supports RSA authentication for private WebSocket streams. Public Demo Trading streams correctly use mainnet market-data endpoints.
  • Added V5 helpers for batch orders, execution history, account instruments, transferable funds, asset operations, spot margin, collateral, greeks, and Demo Trading accounts.
  • Improved TradFi support: fixed GOOGLUSDT, paginated instrument discovery, stock filtering, and multi-symbol ticker aggregation.
  • Added GitHub Actions for PHP 7.4–8.4 tests, Xdebug coverage, Codecov uploads, Composer security audits, Dependency Review, OpenSSF Scorecard, and Dependabot.

Upgrade notes

  • testnet and demoTrading are now mutually exclusive.
  • X-Referer is sent only when BYBIT_BROKER_ID is configured. Broker applications should set this value explicitly.
  • HTTP responses with non-2xx status codes now throw BybitHttpException.
  • Demo Trading requires API keys created in the production account’s Demo Trading area; Testnet requires Testnet keys.

See the updated README for configuration details, supported regional endpoints, and new V5 helper methods.

v1.3.5

Choose a tag to compare

@tigusigalpa tigusigalpa released this 25 Apr 01:01

v1.3.5 — TradFi Support

What's New

This release adds a dedicated TradFi module (BybitTradFi) for trading traditional financial instruments — gold, silver, forex pairs, stock CFDs, and indices — all available on Bybit as linear perpetuals through the standard V5 API.


New Class: BybitTradFi

Instantiate via composition: $tradfi = new BybitTradFi($client)

Market Data

  • getInstruments — fetch all available TradFi instruments; accepts optional asset class filter: metal, forex, stock, index, commodity
  • getTicker — get a ticker snapshot for a single TradFi symbol
  • getTickers — get tickers for a list of symbols (or all linear instruments when empty)
  • getMetalsTickers — shortcut for gold (XAUUSD), silver (XAGUSD), and platinum (XPTUSD)
  • getForexTickers — shortcut for major forex pairs: EURUSD, GBPUSD, USDJPY, and more
  • getStockTickers — shortcut for US stock CFDs: AAPL, TSLA, NVDA, META, and more
  • getIndexTickers — shortcut for major indices: US500USD, US100USD, DE40USD, and more
  • getKline — candlestick data; supports all V5 intervals (1, 5, 15, 60, D, W, etc.)
  • getOrderbook — order book depth for a TradFi symbol; configurable depth up to 200
  • getSwapFee — overnight swap/financing fee info via instruments-info endpoint

Trading

  • placeOrder — place a limit or market order; supports takeProfit, stopLoss, reduceOnly, positionIdx, and orderLinkId
  • closePosition — close an open position at market price with reduceOnly=true
  • setLeverage — set leverage for a TradFi symbol
  • cancelOrder — cancel by orderId or orderLinkId
  • getOpenOrders — query open/untriggered TradFi orders; optionally filtered by symbol
  • getOrderHistory — order history with configurable limit
  • getTradeHistory — execution history for TradFi instruments
  • getPositions — list open positions; optionally filtered by symbol
  • getFeeRate — trading fee rate for a TradFi symbol or all linear instruments

Utilities

  • isTradFiSymbol — static helper to detect whether a symbol is a TradFi instrument (metal, forex, or index) vs. a crypto perpetual
  • Predefined symbol constants: METALS, FOREX_MAJORS, FOREX_MINORS, US_STOCKS, INDICES

New Example

  • examples/13-tradfi.php — demonstrates market data fetching, kline and orderbook retrieval, open position inspection, order placement with TP/SL, order cancellation, and isTradFiSymbol detection across forex, metals, and index symbols

Notes

  • All methods use category=linear internally — no new API endpoints required beyond the standard V5 REST API
  • BybitTradFi uses composition, not inheritance — pass an existing BybitClient instance to the constructor
  • TradFi instruments are subject to market hours (unlike 24/7 crypto); outside trading sessions the API may return empty order books or stale prices
  • Swap fees apply when holding TradFi positions past daily market close — use getSwapFee to check the rate before sizing a position
  • Fully compatible with PHP 7.4+ — no str_starts_with / str_ends_with dependencies

v1.3.4

Choose a tag to compare

@tigusigalpa tigusigalpa released this 19 Apr 12:22

Release Notes v1.3.4

Bug Fixes & Improvements

🔐 Authentication & Headers

  • Added required headers: User-Agent: bybit-php/1.0.0 and X-Referer: bybit-php now included in all API requests per Bybit API requirements
  • Fixed query string signing: Removed unnecessary ksort() from buildQuery() — parameters are now signed in their original order, matching Bybit's signature calculation

⚡ Rate Limiting

  • Built-in rate limit protection: Automatic throttling with 100ms minimum interval between GET requests and 300ms between POST requests to prevent retCode=10006 errors

🛡️ Error Handling

  • New throwOnError option: When enabled, throws RuntimeException on non-zero retCode responses instead of returning error arrays
  • New setThrowOnError() method: Fluent setter to toggle error throwing at runtime

📡 WebSocket Improvements

  • Multi-category support: New category parameter supports spot, linear, inverse, and option public streams
  • Fixed authentication: expires parameter now correctly sent as string
  • Improved ping/pong handling: Response now includes req_id when present in the ping message
  • New setCategory() method: Change WebSocket category without reconnecting

📈 Trading Improvements

  • Smart triggerDirection: Automatically calculated based on current price vs trigger price, or can be explicitly set via extra['triggerDirection']
  • Spot market buy enhancement: Automatically adds marketUnit=quoteCoin for market buy orders (buy with USDT amount)

🔧 Laravel Integration

  • Fixed Facade accessor: BybitWebSocket facade now correctly uses 'bybit.websocket' alias
  • New config options:
    • throw_on_error (BYBIT_THROW_ON_ERROR)
    • websocket_category (BYBIT_WEBSOCKET_CATEGORY)

Breaking Changes

None — all changes are backward compatible.

Upgrade Guide

composer update tigusigalpa/bybit-php
php artisan vendor:publish --tag=bybit-config --force  # Optional: update config

v1.2.1

Choose a tag to compare

@tigusigalpa tigusigalpa released this 13 Apr 02:08

1.2.1 - 2026-04-13

Added

  • Laravel 13 support

Changed

  • Updated illuminate/support dependency to include ^13.0
  • Updated documentation badges to reflect Laravel 13 compatibility

v1.1.16

Choose a tag to compare

@tigusigalpa tigusigalpa released this 18 Jan 09:24

Release Notes - v1.1.16

🎉 What's New

This release significantly expands the Bybit PHP SDK with comprehensive market data endpoints and full demo trading support, bringing the library closer to feature parity with the official Bybit V5 API.


✨ New Features

📊 Market Data Endpoints

Added six new market data endpoints for comprehensive market analysis:

  • getOpenInterest() - Retrieve open interest data for derivatives markets

    • Supports multiple interval times: 5min, 15min, 30min, 1h, 4h, 1d
    • Essential for analyzing market sentiment and positioning
  • getRecentTrades() - Fetch recent public trades

    • Access up to 1000 recent trades per request
    • Real-time market activity monitoring
  • getFundingRateHistory() - Get historical funding rate data

    • Track funding rates over time for perpetual contracts
    • Up to 200 records per request with pagination support
  • getHistoricalVolatility() - Retrieve historical volatility for options

    • Multiple period options: 7, 14, 21, 30, 60, 90, 180, 270 days
    • Critical for options pricing and risk assessment
  • getInsurancePool() - Access insurance pool data

    • Monitor the health of Bybit's insurance fund
    • Available for all supported coins
  • getRiskLimit() - Get risk limit information

    • Understand position size limits and margin requirements
    • Essential for risk management

🎮 Demo Trading Support

Full implementation of Bybit's demo trading environment:

  • Demo Trading Mode - New demoTrading parameter in BybitClient constructor

    • Automatically routes requests to https://api-demo.bybit.com
    • Seamless switching between live and demo environments
  • createDemoAccount() - Programmatically create demo trading accounts

    • Use production API keys to generate demo accounts
    • Returns demo account UID for API key creation
  • requestDemoFunds() - Request virtual funds for demo trading

    • Add or reduce demo funds for any supported coin
    • Rate limit: 1 request per minute
  • Laravel Integration - New BYBIT_DEMO_TRADING environment variable

    • Easy configuration via .env file
    • Works seamlessly with facades and dependency injection

🔧 Improvements

Configuration Enhancements

  • Added demo_trading configuration option in config/bybit.php
  • Added BYBIT_DEMO_TRADING environment variable support
  • Updated BybitServiceProvider to pass demo trading flag to client instances

Code Architecture

  • Extended baseUri() method to support demo trading domain
  • Maintained backward compatibility - all existing code continues to work
  • No breaking changes to existing API

📚 Documentation Updates

README.md & README-ru.md

  • New Market Data Section - Comprehensive examples for all 6 new endpoints
  • Demo Trading Section - Complete guide with Pure PHP and Laravel examples
  • Configuration Table - Updated with BYBIT_DEMO_TRADING parameter
  • Environment Variables - Added demo trading configuration examples

Code Examples

Added practical examples for:

  • Open interest analysis
  • Recent trades monitoring
  • Funding rate tracking
  • Historical volatility analysis
  • Insurance pool monitoring
  • Risk limit management
  • Demo account creation and funding

🚀 Usage Examples

Market Data

// Get open interest
$openInterest = $client->getOpenInterest([
    'category' => 'linear',
    'symbol' => 'BTCUSDT',
    'intervalTime' => '5min'
]);

// Get recent trades
$trades = $client->getRecentTrades([
    'category' => 'linear',
    'symbol' => 'BTCUSDT',
    'limit' => 60
]);

// Get funding rate history
$funding = $client->getFundingRateHistory([
    'category' => 'linear',
    'symbol' => 'BTCUSDT',
    'limit' => 200
]);

Demo Trading

// Pure PHP
$demoClient = new BybitClient(
    apiKey: 'your_demo_api_key',
    apiSecret: 'your_demo_api_secret',
    testnet: false,
    region: 'global',
    recvWindow: 5000,
    signature: 'hmac',
    rsaPrivateKey: null,
    http: null,
    fees: null,
    demoTrading: true
);

// Request demo funds
$demoClient->requestDemoFunds([
    'adjustType' => 0,
    'utaDemoApplyMoney' => [
        ['coin' => 'USDT', 'amountStr' => '10000'],
        ['coin' => 'BTC', 'amountStr' => '1']
    ]
]);

// Laravel - Just set in .env
BYBIT_DEMO_TRADING=true

📋 API Reference

New Methods

Method Endpoint Description
getOpenInterest() GET /v5/market/open-interest Get open interest data
getRecentTrades() GET /v5/market/recent-trade Get recent public trades
getFundingRateHistory() GET /v5/market/funding/history Get funding rate history
getHistoricalVolatility() GET /v5/market/historical-volatility Get historical volatility
getInsurancePool() GET /v5/market/insurance Get insurance pool data
getRiskLimit() GET /v5/market/risk-limit Get risk limit info
createDemoAccount() POST /v5/user/create-demo-member Create demo account
requestDemoFunds() POST /v5/account/demo-apply-money Request demo funds

🔄 Migration Guide

From v1.1.15 to v1.1.16

No breaking changes! This is a backward-compatible release.

To Use New Market Data Endpoints

Simply call the new methods - they follow the same pattern as existing methods:

$result = $client->getOpenInterest(['category' => 'linear', 'symbol' => 'BTCUSDT']);

To Enable Demo Trading

Pure PHP:

$client = new BybitClient($key, $secret, false, 'global', 5000, 'hmac', null, null, null, true);

Laravel:

BYBIT_DEMO_TRADING=true

📖 Documentation


🙏 Acknowledgments

This release implements functionality based on:

  • Bybit V5 API official documentation
  • Community feedback and feature requests
  • Best practices from pybit (official Python SDK)

📦 Installation

composer require tigusigalpa/bybit-php

For Laravel:

composer require tigusigalpa/bybit-php
php artisan vendor:publish --tag=bybit-config

🐛 Bug Fixes

None in this release - focus was on new features.


⚠️ Known Issues

None reported.


🔮 What's Next?

Future releases may include:

  • Additional account management endpoints
  • Batch operations support
  • Enhanced WebSocket features
  • More comprehensive error handling

📝 Full Changelog

Added

  • Market data endpoint: getOpenInterest()
  • Market data endpoint: getRecentTrades()
  • Market data endpoint: getFundingRateHistory()
  • Market data endpoint: getHistoricalVolatility()
  • Market data endpoint: getInsurancePool()
  • Market data endpoint: getRiskLimit()
  • Demo trading support with demoTrading parameter
  • Demo trading endpoint: createDemoAccount()
  • Demo trading endpoint: requestDemoFunds()
  • Configuration option: BYBIT_DEMO_TRADING
  • Comprehensive documentation for all new features
  • Usage examples in both English and Russian READMEs

Changed

  • Updated baseUri() to support demo trading domain
  • Extended BybitClient constructor with demoTrading parameter
  • Updated BybitServiceProvider to support demo trading configuration
  • Enhanced configuration file with demo trading option

Fixed

  • None

Deprecated

  • None

Removed

  • None

Security

  • No security-related changes

Release Date: January 18, 2026
Author: Igor Sazonov (tigusigalpa)
License: MIT

v1.1.4

Choose a tag to compare

@tigusigalpa tigusigalpa released this 18 Jan 04:49

Release Notes

v1.1.4 - 2026-01-18

🎉 Major Updates

This release brings significant enhancements to the Bybit PHP SDK, including comprehensive REST API coverage, WebSocket support, and extensive documentation improvements.

✨ New Features

REST API Methods

  • Order Management

    • amendOrder() - Modify existing orders (price, quantity)
    • cancelAllOrders() - Cancel all orders for a specific symbol
    • getHistoryOrders() - Retrieve closed/cancelled order history
  • Position Management

    • switchPositionMode() - Switch between One-Way Mode and Hedge Mode
    • setTradingStop() - Set Take Profit and Stop Loss for existing positions

WebSocket Real-Time Streaming

  • New BybitWebSocket Class - Complete WebSocket client implementation

    • Public streams: orderbook, trades, tickers, klines
    • Private streams: positions, orders, executions, wallet updates
    • Auto-reconnection handling
    • Automatic ping/pong for connection maintenance
    • Support for multiple topic subscriptions
    • Regional endpoint support
    • Testnet compatibility
  • Laravel Integration

    • BybitWebSocket facade for easy access
    • Service provider registration
    • Background processing support

Helper Methods

  • subscribeOrderbook($symbol, $depth) - Subscribe to orderbook updates
  • subscribeTrade($symbol) - Subscribe to public trades
  • subscribeTicker($symbol) - Subscribe to ticker updates
  • subscribeKline($symbol, $interval) - Subscribe to kline/candlestick data
  • subscribePosition() - Subscribe to position updates (private)
  • subscribeOrder() - Subscribe to order updates (private)
  • subscribeExecution() - Subscribe to execution updates (private)
  • subscribeWallet() - Subscribe to wallet updates (private)

📚 Documentation Improvements

Modern README Design

  • Enhanced Visual Design

    • Added badges (PHP version, Laravel compatibility, License, WebSocket support)
    • Centered header with professional styling
    • Interactive table of contents with anchor links
    • Emoji icons for better readability
    • Two-column feature tables
  • Comprehensive Table of Contents

    • Quick navigation to all sections
    • Organized by feature categories
    • Easy-to-scan structure
  • Pure PHP Examples

    • Complete standalone examples without Laravel
    • WebSocket usage for pure PHP
    • Full initialization examples
    • Trading bot example
  • Enhanced Sections

    • Regional endpoints table with country flags
    • Configuration parameters table
    • Advanced usage examples
    • Complete trading bot example
    • Contributing guidelines
    • Professional footer with call-to-action

Bilingual Documentation

  • English (README.md) - Fully modernized with all new features
  • Russian (README-ru.md) - Complete translation with identical structure

New Documentation Files

  • INSTALLATION.md - Comprehensive installation and setup guide
    • Prerequisites and requirements
    • Step-by-step installation
    • Configuration instructions
    • API key setup
    • Troubleshooting section

📁 Examples Directory

Added complete examples/ folder with 12+ practical examples:

Basic Examples

  • 01-basic-client.php - Client initialization and connection testing
  • 02-market-data.php - Fetching tickers, orderbook, and klines
  • 03-account-info.php - Account balance and fee information

Order Management

  • 04-place-order.php - Placing limit, market, and conditional orders
  • 05-manage-orders.php - Getting, amending, and canceling orders

Position Management

  • 07-positions.php - Viewing and monitoring positions
  • 08-leverage.php - Setting leverage and position modes
  • 09-trading-stops.php - Managing Take Profit and Stop Loss

WebSocket Examples

  • 10-websocket-public.php - Public stream subscriptions
  • 11-websocket-private.php - Private account updates
  • 12-websocket-advanced.php - Advanced multi-symbol monitoring

Laravel Examples

  • laravel/TradingController.php - Controller with DI and facades
  • laravel/BybitWebSocketCommand.php - Artisan command for WebSocket
  • laravel/routes.example.php - API route examples

Configuration

  • config.example.php - Example configuration template
  • README.md - Examples documentation

🔧 Infrastructure

  • .gitignore - Added comprehensive gitignore file
    • Vendor directory exclusion
    • IDE files (VSCode, PHPStorm)
    • Environment files
    • Build artifacts
    • Logs and cache
    • Example configuration files

📦 Dependencies

  • Added: textalk/websocket: ^1.6 - WebSocket client library for real-time streaming

🔄 Updated Files

  • composer.json - Added WebSocket dependency and facade alias
  • src/BybitServiceProvider.php - Registered WebSocket client
  • src/BybitClient.php - Added new REST API methods
  • CHANGELOG.md - Updated with v0.2.0 changes

📖 API Coverage

The SDK now covers the following Bybit V5 API endpoints:

Market Data:

  • ✅ Server Time
  • ✅ Tickers
  • ✅ Orderbook
  • ✅ Klines
  • ✅ Risk Limit

Trading:

  • ✅ Place Order
  • ✅ Amend Order
  • ✅ Cancel Order
  • ✅ Cancel All Orders
  • ✅ Get Open Orders
  • ✅ Get Order History

Position:

  • ✅ Get Positions
  • ✅ Set Leverage
  • ✅ Switch Position Mode
  • ✅ Set Trading Stop

Account:

  • ✅ Get Wallet Balance
  • ✅ Get Fee Rate

WebSocket:

  • ✅ Public: Orderbook, Trade, Ticker, Kline
  • ✅ Private: Position, Order, Execution, Wallet

🎯 Usage Highlights

Quick Start with WebSocket

use Tigusigalpa\ByBit\BybitWebSocket;

$ws = new BybitWebSocket(
    apiKey: null,
    apiSecret: null,
    testnet: false,
    region: 'global',
    isPrivate: false
);

$ws->subscribeOrderbook('BTCUSDT', 50);
$ws->subscribeTrade('BTCUSDT');

$ws->onMessage(function($data) {
    print_r($data);
});

$ws->listen();

Laravel WebSocket Command

php artisan bybit:listen BTCUSDT

🔗 Links

🙏 Acknowledgments

Special thanks to the Bybit team for their comprehensive API documentation and to the crypto trading community for their feedback and support.

📝 Notes

  • All WebSocket streams support both Testnet and Mainnet environments
  • Regional endpoints are fully supported for both REST and WebSocket
  • Examples include comprehensive error handling
  • All code follows PSR-12 coding standards

⚠️ Breaking Changes

None. This release is fully backward compatible with v0.1.0.

🐛 Bug Fixes

  • Improved error handling in WebSocket connections
  • Fixed signature generation for edge cases
  • Enhanced timestamp synchronization

🔜 Coming Soon

  • Retry mechanisms for failed requests
  • Rate limit handling
  • Request logging and tracing
  • Additional helper methods for common trading patterns

Full Changelog: v0.1.0...v1.1.4

v0.1.0

Choose a tag to compare

@tigusigalpa tigusigalpa released this 18 Jan 04:27