bitget-node-api
v1.0.7
Published
Node.js/typescript connector for Bidget REST APIs and WebSockets
Downloads
11
Readme
Instructions
Install
npm i bitget-api-node
API
const bitgetApi = require('bitget-api-node')
const { test, describe, expect } = require('@jest/globals')
const apiKey = ''
const secretKey = ''
const passphrase = ''
describe('test accounts', () => {
test('accounts', () => {
const mixAccountApi = new bitgetApi.default.MixAccountApi(apiKey, secretKey, passphrase)
mixAccountApi.accounts('umcbl').then((data) => {
console.info(data)
})
})
})
websocket
var bitgetApi = require('bitget-api-node')
const apiKey = ''
const secretKey = ''
const passphrase = ''
//Implementation class for processing messages
class ListennerObj extends bitgetApi.Listenner {
reveice(message) {
console.info('>>>' + message)
}
}
const listenner = new ListennerObj()
const bitgetWsClient = new bitgetApi.BitgetWsClient(listenner, apiKey, secretKey, passphrase)
const subArr = new Array()
const subscribeOne = new bitgetApi.SubscribeReq('mc', 'ticker', 'BTCUSD')
const subscribeTow = new bitgetApi.SubscribeReq('SP', 'candle1W', 'BTCUSDT')
subArr.push(subscribeOne)
subArr.push(subscribeTow)
bitgetWsClient.subscribe(subArr)