binance-futures-connector
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "binance-futures-connector", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "币安-合约+现货-sdk,持续更新,欢迎PR一起完善,微信:wkc19891", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -51,5 +51,7 @@ const axios = require('axios') | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
"Accept": "application/json, text/plain, */*", | ||
'X-MBX-APIKEY': apiKey, | ||
'User-Agent': `${constants.appName}/${constants.appVersion}` | ||
'User-Agent': "axios/0.18.0"//`${constants.appName}/${constants.appVersion}` | ||
}, | ||
timeout: 5000, | ||
agent: false, | ||
@@ -62,2 +64,6 @@ pool: { maxSockets: 100 } | ||
reqData.httpsAgent = httpsAgent; | ||
// maxSockets: 100, | ||
// maxFreeSockets: 10, | ||
// timeout: 60000, | ||
// freeSocketTimeout: 30000, | ||
} | ||
@@ -64,0 +70,0 @@ |
@@ -99,2 +99,21 @@ const { validateRequiredParameters } = require('../helpers/validation.js') | ||
uuid = (len, radix) => { | ||
let chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); | ||
let uuid = [], i; | ||
radix = radix || chars.length; | ||
if (len) { | ||
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]; | ||
} else { | ||
let r; | ||
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'; | ||
uuid[14] = '4'; | ||
for (i = 0; i < 36; i++) { | ||
if (!uuid[i]) { | ||
r = 0 | Math.random() * 16; | ||
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]; | ||
} | ||
} | ||
} | ||
return uuid.join(''); | ||
} | ||
/** | ||
@@ -108,2 +127,3 @@ * 下单 (TRADE)<br> | ||
* @param {string} type 订单类型 LIMIT, MARKET, STOP, TAKE_PROFIT, STOP_MARKET, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET | ||
* @param {string} brokerId brokerId 市商ID 无特殊需求默认即可 | ||
* @param {object} [options] | ||
@@ -119,3 +139,3 @@ * @param {string} [options.timeInForce] | ||
*/ | ||
newOrder(symbol, side, positionSide, type, options = {}) { | ||
newOrder(symbol, side, positionSide, type, brokerId = 'WcsXtG5x', options = {}) { | ||
validateRequiredParameters({ symbol, positionSide, side, type }) | ||
@@ -129,3 +149,4 @@ return this.signRequest( | ||
positionSide: positionSide.toLocaleUpperCase(), | ||
type: type.toUpperCase() | ||
type: type.toUpperCase(), | ||
newClientOrderId: `x-${brokerId}_${this.uuid(16)}` | ||
}) | ||
@@ -132,0 +153,0 @@ ) |
240779
6891