binance-futures-connector
Advanced tools
Comparing version 1.1.7 to 1.1.8
{ | ||
"name": "binance-futures-connector", | ||
"version": "1.1.7", | ||
"description": "币安-合约+现货-sdk,持续更新,欢迎PR一起完善,微信:wkc19891", | ||
"version": "1.1.8", | ||
"description": "binance-futures-connector 币安-合约+现货-sdk,持续更新,欢迎PR一起完善。微信:wkc19891", | ||
"main": "src/index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
# binance-futures-connector in nodejs | ||
> 币安-合约+现货-sdk,持续更新,欢迎PR一起完善,微信:wkc19891 | ||
> tg:wkc19891 | ||
> 币安-合约+现货-sdk,持续更新,欢迎PR一起完善 | ||
> 策略定制联系 | ||
> tg:wkc19891 微信:wkc19891 | ||
``` | ||
币安 返佣注册链接 实时返20% | ||
https://accounts.binance.me/zh-CN/register?ref=JGLH0SR8 | ||
币安 返佣注册链接 月返 30% | ||
https://accounts.binance.me/zh-CN/register?ref=48730146 | ||
``` | ||
[](https://badge.fury.io/js/%40binance%2Fconnector) | ||
@@ -7,0 +17,0 @@ [](http://nodejs.org/download/) |
@@ -15,2 +15,3 @@ module.exports.Future = require('./future') | ||
module.exports.Sleep = sleep | ||
const { LocalStorage } = require("node-localstorage") | ||
@@ -49,1 +50,67 @@ let _g = new LocalStorage('./_G'); | ||
function DateFormat(time = '') { | ||
let myDate = '' | ||
if (time == '') { | ||
myDate = new Date; | ||
} else { | ||
myDate = new Date(time); | ||
} | ||
let year = myDate.getFullYear(); | ||
let mon = myDate.getMonth() + 1; | ||
if (mon < 10) { | ||
mon = "0" + mon; | ||
} | ||
let date = myDate.getDate(); | ||
if (date < 10) { | ||
date = "0" + date; | ||
} | ||
let hours = myDate.getHours(); | ||
if (hours < 10) { | ||
hours = "0" + hours; | ||
} | ||
let minutes = myDate.getMinutes(); | ||
if (minutes < 10) { | ||
minutes = "0" + minutes; | ||
} | ||
let seconds = myDate.getSeconds(); | ||
if (seconds < 10) { | ||
seconds = "0" + seconds; | ||
} | ||
let now = year + "-" + mon + "-" + date + " " + hours + ":" + minutes + ":" + seconds; | ||
return now; | ||
} | ||
module.exports.DateFormat = DateFormat | ||
let logProfit = new LocalStorage('./_LogProfit'); | ||
/** | ||
* 持久化存储 | ||
* @param {*} key | ||
* @param {*} value | ||
* @returns | ||
*/ | ||
function LogProfit(value = '') { | ||
if (value == null) { | ||
logProfit.setItem('_LogProfit', null) | ||
} else if (value == '') { | ||
return JSON.parse(logProfit.getItem('_LogProfit')) | ||
} else { | ||
try { | ||
value = Number(value) == NaN ? 0 : Number(value) | ||
let pft = logProfit.getItem('_LogProfit') | ||
if (pft == null) { | ||
let arry = []; | ||
arry.push({ income: value, time: DateFormat() }) | ||
logProfit.setItem('_LogProfit', JSON.stringify(arry)) | ||
} else { | ||
pft = JSON.parse(pft) | ||
pft.push({ income: value, time: DateFormat() }) | ||
logProfit.setItem('_LogProfit', JSON.stringify(pft)) | ||
} | ||
} catch { | ||
logProfit.setItem('_LogProfit', null) | ||
} | ||
} | ||
} | ||
module.exports.LogProfit = LogProfit |
@@ -1,2 +0,2 @@ | ||
const { Future, TA, Sleep, _G, _N } = require('../index') | ||
const { Future, TA, Sleep, _G, _N, LogProfit, DateFormat } = require('../index') | ||
@@ -17,21 +17,28 @@ const apiKey = '' | ||
async function p() { | ||
for (let i = 0; i < 100; i++) { | ||
LogProfit(i + 1000) | ||
console.log(LogProfit()) | ||
await Sleep(2000) | ||
} | ||
// LogProfit(null) | ||
// console.log(LogProfit()) | ||
//== | ||
console.log(_N(1234567.8978432, 3)) | ||
console.log(_N('999887.54699', 3)) | ||
console.log(_N('9x9887.54699', 3)) | ||
//== | ||
let name = _G('guo'); | ||
console.log(name) | ||
if (name == null) { | ||
_G('guo', 666) | ||
} | ||
console.log(_G('guo')) | ||
_G('guo1', JSON.stringify({ name: 'top', age: 18 })) | ||
console.log(_G('guo1'), JSON.parse(_G('guo1'))) | ||
// console.log(_N(1234567.8978432, 3)) | ||
// console.log(_N('999887.54699', 3)) | ||
// console.log(_N('9x9887.54699', 3)) | ||
// //== | ||
// let name = _G('guo'); | ||
// console.log(name) | ||
// if (name == null) { | ||
// _G('guo', 666) | ||
// } | ||
// console.log(_G('guo')) | ||
// _G('guo1', JSON.stringify({ name: 'top', age: 18 })) | ||
// console.log(_G('guo1'), JSON.parse(_G('guo1'))) | ||
//== | ||
for (let i = 0; i < 10; i++) { | ||
await Sleep(5000) | ||
console.log(i) | ||
} | ||
// //== | ||
// for (let i = 0; i < 10; i++) { | ||
// await Sleep(5000) | ||
// console.log(i) | ||
// } | ||
} | ||
@@ -38,0 +45,0 @@ p(); |
248739
50
7051
282