Gathering detailed insights and metrics for binance-futures-connector
Gathering detailed insights and metrics for binance-futures-connector
Gathering detailed insights and metrics for binance-futures-connector
Gathering detailed insights and metrics for binance-futures-connector
@binance/futures-connector
NodeJS Binance Futures Connector
@celebimustafa/binance-futures-connector
This is a lightweight library that works as a connector to the Binance public API.
@ixjb94/binance
[![CodeFactor](https://www.codefactor.io/repository/github/ixjb94/binance/badge)](https://www.codefactor.io/repository/github/ixjb94/binance) ![npm version](https://img.shields.io/npm/v/@ixjb94/binance) ![npm size](https://img.shields.io/bundlephobia/mi
wirnata15-binance_futures_sdk
This is a lightweight library that works as a connector to the Binance Futures public API created by me personally by copying from @binance/connector a.k.a Binance Spot API.
npm install binance-futures-connector
Typescript
Module System
Node Version
NPM Version
71.7
Supply Chain
98
Quality
75.7
Maintenance
50
Vulnerability
99.6
License
Cumulative downloads
Total Downloads
Last day
-50%
1
Compared to previous day
Last week
-50%
7
Compared to previous week
Last month
-60.4%
36
Compared to previous month
Last year
-62%
1,005
Compared to previous year
5
币安-合约+现货 sdk,持续更新,欢迎PR一起完善 策略定制联系 tg:wkc19891 微信:wkc19891
币安 返佣注册链接 实时返20%
https://accounts.binance.me/zh-CN/register?ref=JGLH0SR8
此SDK集成了币安 合约 和 现货接口,且有成熟策略案例,如需可浏览github学习。
This is a lightweight library that works as a connector to Binance public API. It’s designed to be simple, clean, and easy to use with minimal dependencies.
使用此包的项目集合 *策略持续分享...
Supported APIs:
/fapi/*
/spot/*
Inclusion of test cases and examples
Customizable base URL, request timeout and HTTP
Response metadata can be displayed
Customizable Logger
新增常用指标 MA,BOLL,EMA,ATR,SAR,MACD,KDJ...
新增常用函数 _G(),_N(),Log(),Sleep(),LogProfit(),DateFormat()...
新增现货
注意老项目请使用最新NPM包
1npm install binance-futures-connector
or
yarn add binance-futures-connector
https://binance-docs.github.io/apidocs/futures/cn/#185368440e
查看上方项目示例
/**
* 记录收益 打印收益曲线
*/
async function PrintProfit() {
//记录10次收益
for (let i = 0; i < 10; i++) {
LogProfit(i + 1000)
await Sleep(200)//休息0.2秒
}
console.log(LogProfit())
LogProfit(null)//重置收益曲线
console.log('重置收益曲线', LogProfit())
// ``` 打印输出接口
// [
// { income: 1000, time: '2022-11-27 10:39:07' },
// { income: 1001, time: '2022-11-27 10:39:07' },
// { income: 1002, time: '2022-11-27 10:39:08' },
// { income: 1003, time: '2022-11-27 10:39:08' },
// { income: 1004, time: '2022-11-27 10:39:08' },
// { income: 1005, time: '2022-11-27 10:39:08' },
// { income: 1006, time: '2022-11-27 10:39:08' },
// { income: 1007, time: '2022-11-27 10:39:09' },
// { income: 1008, time: '2022-11-27 10:39:09' },
// { income: 1009, time: '2022-11-27 10:39:09' }
// ]
// ```
}
PrintProfit()
/**
* 记录10次日志
*/
async function PrintLog() {
for (let i = 0; i < 10; i++) {
Log(i + 1000)
await Sleep(200)//延迟0.2秒
}
console.log(Log())
Log(null)//清空日志
console.log('清空日志', Log())
// ``` 日志结构
// [
// { key: 1, logs: '1000', time: '2022-11-27 12:12:10' },
// { key: 2, logs: '1001', time: '2022-11-27 12:12:11' },
// { key: 3, logs: '1002', time: '2022-11-27 12:12:11' },
// { key: 4, logs: '1003', time: '2022-11-27 12:12:11' },
// { key: 5, logs: '1004', time: '2022-11-27 12:12:11' },
// { key: 6, logs: '1005', time: '2022-11-27 12:12:11' },
// { key: 7, logs: '1006', time: '2022-11-27 12:12:12' },
// { key: 8, logs: '1007', time: '2022-11-27 12:12:12' },
// { key: 9, logs: '1008', time: '2022-11-27 12:12:12' },
// { key: 10, logs: '1009', time: '2022-11-27 12:12:12' }
// ]
// ```
}
PrintLog();
async function UseG() {
_G('key1', '123', 888, 777)//设置key1值
_G('key2', 'hello world')//设置key2值
_G('key3', JSON.stringify({ name: 'top', age: 18 }))
console.log('key1=', _G('key1'))//获取key1值
console.log('key2=', _G('key2'))//获取key2值
console.log('key3=', _G('key3'))//获取key3值
console.log('key3.name=', JSON.parse(_G('key3')).name)//获取key3.name值
// ```输出
// key1= 123888|777
// key2= hello world
// key3= {"name":"top","age":18}
// key3.name= top
// ```
}
UseG()
async function UseN() {
let a = 1.34159;
console.log('a=', a);
let a1 = _N(a, 2)
console.log('a2=', a1);
let a2 = _N(a, 3)
console.log('a2=', a2);
// ```输出
// a= 1.34059
// a2= 1.34
// a2= 1.341
// ```
}
UseN();
const client = new Future(apiKey, apiSecret, { ip: proxyIp, port: proxy })
/**
* 获取BTCUSDT 1m 10条数据
* @param {*} coin
*/
function GetR() {
client.records("BTCUSDT", "1m", 10).then(records => {
console.log('获取BTCUSDT 1m 10条数据=', records)
// ``` 输出
// [
// {
// Time: 1669522920000,
// Open: 16524.4,
// High: 16526.3,
// Low: 16522.9,
// Close: 16526.2,
// Volume: 69.66
// },
// {
// Time: 1669522980000,
// Open: 16526.3,
// High: 16536.3,
// Low: 16526.2,
// Close: 16530.3,
// Volume: 128.14
// }
// ]
// ```
//获取SAR
let sar1 = TA.SAR(records, 0.008, 0.2, 0.008);
console.log('sar11', sar1[sar1.length - 2], 'sar21', sar1[sar1.length - 3])
})
}
GetR()
// buy()//买入开多
// sell()//卖出开空
// buy_close()//卖出平多
// sell_close()//买入平空
1const { Future, TA, _G, _N, LogProfit, Log, DateFormat, Sleep, buy, sell, buy_close, sell_close } = require('binance-futures-connector') 2 3const apiKey = '' 4const apiSecret = '' 5const proxyIp = '127.0.0.1' 6const proxy = '1087' 7 8const fs = require('fs') 9const client = new Future(apiKey, apiSecret, { ip: proxyIp, port: proxy }) 10//sar 11client.records("BTCUSDT", "1m", 1500).then(records => { 12 let sar1 = TA.SAR(records, 0.008, 0.2,0.008); 13 console.log('sar11', sar1[sar1.length - 2], 'sar21', sar1[sar1.length - 3]) 14}) 15 16client.records("ETHUSDT", "5m").then(records => { 17 if (records && records.length > 20) { 18 console.log("ETHUSDT", "5m", "time now:", TA.getDate()) 19 let boll = TA.BOLL(records, 90, 2) 20 let upLine = boll[0] 21 let midLine = boll[1] 22 let downLine = boll[2] 23 console.log("upLine", upLine[upLine.length - 1]) 24 console.log("midLine", midLine[midLine.length - 1]) 25 console.log("downLine", downLine[downLine.length - 1]) 26 let macd = TA.MACD(records, 12, 26, 9) 27 let dif = macd[0] 28 let dea = macd[1] 29 let _macd = macd[2] 30 console.log("DIF:", dif[dif.length - 1], "DEA:", dea[dea.length - 1], "MACD:", _macd[_macd.length - 1]) 31 var kdj = TA.KDJ(records, 9, 3, 3) 32 let k = kdj[0] 33 let d = kdj[1] 34 let j = kdj[2] 35 console.log("k:", k[k.length - 1], "d:", d[d.length - 1], "MACD:", j[j.length - 1]) 36 var rsi = TA.RSI(records, 14) 37 console.log("rsi:", rsi[rsi.length - 1]) 38 var atr = TA.ATR(records, 14) 39 console.log("atr:", atr[atr.length - 1]) 40 var obv = TA.OBV(records) 41 console.log("obv", obv[obv.length - 1]) 42 var ema = TA.EMA(records, 9) 43 console.log("ema-9", ema[ema.length - 1]) 44 var ma = TA.MA(records, 14) 45 console.log("ma-14", ma[ma.length - 1]) 46 let h = TA.Highest(records, 30, 'High') 47 let l = TA.Lowest(records, 30, 'Low') 48 console.log(`h=${h},l=${l}`) 49 } 50}).catch(res => { 51 console.log(res) 52}) 53
No vulnerabilities found.
No security vulnerabilities found.