The detailed API documentation can be found here https://bybit-exchange.github.io/docs/v5/intro. In order to receive the latest API change notifications, please Watch
this repository.
This project is under development, and already used in production, but only the main API's are covered. I promise I'll do my best to complete the client with all ByBit V5 API's, but if you have time, any contributions are welcome!
Actually the API's completion status are the following:
API Name | Completed | Since | Doc Ref |
---|---|---|---|
Market API | 100% | v0.1.0 | Market API Doc |
Trade API | 100% | v0.1.0 | Trade API Doc |
Position API | 100% | v0.1.0 | Position API Doc |
Pre-Upgrade API | 100% | v0.2.0 | Pre-Upgrade API Doc |
Account API | 100% | v0.1.0 | Account API Doc |
Asset API | 100% | v0.2.0 | Asset API Doc |
User API | 100% | v0.1.0 | Asset API Doc |
Spot Leverage Token | 100% | v0.3.0 | Spot Leverage Token API Doc |
Spot Margin Trade (UTA) | 100% | v0.4.0 | Spot Margin Trade (UTA) API Doc |
Spot Margin Trade (Normal) | 100% | v0.4.0 | Spot Margin Trade (Normal) API Doc |
Institutional Lending | 100% | v0.5.0 | Institutional Lending API Doc |
C2C Lending | 100% | v0.5.0 | C2C Lending API Doc |
Broker | 100% | v0.6.0 | Broker API Doc |
WebSocket Stream | 0% | WebSocket Stream API Doc |
composer require goodmagma/bybit-php-api
include '../vendor/autoload.php';
use ByBit\SDK\ByBitApi;
//create public API on real environment
$bybitApi = new ByBitApi();
//create public API on sandbox environment
$bybitApi = new ByBitApi('', '', true);
include '../vendor/autoload.php';
use ByBit\SDK\ByBitApi;
//Input your API Key
$api_key = 'XXXXXXXXXX';
//Input your Secret Key
$api_secret = 'XXXXXXXXXX';
//Environment
$sandbox = true;
//create private API
$bybitApi = new ByBitApi($api_key, $api_secret, $sandbox);
// Get Position Info
$params = ["category" => "linear", "symbol" => "BTCUSDT"];
$positions = $bybitApi->positionApi()->getPositionInfo($params);
var_dump($positions);
Go to examples
directory and copy key_secret.php.sample
to key_secret.php
.
Configure key_secret.php
with your API Keys and run example like:
php Position.php
Contributions are what makes the open source community such an amazing place to learn, inspire and create. Any contributions you make are greatly appreciated.
- Give us a star ⭐
- Fork and Clone! Awesome
- Select existing issues or create a new issue and give us a PR with your bugfix or improvement after. We love it ❤️
If you want to make a PR:
- Fork the Project and checkout
develop
branch - Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.