bitmex-ts-api
v3.0.17
Published
bitmex Api
Downloads
9
Readme
bitmex-api
An unofficial node.js wrapper for the BitMEX Bitcoin derivatives exchange useing typescript; ##Getting Started
Installation:
npm install bitmex-ts-api --save
Usage:
import {bitmexTest,bitmex,bitmexDef} from "bitmex-ts-api"
var bitmexIns = isTest ? new bitmexTest(false, apiKeyID, apiKeySecret, option) : new bitmex(false, apiKeyID, apiKeySecret, option);
bitmexIns.on_EVENT_POSITION_UPDATE((data) => { on_EVENT_POSITION_UPDATE(data) });
bitmexIns.on_EVENT_ORDER_EXEC((data) => { on_EVENT_ORDER_EXEC(data) });
bitmexIns.on_EVENT_ORDER((data) => { on_EVENT_ORDER(data) });
await bitmexIns.init()
while (false == (await bitmexIns.ready())) {
Log("retry")
}
function on_EVENT_POSITION_UPDATE(data: bitmexDef.positionInfo) {
console.log("do your work")
}
function on_EVENT_ORDER(data: bitmexDef.orderInfo) {
console.log("do your work")
}
function on_EVENT_ORDER_EXEC(data: bitmexDef.executionInfo) {
console.log("do your work")
}