binance-api-node
Advanced tools
Comparing version 0.8.18 to 0.8.19
@@ -26,2 +26,6 @@ 'use strict'; | ||
var defaultGetTime = function defaultGetTime() { | ||
return Date.now(); | ||
}; | ||
/** | ||
@@ -129,3 +133,5 @@ * Build query string for uri encoded url based on json object | ||
var apiKey = _ref4.apiKey, | ||
apiSecret = _ref4.apiSecret; | ||
apiSecret = _ref4.apiSecret, | ||
_ref4$getTime = _ref4.getTime, | ||
getTime = _ref4$getTime === undefined ? defaultGetTime : _ref4$getTime; | ||
return function (path) { | ||
@@ -143,3 +149,3 @@ var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
return r.serverTime; | ||
}) : Promise.resolve(Date.now())).then(function (timestamp) { | ||
}) : Promise.resolve(getTime())).then(function (timestamp) { | ||
if (data) { | ||
@@ -146,0 +152,0 @@ delete data.useServerTime; |
// tslint:disable:interface-name | ||
declare module 'binance-api-node' { | ||
export default function (options?: { apiKey: string; apiSecret: string }): Binance; | ||
export default function (options?: { apiKey: string; apiSecret: string, getTime?: () => number | Promise<number> }): Binance; | ||
@@ -189,8 +189,8 @@ export enum ErrorCodes { | ||
depth: (pair: string | string[], callback: (depth: Depth) => void) => Function; | ||
partialDepth: (options: { symbol: string, level: number } | [{ symbol: string, level: number }], callback: (depth: PartialDepth) => void) => Function; | ||
ticker: (pair: string, callback: (ticker: Ticker) => void) => Function; | ||
partialDepth: (options: { symbol: string, level: number } | { symbol: string, level: number }[], callback: (depth: PartialDepth) => void) => Function; | ||
ticker: (pair: string | string[], callback: (ticker: Ticker) => void) => Function; | ||
allTickers: (callback: (tickers: Ticker[]) => void) => Function; | ||
candles: (pair: string, period: string, callback: (ticker: Candle) => void) => Function; | ||
trades: (pairs: string[], callback: (trade: Trade) => void) => Function; | ||
aggTrades: (pairs: string[], callback: (trade: Trade) => void) => Function; | ||
candles: (pair: string | string[], period: string, callback: (ticker: Candle) => void) => Function; | ||
trades: (pairs: string | string[], callback: (trade: Trade) => void) => Function; | ||
aggTrades: (pairs: string | string[], callback: (trade: Trade) => void) => Function; | ||
user: (callback: (msg: OutboundAccountInfo | ExecutionReport) => void) => Function; | ||
@@ -541,16 +541,18 @@ } | ||
interface QueryOrderResult { | ||
symbol: string; | ||
clientOrderId: string; | ||
cummulativeQuoteQty: string, | ||
executedQty: string; | ||
icebergQty: string; | ||
isWorking: boolean; | ||
orderId: number; | ||
clientOrderId: string; | ||
origQty: string; | ||
price: string; | ||
origQty: string; | ||
executedQty: string; | ||
side: OrderSide; | ||
status: OrderStatus; | ||
stopPrice: string; | ||
symbol: string; | ||
time: number; | ||
timeInForce: TimeInForce; | ||
type: string; | ||
side: OrderSide; | ||
stopPrice: string; | ||
icebergQty: string; | ||
time: number; | ||
isWorking: boolean; | ||
updateTime: number; | ||
} | ||
@@ -557,0 +559,0 @@ |
{ | ||
"name": "binance-api-node", | ||
"version": "0.8.18", | ||
"version": "0.8.19", | ||
"description": "A node API wrapper for Binance", | ||
@@ -8,5 +8,6 @@ "main": "dist", | ||
"build": "rimraf dist && babel src -d dist", | ||
"test": "ava", | ||
"prepare": "yarn build", | ||
"test": "ava --timeout=10s", | ||
"cover": "nyc ava", | ||
"report": "npm run cover && nyc report --reporter=text-lcov | coveralls", | ||
"report": "yarn cover && nyc report --reporter=text-lcov | coveralls", | ||
"lint": "eslint src" | ||
@@ -37,2 +38,5 @@ }, | ||
}, | ||
"engines": { | ||
"yarn": ">= 1.0.0" | ||
}, | ||
"ava": { | ||
@@ -39,0 +43,0 @@ "require": [ |
@@ -29,2 +29,3 @@ # binance-api-node [![build](https://img.shields.io/travis/HyperCubeProject/binance-api-node.svg?style=flat-square)](https://travis-ci.org/HyperCubeProject/binance-api-node) [![cover](https://img.shields.io/coveralls/HyperCubeProject/binance-api-node.svg?style=flat-square)](https://coveralls.io/github/HyperCubeProject/binance-api-node) [![bnb](https://img.shields.io/badge/binance-winner-yellow.svg?style=flat-square)](https://github.com/binance-exchange/binance-api-node) | ||
apiSecret: 'xxx', | ||
getTime: xxx // time generator function, optional, defaults to () => Date.now() | ||
}) | ||
@@ -516,4 +517,4 @@ | ||
console.log(await client.getOrder({ | ||
symbol: 'ETHBTC', | ||
orderId: 1, | ||
symbol: 'BNBETH', | ||
orderId: 50167927, | ||
})) | ||
@@ -534,16 +535,20 @@ ``` | ||
{ | ||
symbol: 'ENGETH', | ||
orderId: 191938, | ||
clientOrderId: '1XZTVBTGS4K1e', | ||
price: '0.00138000', | ||
origQty: '1.00000000', | ||
executedQty: '1.00000000', | ||
clientOrderId: 'NkQnNkdBV1RGjUALLhAzNy', | ||
cummulativeQuoteQty: '0.16961580', | ||
executedQty: '3.91000000', | ||
icebergQty: '0.00000000', | ||
isWorking: true, | ||
orderId: 50167927, | ||
origQty: '3.91000000', | ||
price: '0.04338000', | ||
side: 'SELL', | ||
status: 'FILLED', | ||
stopPrice: '0.00000000', | ||
symbol: 'BNBETH', | ||
time: 1547075007821, | ||
timeInForce: 'GTC', | ||
type: 'LIMIT', | ||
side: 'SELL', | ||
stopPrice: '0.00000000', | ||
icebergQty: '0.00000000', | ||
time: 1508611114735 | ||
updateTime: 1547075016737 | ||
} | ||
``` | ||
@@ -550,0 +555,0 @@ |
@@ -8,2 +8,4 @@ import crypto from 'crypto' | ||
const defaultGetTime = () => Date.now() | ||
/** | ||
@@ -95,3 +97,3 @@ * Build query string for uri encoded url based on json object | ||
*/ | ||
const privateCall = ({ apiKey, apiSecret }) => ( | ||
const privateCall = ({ apiKey, apiSecret, getTime = defaultGetTime }) => ( | ||
path, | ||
@@ -109,3 +111,3 @@ data = {}, | ||
? publicCall('/v1/time').then(r => r.serverTime) | ||
: Promise.resolve(Date.now()) | ||
: Promise.resolve(getTime()) | ||
).then(timestamp => { | ||
@@ -112,0 +114,0 @@ if (data) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252362
2327
1189