ybit
v1.0.3
Published
Bybit API
Downloads
12
Maintainers
Readme
About
Simple Bybit api for Node.js to access Bybit REST API.
Usage example 1 (api class)
const api = require('ybybit')
let acc = new api(<apiKey>, <secret>);
async function test(){
let r = await acc.get('/v5/account/wallet-balance', {accountType:'UNIFIED'})
console.log(r) // {list[{totalEquity:.., ..}]}
}
test()
Usage example 2 (call function)
const {call} = require('ybybit')
let apiKey = <apiKey>;
let secret = <secret>;
async function test(){
let data = {accountType:'UNIFIED'}
let r = await call('/v5/account/wallet-balance', {data, apiKey, secret})
console.log(r) // {list[{totalEquity:.., ..}]}
}
test()
Installation
npm i ybybit
Parameters (call function)
function call(path, {data, apiKey, secret, method, testnet} )
- path = eg: "/v5/account/wallet-balance" ref
- apiKey = Bybit apiKey
- secret = Bybit api secret
- optional
- data = params to be passed in, can be object (accountType:'UNIFIED') or query string (accountType=UNIFIED&key=value)
- method = "GET" (default) OR "POST"
- testnet = 0 (default) | 1 (to use testnet)
Parameters (api function)
api.get(path[, data][, {testnet}])
api.post(path[, data][, {testnet}])
- data (optional) = refer above
return
return object (result from Bybit api)
global variables
global["x-bapi-limit-status"] // Bybit api remaining limit (per second)
- alt: global.bapi, global.bapiLimit, global.ybitLimit, global.bybitLimit
global["x-bapi-limit"] // Bybit api max limit (50/s)