goodmagma / bybit-php-api
PHP SDK for ByBit V5 API
Installs: 1 077
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 1
Forks: 3
Open Issues: 0
Requires
- php: ^7.2.5 || ^8.0
- guzzlehttp/guzzle: ^7.7
This package is auto-updated.
Last update: 2024-10-26 15:08:37 UTC
README
PHP SDK for ByBit V5 API
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.
Implementation Status
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:
Install
composer require goodmagma/bybit-php-api
Getting started
Create Public API Client
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('', '', ByBitApi::PROD_API_URL);
Create Private API Client
include '../vendor/autoload.php'; use ByBit\SDK\ByBitApi; //Your API Key $api_key = 'XXXXXXXXXX'; //Your Secret Key $api_secret = 'XXXXXXXXXX'; //Your Host //$host = ByBit\SDK\ByBitApi::TESTNET_API_URL; //$host = ByBit\SDK\ByBitApi::DEMO_API_URL; $host = ByBit\SDK\ByBitApi::PROD_API_URL; //create private API $bybitApi = new ByBitApi($api_key, $api_secret, $host);
Use API Client
// Get Position Info $params = ["category" => "linear", "symbol" => "BTCUSDT"]; $positions = $bybitApi->positionApi()->getPositionInfo($params); var_dump($positions);
Run Examples
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
Changelog
See CHANGELOG.md for full project log.
Contributing
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
License
Distributed under the MIT License. See LICENSE for more information.