binance-futures-connector
Advanced tools
Comparing version 1.2.9 to 1.3.0
{ | ||
"name": "binance-futures-connector", | ||
"version": "1.2.9", | ||
"version": "1.3.0", | ||
"description": "binance-futures-spot 币安-合约+现货-sdk,持续更新,欢迎PR一起完善。微信:wkc19891", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -39,3 +39,3 @@ module.exports.Future = require('./future') | ||
let a3 = Number(`${a1[0]}.${a2}`) | ||
a3=a3.toFixed(length) | ||
a3 = a3.toFixed(length) | ||
return Number(a3); | ||
@@ -156,6 +156,7 @@ } else { | ||
* @param {*} price | ||
* @param {*} flagPrice | ||
* @param {*} flagPrice | ||
* @param {*} timeInForce | ||
* @returns | ||
*/ | ||
function buy(cf, symbol, quantity, price = -1, flagPrice = 0) { | ||
function buy(cf, symbol, quantity, price = -1, flagPrice = 0, timeInForce = 'GTC') { | ||
return new Promise((resolve, reject) => { | ||
@@ -171,3 +172,3 @@ if (price < 0) { | ||
} else { | ||
cf.newOrder(symbol, 'BUY', 'LONG', 'LIMIT', { quantity: quantity, price: price, timeInForce: 'GTC' }).then(res => { | ||
cf.newOrder(symbol, 'BUY', 'LONG', 'LIMIT', { quantity: quantity, price: price, timeInForce: timeInForce }).then(res => { | ||
console.log(symbol, `限价,开多,买入成功=>数量:${quantity} | 价格:${price}`) | ||
@@ -190,5 +191,6 @@ resolve(res); | ||
* @param {*} flagPrice | ||
* @param {*} timeInForce | ||
* @returns | ||
*/ | ||
function buy_close(cf, symbol, quantity, price = -1, flagPrice = 0) { | ||
function buy_close(cf, symbol, quantity, price = -1, flagPrice = 0, timeInForce = 'GTC') { | ||
return new Promise((resolve, reject) => { | ||
@@ -204,3 +206,3 @@ if (price < 0) { | ||
} else { | ||
cf.newOrder(symbol, 'SELL', 'LONG', 'LIMIT', { quantity: quantity, price: price, timeInForce: 'GTC' }).then(res => { | ||
cf.newOrder(symbol, 'SELL', 'LONG', 'LIMIT', { quantity: quantity, price: price, timeInForce: timeInForce }).then(res => { | ||
console.log(symbol, `限价,平多,卖出成功=>数量:${quantity} | 价格:${price}`) | ||
@@ -223,5 +225,6 @@ resolve(res); | ||
* @param {*} flagPrice | ||
* @param {*} timeInForce | ||
* @returns | ||
*/ | ||
function sell(cf, symbol, quantity, price = -1, flagPrice = 0) { | ||
function sell(cf, symbol, quantity, price = -1, flagPrice = 0, timeInForce = 'GTC') { | ||
return new Promise((resolve, reject) => { | ||
@@ -237,3 +240,3 @@ if (price < 0) { | ||
} else { | ||
cf.newOrder(symbol, 'SELL', 'SHORT', 'LIMIT', { quantity: quantity, price: price, timeInForce: 'GTC' }).then(res => { | ||
cf.newOrder(symbol, 'SELL', 'SHORT', 'LIMIT', { quantity: quantity, price: price, timeInForce: timeInForce }).then(res => { | ||
console.log(symbol, `限价,开空,卖出成功=>数量:${quantity} | 价格:${price}`) | ||
@@ -256,5 +259,6 @@ resolve(res); | ||
* @param {*} flagPrice | ||
* @param {*} timeInForce | ||
* @returns | ||
*/ | ||
function sell_close(cf, symbol, quantity, price = -1, flagPrice = 0) { | ||
function sell_close(cf, symbol, quantity, price = -1, flagPrice = 0, timeInForce = 'GTC') { | ||
return new Promise((resolve, reject) => { | ||
@@ -270,3 +274,3 @@ if (price < 0) { | ||
} else { | ||
cf.newOrder(symbol, 'BUY', 'SHORT', 'LIMIT', { quantity: quantity, price: price, timeInForce: 'GTC' }).then(res => { | ||
cf.newOrder(symbol, 'BUY', 'SHORT', 'LIMIT', { quantity: quantity, price: price, timeInForce: timeInForce }).then(res => { | ||
console.log(symbol, `限价,平空,买入成功=>数量:${quantity} | 价格:${price}`) | ||
@@ -283,3 +287,3 @@ resolve(res); | ||
const buy_xh = (cs,symbol, quantity, price = -1) => { | ||
const buy_xh = (cs, symbol, quantity, price = -1) => { | ||
return new Promise((resolve, reject) => { | ||
@@ -307,3 +311,3 @@ if (price < 0) { | ||
const sell_xh = (cs,symbol, quantity, price = -1) => { | ||
const sell_xh = (cs, symbol, quantity, price = -1) => { | ||
return new Promise((resolve, reject) => { | ||
@@ -338,3 +342,3 @@ if (price < 0) { | ||
*/ | ||
const records_xh = (cs,symbol, interval, limit = 1000) => { | ||
const records_xh = (cs, symbol, interval, limit = 1000) => { | ||
let records = []; | ||
@@ -341,0 +345,0 @@ return new Promise((resolve, reject) => { |
256445
7355