Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Latest commit

 

History

History

objc

SwaggerClient

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

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

  • API version: 0.2.10
  • 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/SWGAccountRatio.h>
#import <SwaggerClient/SWGAccountRatioInfo.h>
#import <SwaggerClient/SWGAnnouncement.h>
#import <SwaggerClient/SWGAnnouncementInfo.h>
#import <SwaggerClient/SWGBigDeal.h>
#import <SwaggerClient/SWGBigDealInfo.h>
#import <SwaggerClient/SWGClosedPnlBase.h>
#import <SwaggerClient/SWGClosedPnlInfo.h>
#import <SwaggerClient/SWGConditionalCancelAllBase.h>
#import <SwaggerClient/SWGConditionalCancelAllRes.h>
#import <SwaggerClient/SWGConditionalOrdersRes.h>
#import <SwaggerClient/SWGConditionalOrdersResBase.h>
#import <SwaggerClient/SWGConditionalRes.h>
#import <SwaggerClient/SWGExchangeOrderList.h>
#import <SwaggerClient/SWGExchangeOrderListBase.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/SWGGetRiskLimitRes.h>
#import <SwaggerClient/SWGKlineBase.h>
#import <SwaggerClient/SWGKlineRes.h>
#import <SwaggerClient/SWGLCPInfo.h>
#import <SwaggerClient/SWGLCPInfoBase.h>
#import <SwaggerClient/SWGLeverage.h>
#import <SwaggerClient/SWGLeverageInfo.h>
#import <SwaggerClient/SWGLeverageResult.h>
#import <SwaggerClient/SWGLinearCancelOrderResult.h>
#import <SwaggerClient/SWGLinearCancelOrderResultBase.h>
#import <SwaggerClient/SWGLinearCancelStopOrderResult.h>
#import <SwaggerClient/SWGLinearCancelStopOrderResultBase.h>
#import <SwaggerClient/SWGLinearClosePnlRecordsResponse.h>
#import <SwaggerClient/SWGLinearClosedPnlRecordResult.h>
#import <SwaggerClient/SWGLinearCreateOrderResult.h>
#import <SwaggerClient/SWGLinearCreateOrderResultBase.h>
#import <SwaggerClient/SWGLinearCreateStopOrderResult.h>
#import <SwaggerClient/SWGLinearCreateStopOrderResultBase.h>
#import <SwaggerClient/SWGLinearFundingPredicted.h>
#import <SwaggerClient/SWGLinearFundingPredictedBase.h>
#import <SwaggerClient/SWGLinearKlineResp.h>
#import <SwaggerClient/SWGLinearKlineRespBase.h>
#import <SwaggerClient/SWGLinearListOrderResult.h>
#import <SwaggerClient/SWGLinearListStopOrderResult.h>
#import <SwaggerClient/SWGLinearOrderCancelAllBase.h>
#import <SwaggerClient/SWGLinearOrderRecordsResponse.h>
#import <SwaggerClient/SWGLinearOrderRecordsResponseBase.h>
#import <SwaggerClient/SWGLinearOrderReplace.h>
#import <SwaggerClient/SWGLinearPositionListResult.h>
#import <SwaggerClient/SWGLinearPositionListResultBase.h>
#import <SwaggerClient/SWGLinearPrevFundingRateResp.h>
#import <SwaggerClient/SWGLinearPrevFundingRateRespBase.h>
#import <SwaggerClient/SWGLinearPrevFundingResp.h>
#import <SwaggerClient/SWGLinearPrevFundingRespBase.h>
#import <SwaggerClient/SWGLinearRecentTradingRecordResp.h>
#import <SwaggerClient/SWGLinearRecentTradingRecordRespBase.h>
#import <SwaggerClient/SWGLinearRiskLimitResp.h>
#import <SwaggerClient/SWGLinearRiskLimitRespBase.h>
#import <SwaggerClient/SWGLinearSearchOrderResult.h>
#import <SwaggerClient/SWGLinearSearchOrderResultBase.h>
#import <SwaggerClient/SWGLinearSearchStopOrderResult.h>
#import <SwaggerClient/SWGLinearSearchStopOrderResultBase.h>
#import <SwaggerClient/SWGLinearSetLeverageResult.h>
#import <SwaggerClient/SWGLinearSetMarginResult.h>
#import <SwaggerClient/SWGLinearSetMarginResultBase.h>
#import <SwaggerClient/SWGLinearSetTradingStopResult.h>
#import <SwaggerClient/SWGLinearStopOrderCancelAllBase.h>
#import <SwaggerClient/SWGLinearStopOrderRecordsResponse.h>
#import <SwaggerClient/SWGLinearStopOrderRecordsResponseBase.h>
#import <SwaggerClient/SWGLinearStopOrderReplace.h>
#import <SwaggerClient/SWGLinearSwitchIsolatedResult.h>
#import <SwaggerClient/SWGLinearSwitchModeResult.h>
#import <SwaggerClient/SWGLinearTradeRecordItem.h>
#import <SwaggerClient/SWGLinearTradeRecordsResponse.h>
#import <SwaggerClient/SWGLiqRecords.h>
#import <SwaggerClient/SWGLiqRecordsInfo.h>
#import <SwaggerClient/SWGLotSizeFilter.h>
#import <SwaggerClient/SWGMarkPriceKlineBase.h>
#import <SwaggerClient/SWGMarkPriceKlineInfo.h>
#import <SwaggerClient/SWGOderBookRes.h>
#import <SwaggerClient/SWGOpenInterest.h>
#import <SwaggerClient/SWGOpenInterestInfo.h>
#import <SwaggerClient/SWGOrderBookBase.h>
#import <SwaggerClient/SWGOrderCancelAllBase.h>
#import <SwaggerClient/SWGOrderCancelAllRes.h>
#import <SwaggerClient/SWGOrderCancelBase.h>
#import <SwaggerClient/SWGOrderIdRes.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/SWGRiskIDRes.h>
#import <SwaggerClient/SWGRiskLimitBase.h>
#import <SwaggerClient/SWGRiskLimitRes.h>
#import <SwaggerClient/SWGServerTime.h>
#import <SwaggerClient/SWGSetRiskLimitBase.h>
#import <SwaggerClient/SWGStopOrderOrdersResBase.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/SWGTradingRecords.h>
#import <SwaggerClient/SWGTradingRecordsInfo.h>
#import <SwaggerClient/SWGTradingStopBase.h>
#import <SwaggerClient/SWGTradingStopRes.h>
#import <SwaggerClient/SWGV2CancelOrderBase.h>
#import <SwaggerClient/SWGV2ConditionalBase.h>
#import <SwaggerClient/SWGV2ConditionalListRes.h>
#import <SwaggerClient/SWGV2ConditionalRes.h>
#import <SwaggerClient/SWGV2OrderListBase.h>
#import <SwaggerClient/SWGV2OrderListData.h>
#import <SwaggerClient/SWGV2OrderRes.h>
#import <SwaggerClient/SWGWalletBalance.h>
#import <SwaggerClient/SWGWalletBalanceBase.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/SWGLinearConditionalApi.h>
#import <SwaggerClient/SWGLinearExecutionApi.h>
#import <SwaggerClient/SWGLinearFundingApi.h>
#import <SwaggerClient/SWGLinearKlineApi.h>
#import <SwaggerClient/SWGLinearMarketApi.h>
#import <SwaggerClient/SWGLinearOrderApi.h>
#import <SwaggerClient/SWGLinearPositionsApi.h>
#import <SwaggerClient/SWGLinearWalletApi.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.bybit.com

Class Method HTTP request Description
SWGAPIkeyApi aPIkeyInfo GET /open-api/api-key Get account api-key information.
SWGCommonApi commonAnnouncements GET /v2/public/announcement Get Bybit OpenAPI announcements in the last 30 days in reverse order.
SWGCommonApi commonGetLcp GET /v2/private/account/lcp Query LCP info.
SWGCommonApi commonGetTime GET /v2/public/time Get bybit server time.
SWGConditionalApi conditionalCancel POST /v2/private/stop-order/cancel Cancel conditional order.
SWGConditionalApi conditionalCancelAll POST /v2/private/stop-order/cancelAll Cancel conditional order.
SWGConditionalApi conditionalGetOrders GET /v2/private/stop-order/list Get my conditional order list.
SWGConditionalApi conditionalNew POST /v2/private/stop-order/create Place a new conditional order.
SWGConditionalApi conditionalQuery GET /v2/private/stop-order Query real-time stop order information.
SWGConditionalApi conditionalReplace POST /v2/private/stop-order/replace Replace conditional order. Only incomplete orders can be modified.
SWGExecutionApi executionGetTrades GET /v2/private/execution/list Get user’s trade records.
SWGExecutionApi positionsClosePnlRecords GET /v2/private/trade/closed-pnl/list Get user's closed profit and loss records
SWGFundingApi fundingMyLastFee 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 fundingPrevRate GET /open-api/funding/prev-funding-rate Get predicted funding rate and funding fee.
SWGKlineApi klineGet GET /v2/public/kline/list Query historical kline.
SWGKlineApi klineMarkPrice GET /v2/public/mark-price-kline Query mark price kline.
SWGLinearConditionalApi linearConditionalCancel POST /private/linear/stop-order/cancel Cancel Active Order
SWGLinearConditionalApi linearConditionalCancelAll POST /private/linear/stop-order/cancel-all Cancel all stop orders.
SWGLinearConditionalApi linearConditionalGetOrders GET /private/linear/stop-order/list Get linear Stop Orders
SWGLinearConditionalApi linearConditionalNew POST /private/linear/stop-order/create Create linear stop Order
SWGLinearConditionalApi linearConditionalQuery GET /private/linear/stop-order/search Get Stop Orders(real-time)
SWGLinearConditionalApi linearConditionalReplace POST /private/linear/stop-order/replace Replace conditional order
SWGLinearExecutionApi linearExecutionGetTrades GET /private/linear/trade/execution/list Get user's trading records.
SWGLinearFundingApi linearFundingMyLastFee GET /private/linear/funding/prev-funding Get prev funding
SWGLinearFundingApi linearFundingPredicted GET /private/linear/funding/predicted-funding Get predicted funding rate and funding fee.
SWGLinearFundingApi linearFundingPrevRate GET /public/linear/funding/prev-funding-rate Get prev funding
SWGLinearKlineApi linearKlineGet GET /public/linear/kline Get kline
SWGLinearKlineApi linearKlineMarkPrice GET /public/linear/mark-price-kline Get kline
SWGLinearMarketApi linearMarketTrading GET /public/linear/recent-trading-records Get recent trades
SWGLinearOrderApi linearOrderCancel POST /private/linear/order/cancel Cancel Active Order
SWGLinearOrderApi linearOrderCancelAll POST /private/linear/order/cancel-all Cancel all active orders.
SWGLinearOrderApi linearOrderGetOrders GET /private/linear/order/list Get linear Active Orders
SWGLinearOrderApi linearOrderNew POST /private/linear/order/create Create Active Order
SWGLinearOrderApi linearOrderQuery GET /private/linear/order/search Get Active Orders(real-time)
SWGLinearOrderApi linearOrderReplace POST /private/linear/order/replace Replace Active Order
SWGLinearPositionsApi linearPositionsChangeMargin POST /private/linear/position/add-margin Add/Reduce Margin
SWGLinearPositionsApi linearPositionsClosePnlRecords GET /private/linear/trade/closed-pnl/list Get user's closed profit and loss records.
SWGLinearPositionsApi linearPositionsMyPosition GET /private/linear/position/list Get my position list.
SWGLinearPositionsApi linearPositionsSaveLeverage POST /private/linear/position/set-leverage Set leverage
SWGLinearPositionsApi linearPositionsSetAutoAddMargin POST /private/linear/position/set-auto-add-margin Set auto add margin
SWGLinearPositionsApi linearPositionsSwitchIsolated POST /private/linear/position/switch-isolated Switch isolated
SWGLinearPositionsApi linearPositionsSwitchMode POST /private/linear/tpsl/switch-mode Switch Mode
SWGLinearPositionsApi linearPositionsTradingStop POST /private/linear/position/trading-stop Set tradingStop
SWGLinearWalletApi linearWalletGetRiskLimit GET /public/linear/risk-limit Get risk limit.
SWGMarketApi marketAccountRatio GET /v2/public/account-ratio Query Account Long Short Ratio
SWGMarketApi marketBigDeal GET /v2/public/big-deal Query Big Deal
SWGMarketApi marketLiqRecords GET /v2/public/liq-records Query liq records.
SWGMarketApi marketOpenInterest GET /v2/public/open-interest Query Open Interest
SWGMarketApi marketOrderbook GET /v2/public/orderBook/L2 Get the orderbook.
SWGMarketApi marketSymbolInfo GET /v2/public/tickers Get the latest information for symbol.
SWGMarketApi marketTradingRecords GET /v2/public/trading-records Get recent trades
SWGOrderApi orderCancel POST /v2/private/order/cancel Get my active order list.
SWGOrderApi orderCancelAll POST /v2/private/order/cancelAll Get my active order list.
SWGOrderApi orderGetOrders GET /v2/private/order/list Get my active order list.
SWGOrderApi orderNew POST /v2/private/order/create Place active order
SWGOrderApi orderQuery GET /v2/private/order Get my active order list.
SWGOrderApi orderReplace POST /v2/private/order/replace Replace active order. Only incomplete orders can be modified.
SWGPositionsApi positionsChangeMargin POST /position/change-position-margin Update margin.
SWGPositionsApi positionsClosePnlRecords GET /v2/private/trade/closed-pnl/list Get user's closed profit and loss records
SWGPositionsApi positionsMyPosition GET /v2/private/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.
SWGSymbolApi symbolGet GET /v2/public/symbols Query Symbols.
SWGWalletApi walletExchangeOrder GET /v2/private/exchange-order/list Asset Exchange Records
SWGWalletApi walletGetBalance GET /v2/private/wallet/balance get wallet balance info
SWGWalletApi walletGetRecords GET /open-api/wallet/fund/records Get wallet fund records
SWGWalletApi walletGetRiskLimit GET /open-api/wallet/risk-limit/list Get risk limit.
SWGWalletApi walletSetRiskLimit POST /open-api/wallet/risk-limit Set risk limit
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

[email protected]