Skip to content

Latest commit

 

History

History
 
 

objc

SwaggerClient

REST API for the Bybit Exchange.

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

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

Requirements

The SDK requires ARC (Automatic Reference Counting) to be enabled in the Xcode project.

Installation & Usage

Install from Github using CocoaPods

Add the following to the Podfile:

pod 'SwaggerClient', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

To specify a particular branch, append , :branch => 'branch-name-here'

To specify a particular commit, append , :commit => '11aa22'

Install from local path using CocoaPods

Put the SDK under your project folder (e.g. /path/to/objc_project/Vendor/SwaggerClient) and then add the following to the Podfile:

pod 'SwaggerClient', :path => 'Vendor/SwaggerClient'

Usage

Import the following:

#import <SwaggerClient/SWGApiClient.h>
#import <SwaggerClient/SWGDefaultConfiguration.h>
// load models
#import <SwaggerClient/SWGAPIKeyBase.h>
#import <SwaggerClient/SWGAPIKeyInfo.h>
#import <SwaggerClient/SWGConditionalBase.h>
#import <SwaggerClient/SWGConditionalOrdersRes.h>
#import <SwaggerClient/SWGConditionalOrdersResBase.h>
#import <SwaggerClient/SWGConditionalRes.h>
#import <SwaggerClient/SWGExtFields.h>
#import <SwaggerClient/SWGFundRecordBase.h>
#import <SwaggerClient/SWGFundingFeeBase.h>
#import <SwaggerClient/SWGFundingFeeRes.h>
#import <SwaggerClient/SWGFundingPredicted.h>
#import <SwaggerClient/SWGFundingPredictedBase.h>
#import <SwaggerClient/SWGFundingRate.h>
#import <SwaggerClient/SWGFundingRateBase.h>
#import <SwaggerClient/SWGFundingRecords.h>
#import <SwaggerClient/SWGKlineBase.h>
#import <SwaggerClient/SWGKlineRes.h>
#import <SwaggerClient/SWGLeverage.h>
#import <SwaggerClient/SWGLeverageInfo.h>
#import <SwaggerClient/SWGLeverageResult.h>
#import <SwaggerClient/SWGLotSizeFilter.h>
#import <SwaggerClient/SWGOderBookRes.h>
#import <SwaggerClient/SWGOrderBookBase.h>
#import <SwaggerClient/SWGOrderCancelBase.h>
#import <SwaggerClient/SWGOrderListBase.h>
#import <SwaggerClient/SWGOrderListData.h>
#import <SwaggerClient/SWGOrderRes.h>
#import <SwaggerClient/SWGOrderResBase.h>
#import <SwaggerClient/SWGPosition.h>
#import <SwaggerClient/SWGPositionInfo.h>
#import <SwaggerClient/SWGPriceFilter.h>
#import <SwaggerClient/SWGQueryOrderBase.h>
#import <SwaggerClient/SWGQueryOrderRes.h>
#import <SwaggerClient/SWGReplaceConditionalBase.h>
#import <SwaggerClient/SWGReplaceOrderBase.h>
#import <SwaggerClient/SWGServerTime.h>
#import <SwaggerClient/SWGSymbolInfo.h>
#import <SwaggerClient/SWGSymbolInfoBase.h>
#import <SwaggerClient/SWGSymbolTickInfo.h>
#import <SwaggerClient/SWGSymbols.h>
#import <SwaggerClient/SWGTradeRecords.h>
#import <SwaggerClient/SWGTradeRecordsBase.h>
#import <SwaggerClient/SWGTradeRecordsInfo.h>
#import <SwaggerClient/SWGTradingStopBase.h>
#import <SwaggerClient/SWGTradingStopRes.h>
#import <SwaggerClient/SWGWithdrawRecords.h>
#import <SwaggerClient/SWGWithdrawResBase.h>
// load API classes for accessing endpoints
#import <SwaggerClient/SWGAPIkeyApi.h>
#import <SwaggerClient/SWGCommonApi.h>
#import <SwaggerClient/SWGConditionalApi.h>
#import <SwaggerClient/SWGExecutionApi.h>
#import <SwaggerClient/SWGFundingApi.h>
#import <SwaggerClient/SWGKlineApi.h>
#import <SwaggerClient/SWGMarketApi.h>
#import <SwaggerClient/SWGOrderApi.h>
#import <SwaggerClient/SWGPositionsApi.h>
#import <SwaggerClient/SWGSymbolApi.h>
#import <SwaggerClient/SWGWalletApi.h>

Recommendation

It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issues.

Getting Started

Please follow the installation procedure and then run the following:

SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];

// Configure API key authorization: (authentication scheme: apiKey)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"];

// Configure API key authorization: (authentication scheme: apiSignature)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"sign"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"sign"];

// Configure API key authorization: (authentication scheme: timestamp)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"timestamp"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"timestamp"];



SWGAPIkeyApi *apiInstance = [[SWGAPIkeyApi alloc] init];

// Get account api-key information.
[apiInstance aPIkeyInfoWithCompletionHandler: 
              ^(NSObject* output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];

Documentation for API Endpoints

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

Class Method HTTP request Description
SWGAPIkeyApi aPIkeyInfo GET /open-api/api-key Get account api-key information.
SWGCommonApi commonGet GET /v2/public/time Get bybit server time.
SWGConditionalApi conditionalCancel POST /open-api/stop-order/cancel Cancel conditional order.
SWGConditionalApi conditionalGetOrders GET /open-api/stop-order/list Get my conditional order list.
SWGConditionalApi conditionalNew POST /open-api/stop-order/create Place a new conditional order.
SWGConditionalApi conditionalReplace POST /open-api/stop-order/replace Replace conditional order. Only incomplete orders can be modified.
SWGExecutionApi executionGetTrades GET /v2/private/execution/list Get user’s trade records.
SWGFundingApi 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.
SWGFundingApi fundingPredicted GET /open-api/funding/predicted-funding Get predicted funding rate and funding fee.
SWGFundingApi fundingPredictedRate GET /open-api/funding/prev-funding-rate Get predicted funding rate and funding fee.
SWGKlineApi klineGet GET /v2/public/kline/list Query historical kline.
SWGMarketApi marketOrderbook GET /v2/public/orderBook/L2 Get the orderbook.
SWGMarketApi marketSymbolInfo GET /v2/public/tickers Get the latest information for symbol.
SWGOrderApi orderCancel POST /open-api/order/cancel Get my active order list.
SWGOrderApi orderGetOrders GET /open-api/order/list Get my active order list.
SWGOrderApi orderNew POST /open-api/order/create Place active order
SWGOrderApi orderQuery GET /v2/private/order Get my active order list.
SWGOrderApi orderReplace POST /open-api/order/replace Replace active order. Only incomplete orders can be modified.
SWGPositionsApi positionsChangeMargin POST /position/change-position-margin Update margin.
SWGPositionsApi positionsMyPosition GET /position/list Get my position list.
SWGPositionsApi positionsSaveLeverage POST /user/leverage/save Change user leverage.
SWGPositionsApi positionsTradingStop POST /open-api/position/trading-stop Set Trading-Stop Condition.
SWGPositionsApi positionsUserLeverage GET /user/leverage Get user leverage setting.
SWGSymbolApi symbolGet GET /v2/public/symbols Query Symbols.
SWGWalletApi walletGetRecords GET /open-api/wallet/fund/records Get wallet fund records
SWGWalletApi 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