You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

bitget-openapi-top

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitget-openapi-top

## 安装

1.0.1
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

使用说明

安装

npm i bitget-openapi-top

本地运行

git clone https://github.com/BitgetLimited/v3-bitget-api-sdk.git
cd v3-bitget-api-sdk/bitget-node-sdk-api
npm run install
npm run build

测试用例

文件名说明
__test__/mixapi.spec.ts合约相关测试用例
__test__/spotapi.spec.ts现货相关测试用例
__test__/websocketTest.spec.ts消息推送相关测试用例

API示例

const bitgetApi = require('bitget-openapi');
const { test, describe, expect } = require('@jest/globals')
const   Console  = require('console')

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-openapi")
var Console = require("console")

const apiKey = '';
const secretKey = '';
const passphrase = '';
//处理消息的实现类
class ListennerObj extends bitgetApi.default.Listenner{
    reveice(message){
        Console.info('>>>'+message);
    }
}

const listenner = new ListennerObj();
const bitgetWsClient = new bitgetApi.default.BitgetWsClient(listenner,apiKey,secretKey,passphrase);
const subArr = new Array();

const subscribeOne = new bitgetApi.default.SubscribeReq('mc','ticker','BTCUSD');
const subscribeTow = new bitgetApi.default.SubscribeReq('SP','candle1W','BTCUSDT');

subArr.push(subscribeOne);
subArr.push(subscribeTow);

bitgetWsClient.subscribe(subArr)

FAQs

Package last updated on 05 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts