bgapi
v1.0.1
Published
A simple Bitget.com api for Node.js to access REST API.
Readme
About
A simple Bitget.com api for Node.js to access REST API.
Usage example 1 (api class)
const api = require('bgapi')
let ac = new api(<apiKey>, <secret>);
async function test(){
let r = await ac.get('/api/v3/account/assets')
console.log(r) // {accountEquity: 100,..}
}
test()Usage example 2 (call function)
const {call} = require('bgapi')
let apiKey = <apiKey>;
let secret = <secretKey>;
let pass = <passphrase>;
async function test(){
let data = ''
let r = await call('/api/v3/account/assets', {data, apiKey, secret, pass})
console.log(r) // {accountEquity: 100,..}
}
test()Installation
npm i bgapi
Parameters (call function)
function call(path, {data, apiKey, secret, pass, method} )
- path = eg: "/api/v3/account/assets" ref
- apiKey = Bitget.com apiKey
- secret = Bitget.com api secret
- optional
- data = params to be passed in, can be object {symbol:'BTCUSDT'}
- method = "GET" (default) OR "POST"
Parameters (api function)
api.get(path[, data])
api.post(path[, data])
- data (optional) = refer above
return
return object (result from Bitget.io api)
