BybitApi - JavaScript client for bybit_api
REST API for the Bybit Exchange. Base URI: [https://api-testnet.bybit.com]
This SDK is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.JavascriptClientCodegen
For Node.js
To publish the library as a npm, please follow the procedure in "Publishing npm packages".
Then install it via:
npm install bybit_api --saveTo use the library locally without publishing to a remote npm registry, first install the dependencies by changing
into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:
npm installNext, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:
npm linkFinally, switch to the directory you want to use your bybit_api from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>You should now be able to require('bybit_api') in javascript files from the directory you ran the last
command above from.
If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:
npm install GIT_USER_ID/GIT_REPO_ID --saveThe library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify,
perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually
use this library):
browserify main.js > bundle.jsThen include bundle.js in the HTML pages.
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}Please follow the installation instruction and execute the following JS code:
var BybitApi = require('bybit_api');
var defaultClient = BybitApi.ApiClient.instance;
// Configure API key authorization: apiKey
var apiKey = defaultClient.authentications['apiKey'];
apiKey.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiKey.apiKeyPrefix['api_key'] = "Token"
// Configure API key authorization: apiSignature
var apiSignature = defaultClient.authentications['apiSignature'];
apiSignature.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//apiSignature.apiKeyPrefix['sign'] = "Token"
// Configure API key authorization: timestamp
var timestamp = defaultClient.authentications['timestamp'];
timestamp.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//timestamp.apiKeyPrefix['timestamp'] = "Token"
var api = new BybitApi.APIkeyApi()
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.aPIkeyInfo(callback);All URIs are relative to https://api-testnet.bybit.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| BybitApi.APIkeyApi | aPIkeyInfo | GET /open-api/api-key | Get account api-key information. |
| BybitApi.CommonApi | commonGet | GET /v2/public/time | Get bybit server time. |
| BybitApi.ConditionalApi | conditionalCancel | POST /open-api/stop-order/cancel | Cancel conditional order. |
| BybitApi.ConditionalApi | conditionalCancelAll | POST /v2/private/stop-order/cancelAll | Cancel conditional order. |
| BybitApi.ConditionalApi | conditionalGetOrders | GET /open-api/stop-order/list | Get my conditional order list. |
| BybitApi.ConditionalApi | conditionalNew | POST /open-api/stop-order/create | Place a new conditional order. |
| BybitApi.ConditionalApi | conditionalReplace | POST /open-api/stop-order/replace | Replace conditional order. Only incomplete orders can be modified. |
| BybitApi.ExecutionApi | executionGetTrades | GET /v2/private/execution/list | Get user’s trade records. |
| BybitApi.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. |
| BybitApi.FundingApi | fundingPredicted | GET /open-api/funding/predicted-funding | Get predicted funding rate and funding fee. |
| BybitApi.FundingApi | fundingPredictedRate | GET /open-api/funding/prev-funding-rate | Get predicted funding rate and funding fee. |
| BybitApi.KlineApi | klineGet | GET /v2/public/kline/list | Query historical kline. |
| BybitApi.MarketApi | marketOrderbook | GET /v2/public/orderBook/L2 | Get the orderbook. |
| BybitApi.MarketApi | marketSymbolInfo | GET /v2/public/tickers | Get the latest information for symbol. |
| BybitApi.OrderApi | orderCancel | POST /open-api/order/cancel | Get my active order list. |
| BybitApi.OrderApi | orderCancelAll | POST /v2/private/order/cancelAll | Get my active order list. |
| BybitApi.OrderApi | orderCancelV2 | POST /v2/private/order/cancel | Get my active order list. |
| BybitApi.OrderApi | orderGetOrders | GET /open-api/order/list | Get my active order list. |
| BybitApi.OrderApi | orderNew | POST /open-api/order/create | Place active order |
| BybitApi.OrderApi | orderNewV2 | POST /v2/private/order/create | Place active order |
| BybitApi.OrderApi | orderQuery | GET /v2/private/order | Get my active order list. |
| BybitApi.OrderApi | orderReplace | POST /open-api/order/replace | Replace active order. Only incomplete orders can be modified. |
| BybitApi.PositionsApi | positionsChangeMargin | POST /position/change-position-margin | Update margin. |
| BybitApi.PositionsApi | positionsMyPosition | GET /position/list | Get my position list. |
| BybitApi.PositionsApi | positionsMyPositionV2 | GET /v2/private/position/list | Get my position list. |
| BybitApi.PositionsApi | positionsSaveLeverage | POST /user/leverage/save | Change user leverage. |
| BybitApi.PositionsApi | positionsTradingStop | POST /open-api/position/trading-stop | Set Trading-Stop Condition. |
| BybitApi.PositionsApi | positionsUserLeverage | GET /user/leverage | Get user leverage setting. |
| BybitApi.SymbolApi | symbolGet | GET /v2/public/symbols | Query Symbols. |
| BybitApi.WalletApi | walletGetBalance | GET /v2/private/wallet/balance | get wallet balance info |
| BybitApi.WalletApi | walletGetRecords | GET /open-api/wallet/fund/records | Get wallet fund records |
| BybitApi.WalletApi | walletGetRiskLimit | GET /open-api/wallet/risk-limit/list | Get risk limit. |
| BybitApi.WalletApi | walletSetRiskLimit | POST /open-api/wallet/risk-limit | Set risk limit |
| BybitApi.WalletApi | walletWithdraw | GET /open-api/wallet/withdraw/list | Get wallet fund records |
- BybitApi.APIKeyBase
- BybitApi.APIKeyInfo
- BybitApi.ConditionalBase
- BybitApi.ConditionalCancelAllBase
- BybitApi.ConditionalCancelAllRes
- BybitApi.ConditionalOrdersRes
- BybitApi.ConditionalOrdersResBase
- BybitApi.ConditionalRes
- BybitApi.ExtFields
- BybitApi.FundRecordBase
- BybitApi.FundingFeeBase
- BybitApi.FundingFeeRes
- BybitApi.FundingPredicted
- BybitApi.FundingPredictedBase
- BybitApi.FundingRate
- BybitApi.FundingRateBase
- BybitApi.FundingRecords
- BybitApi.GetRiskLimitRes
- BybitApi.KlineBase
- BybitApi.KlineRes
- BybitApi.Leverage
- BybitApi.LeverageInfo
- BybitApi.LeverageResult
- BybitApi.LotSizeFilter
- BybitApi.OderBookRes
- BybitApi.OrderBookBase
- BybitApi.OrderCancelAllBase
- BybitApi.OrderCancelAllRes
- BybitApi.OrderCancelBase
- BybitApi.OrderListBase
- BybitApi.OrderListData
- BybitApi.OrderRes
- BybitApi.OrderResBase
- BybitApi.Position
- BybitApi.PositionInfo
- BybitApi.PriceFilter
- BybitApi.QueryOrderBase
- BybitApi.QueryOrderRes
- BybitApi.ReplaceConditionalBase
- BybitApi.ReplaceOrderBase
- BybitApi.RiskIDRes
- BybitApi.RiskLimitBase
- BybitApi.RiskLimitRes
- BybitApi.ServerTime
- BybitApi.SetRiskLimitBase
- BybitApi.SymbolInfo
- BybitApi.SymbolInfoBase
- BybitApi.SymbolTickInfo
- BybitApi.Symbols
- BybitApi.TradeRecords
- BybitApi.TradeRecordsBase
- BybitApi.TradeRecordsInfo
- BybitApi.TradingStopBase
- BybitApi.TradingStopRes
- BybitApi.WalletBalance
- BybitApi.WalletBalanceBase
- BybitApi.WithdrawRecords
- BybitApi.WithdrawResBase
- Type: API key
- API key parameter name: api_key
- Location: URL query string
- Type: API key
- API key parameter name: sign
- Location: URL query string
- Type: API key
- API key parameter name: timestamp
- Location: URL query string