dmitxe/bybit-exchange

1.0 2020-06-25 13:07 UTC

This package is auto-updated.

Last update: 2024-04-08 14:02:01 UTC


README

REST API for the Bybit Exchange. Base URI: [https://api-testnet.bybit.com]

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Build package: io.swagger.codegen.languages.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: apiKey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer');
// Configure API key authorization: apiSignature
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('sign', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('sign', 'Bearer');
// Configure API key authorization: timestamp
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('timestamp', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('timestamp', 'Bearer');

$apiInstance = new Swagger\Client\Api\APIkeyApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->aPIkeyInfo();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling APIkeyApi->aPIkeyInfo: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://api-testnet.bybit.com

Class Method HTTP request Description
APIkeyApi aPIkeyInfo GET /open-api/api-key Get account api-key information.
CommonApi commonGet GET /v2/public/time Get bybit server time.
ConditionalApi conditionalCancel POST /open-api/stop-order/cancel Cancel conditional order.
ConditionalApi conditionalCancelAll POST /v2/private/stop-order/cancelAll Cancel conditional order.
ConditionalApi conditionalGetOrders GET /open-api/stop-order/list Get my conditional order list.
ConditionalApi conditionalNew POST /open-api/stop-order/create Place a new conditional order.
ConditionalApi conditionalReplace POST /open-api/stop-order/replace Replace conditional order. Only incomplete orders can be modified.
ExecutionApi executionGetTrades GET /v2/private/execution/list Get user’s trade records.
FundingApi fundingGetRate GET /open-api/funding/prev-funding Funding settlement occurs every 8 hours at 00:00 UTC, 08:00 UTC and 16:00 UTC. The current interval's fund fee settlement is based on the previous interval's fund rate. For example, at 16:00, the settlement is based on the fund rate generated at 8:00. The fund rate generated at 16:00 will be used at 0:00 on the next day.
FundingApi fundingPredicted GET /open-api/funding/predicted-funding Get predicted funding rate and funding fee.
FundingApi fundingPredictedRate GET /open-api/funding/prev-funding-rate Get predicted funding rate and funding fee.
KlineApi klineGet GET /v2/public/kline/list Query historical kline.
LinearOrderApi linearOrderNew POST /private/linear/order/create Create Order
MarketApi marketOrderbook GET /v2/public/orderBook/L2 Get the orderbook.
MarketApi marketSymbolInfo GET /v2/public/tickers Get the latest information for symbol.
OrderApi orderCancel POST /open-api/order/cancel Get my active order list.
OrderApi orderCancelAll POST /v2/private/order/cancelAll Get my active order list.
OrderApi orderCancelV2 POST /v2/private/order/cancel Get my active order list.
OrderApi orderGetOrders GET /open-api/order/list Get my active order list.
OrderApi orderNew POST /open-api/order/create Place active order
OrderApi orderNewV2 POST /v2/private/order/create Place active order
OrderApi orderQuery GET /v2/private/order Get my active order list.
OrderApi orderReplace POST /open-api/order/replace Replace active order. Only incomplete orders can be modified.
PositionsApi positionsChangeMargin POST /position/change-position-margin Update margin.
PositionsApi positionsMyPosition GET /position/list Get my position list.
PositionsApi positionsMyPositionV2 GET /v2/private/position/list Get my position list.
PositionsApi positionsSaveLeverage POST /user/leverage/save Change user leverage.
PositionsApi positionsTradingStop POST /open-api/position/trading-stop Set Trading-Stop Condition.
PositionsApi positionsUserLeverage GET /user/leverage Get user leverage setting.
SymbolApi symbolGet GET /v2/public/symbols Query Symbols.
WalletApi walletGetBalance GET /v2/private/wallet/balance get wallet balance info
WalletApi walletGetRecords GET /open-api/wallet/fund/records Get wallet fund records
WalletApi walletGetRiskLimit GET /open-api/wallet/risk-limit/list Get risk limit.
WalletApi walletSetRiskLimit POST /open-api/wallet/risk-limit Set risk limit
WalletApi walletWithdraw GET /open-api/wallet/withdraw/list Get wallet fund records

Documentation For Models

Documentation For Authorization

apiKey

  • Type: API key
  • API key parameter name: api_key
  • Location: URL query string

apiSignature

  • Type: API key
  • API key parameter name: sign
  • Location: URL query string

timestamp

  • Type: API key
  • API key parameter name: timestamp
  • Location: URL query string

Author

support@bybit.com