(options = {})
| 8 | * @module jaggedsoft/node-binance-api |
| 9 | * @return {object} instance to class object */ |
| 10 | let api = function Binance(options = {}) { |
| 11 | if (!new.target) return new api(options); // Legacy support for calling the constructor without 'new' |
| 12 | let Binance = this; // eslint-disable-line consistent-this |
| 13 | const WebSocket = require('ws'); |
| 14 | const request = require('request'); |
| 15 | const crypto = require('crypto'); |
| 16 | const file = require('fs'); |
| 17 | const url = require('url'); |
| 18 | const JSONbig = require('json-bigint'); |
| 19 | const HttpsProxyAgent = require('https-proxy-agent'); |
| 20 | const SocksProxyAgent = require('socks-proxy-agent'); |
| 21 | const stringHash = require('string-hash'); |
| 22 | const async = require('async'); |
| 23 | let base = 'https://api.binance.com/api/'; |
| 24 | let baseTest = 'https://testnet.binance.vision/api/'; |
| 25 | let wapi = 'https://api.binance.com/wapi/'; |
| 26 | let sapi = 'https://api.binance.com/sapi/'; |
| 27 | let fapi = 'https://fapi.binance.com/fapi/'; |
| 28 | let dapi = 'https://dapi.binance.com/dapi/'; |
| 29 | let fapiTest = 'https://testnet.binancefuture.com/fapi/'; |
| 30 | let dapiTest = 'https://testnet.binancefuture.com/dapi/'; |
| 31 | let fstream = 'wss://fstream.binance.com/stream?streams='; |
| 32 | let fstreamSingle = 'wss://fstream.binance.com/ws/'; |
| 33 | let fstreamSingleTest = 'wss://stream.binancefuture.com/ws/'; |
| 34 | let fstreamTest = 'wss://stream.binancefuture.com/stream?streams='; |
| 35 | let dstream = 'wss://dstream.binance.com/stream?streams='; |
| 36 | let dstreamSingle = 'wss://dstream.binance.com/ws/'; |
| 37 | let dstreamSingleTest = 'wss://dstream.binancefuture.com/ws/'; |
| 38 | let dstreamTest = 'wss://dstream.binancefuture.com/stream?streams='; |
| 39 | let stream = 'wss://stream.binance.com:9443/ws/'; |
| 40 | let combineStream = 'wss://stream.binance.com:9443/stream?streams='; |
| 41 | const userAgent = 'Mozilla/4.0 (compatible; Node Binance API)'; |
| 42 | const contentType = 'application/x-www-form-urlencoded'; |
| 43 | const SPOT_PREFIX = "x-TKT5PX2F" |
| 44 | const CONTRACT_PREFIX = "x-cvBPrNm9" |
| 45 | Binance.subscriptions = {}; |
| 46 | Binance.futuresSubscriptions = {}; |
| 47 | Binance.futuresInfo = {}; |
| 48 | Binance.futuresMeta = {}; |
| 49 | Binance.futuresTicks = {}; |
| 50 | Binance.futuresRealtime = {}; |
| 51 | Binance.futuresKlineQueue = {}; |
| 52 | Binance.deliverySubscriptions = {}; |
| 53 | Binance.deliveryInfo = {}; |
| 54 | Binance.deliveryMeta = {}; |
| 55 | Binance.deliveryTicks = {}; |
| 56 | Binance.deliveryRealtime = {}; |
| 57 | Binance.deliveryKlineQueue = {}; |
| 58 | Binance.depthCache = {}; |
| 59 | Binance.depthCacheContext = {}; |
| 60 | Binance.ohlcLatest = {}; |
| 61 | Binance.klineQueue = {}; |
| 62 | Binance.ohlc = {}; |
| 63 | |
| 64 | const default_options = { |
| 65 | recvWindow: 5000, |
| 66 | useServerTime: false, |
| 67 | reconnect: true, |
nothing calls this directly
no test coverage detected