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jB,QAAS,CAAC,EAAK,IACb,WAAW,KAAK,EAAhB,CAA4B,EAAK,EAAQ,MACxC,IAAI,KAAK,GACZ,KAAM,IAAI,KAAK,GACf,QAAS,IAAI,QAAQ,GACrB,KAAM,IAAI,KAAK,GACf,OAAQ,IAAI,OAAO,GACnB,UAAW,IAAI,UAAU,GACzB,UAGF,OAAO,CACT,CACA,OAAO,QAAU","file":"/npm/node-binance-api-ext@2.0.1/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/node-binance-api-ext@2.0.1/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const {\r\n  createCommon,\r\n  setOptions,\r\n  publicRequest,\r\n  apiRequest,\r\n  signedRequest,\r\n  promiseRequest,\r\n  pullKeys,\r\n} = require('./common');\r\n\r\nconst main = function Main(common) {\r\n  //'use strict'; // eslint-disable-line no-unused-expressions\r\n  // let Binance = this; // eslint-disable-line consistent-this\r\n\r\n  /**\r\n   * Gets depth cache for given symbol\r\n   * @param {string} symbol - the symbol to fetch\r\n   * @return {object} - the depth cache object\r\n   */\r\n  const getDepthCache = (symbol) => {\r\n    if (typeof common.depthCache[symbol] === 'undefined')\r\n      return { bids: {}, asks: {} };\r\n    return common.depthCache[symbol];\r\n  };\r\n\r\n  /**\r\n   * Calculate Buy/Sell volume from DepthCache\r\n   * @param {string} symbol - the symbol to fetch\r\n   * @return {object} - the depth volume cache object\r\n   */\r\n  const depthVolume = (symbol) => {\r\n    let cache = getDepthCache(symbol),\r\n      quantity,\r\n      price;\r\n    let bidbase = 0,\r\n      askbase = 0,\r\n      bidqty = 0,\r\n      askqty = 0;\r\n    for (price in cache.bids) {\r\n      quantity = cache.bids[price];\r\n      bidbase += parseFloat((quantity * parseFloat(price)).toFixed(8));\r\n      bidqty += quantity;\r\n    }\r\n    for (price in cache.asks) {\r\n      quantity = cache.asks[price];\r\n      askbase += parseFloat((quantity * parseFloat(price)).toFixed(8));\r\n      askqty += quantity;\r\n    }\r\n    return { bids: bidbase, asks: askbase, bidQty: bidqty, askQty: askqty };\r\n  };\r\n\r\n  /**\r\n   * Gets depth cache for given symbol\r\n   * @param {symbol} symbol - get depch cache for this symbol\r\n   * @return {object} - object\r\n   */\r\n  this.depthCache = (symbol) => {\r\n    return getDepthCache(symbol);\r\n  };\r\n\r\n  /**\r\n   * Gets depth volume for given symbol\r\n   * @param {symbol} symbol - get depch volume for this symbol\r\n   * @return {object} - object\r\n   */\r\n  this.depthVolume = (symbol) => {\r\n    return depthVolume(symbol);\r\n  };\r\n\r\n  /**\r\n   * Count decimal places\r\n   * @param {float} float - get the price precision point\r\n   * @return {int} - number of place\r\n   */\r\n  this.getPrecision = function (float) {\r\n    if (!float || Number.isInteger(float)) return 0;\r\n    return float.toString().split('.')[1].length || 0;\r\n  };\r\n\r\n  /**\r\n   * rounds number with given step\r\n   * @param {float} qty - quantity to round\r\n   * @param {float} stepSize - stepSize as specified by exchangeInfo\r\n   * @return {float} - number\r\n   */\r\n  this.roundStep = function (qty, stepSize) {\r\n    // Integers do not require rounding\r\n    if (Number.isInteger(qty)) return qty;\r\n    const qtyString = qty.toFixed(16);\r\n    const desiredDecimals = Math.max(stepSize.indexOf('1') - 1, 0);\r\n    const decimalIndex = qtyString.indexOf('.');\r\n    return parseFloat(qtyString.slice(0, decimalIndex + desiredDecimals + 1));\r\n  };\r\n\r\n  /**\r\n   * rounds price to required precision\r\n   * @param {float} price - price to round\r\n   * @param {float} tickSize - tickSize as specified by exchangeInfo\r\n   * @return {float} - number\r\n   */\r\n  this.roundTicks = function (price, tickSize) {\r\n    const formatter = new Intl.NumberFormat('en-US', {\r\n      style: 'decimal',\r\n      minimumFractionDigits: 0,\r\n      maximumFractionDigits: 8,\r\n    });\r\n    const precision = formatter.format(tickSize).split('.')[1].length || 0;\r\n    if (typeof price === 'string') price = parseFloat(price);\r\n    return price.toFixed(precision);\r\n  };\r\n\r\n  /**\r\n   * Reverses the keys of an object\r\n   * @param {object} object - the object\r\n   * @return {object} - the object\r\n   */\r\n  this.reverse = function (object) {\r\n    let range = Object.keys(object).reverse(),\r\n      output = {};\r\n    for (let price of range) {\r\n      output[price] = object[price];\r\n    }\r\n    return output;\r\n  };\r\n\r\n  /**\r\n   * Converts an object to an array\r\n   * @param {object} obj - the object\r\n   * @return {array} - the array\r\n   */\r\n  this.array = function (obj) {\r\n    return Object.keys(obj).map(function (key) {\r\n      return [Number(key), obj[key]];\r\n    });\r\n  };\r\n\r\n  /**\r\n   * Sorts bids\r\n   * @param {string} symbol - the object\r\n   * @param {int} max - the max number of bids\r\n   * @param {string} baseValue - the object\r\n   * @return {object} - the object\r\n   */\r\n  this.sortBids = function (symbol, max = Infinity, baseValue = false) {\r\n    let object = {},\r\n      count = 0,\r\n      cache;\r\n    if (typeof symbol === 'object') cache = symbol;\r\n    else cache = getDepthCache(symbol).bids;\r\n    let sorted = Object.keys(cache).sort(function (a, b) {\r\n      return parseFloat(b) - parseFloat(a);\r\n    });\r\n    let cumulative = 0;\r\n    for (let price of sorted) {\r\n      if (baseValue === 'cumulative') {\r\n        cumulative += parseFloat(cache[price]);\r\n        object[price] = cumulative;\r\n      } else if (!baseValue) object[price] = parseFloat(cache[price]);\r\n      else\r\n        object[price] = parseFloat(\r\n          (cache[price] * parseFloat(price)).toFixed(8)\r\n        );\r\n      if (++count >= max) break;\r\n    }\r\n    return object;\r\n  };\r\n\r\n  /**\r\n   * Sorts asks\r\n   * @param {string} symbol - the object\r\n   * @param {int} max - the max number of bids\r\n   * @param {string} baseValue - the object\r\n   * @return {object} - the object\r\n   */\r\n  this.sortAsks = function (symbol, max = Infinity, baseValue = false) {\r\n    let object = {},\r\n      count = 0,\r\n      cache;\r\n    if (typeof symbol === 'object') cache = symbol;\r\n    else cache = getDepthCache(symbol).asks;\r\n    let sorted = Object.keys(cache).sort(function (a, b) {\r\n      return parseFloat(a) - parseFloat(b);\r\n    });\r\n    let cumulative = 0;\r\n    for (let price of sorted) {\r\n      if (baseValue === 'cumulative') {\r\n        cumulative += parseFloat(cache[price]);\r\n        object[price] = cumulative;\r\n      } else if (!baseValue) object[price] = parseFloat(cache[price]);\r\n      else\r\n        object[price] = parseFloat(\r\n          (cache[price] * parseFloat(price)).toFixed(8)\r\n        );\r\n      if (++count >= max) break;\r\n    }\r\n    return object;\r\n  };\r\n\r\n  /**\r\n   * Returns the first property of an object\r\n   * @param {object} object - the object to get the first member\r\n   * @return {string} - the object key\r\n   */\r\n  this.first = function (object) {\r\n    return Object.keys(object).shift();\r\n  };\r\n\r\n  /**\r\n   * Returns the last property of an object\r\n   * @param {object} object - the object to get the first member\r\n   * @return {string} - the object key\r\n   */\r\n  this.last = function (object) {\r\n    return Object.keys(object).pop();\r\n  };\r\n\r\n  /**\r\n   * Returns an array of properties starting at start\r\n   * @param {object} object - the object to get the properties form\r\n   * @param {int} start - the starting index\r\n   * @return {array} - the array of entires\r\n   */\r\n  this.slice = function (object, start = 0) {\r\n    return Object.entries(object)\r\n      .slice(start)\r\n      .map((entry) => entry[0]);\r\n  };\r\n\r\n  /**\r\n   * Gets the minimum key form object\r\n   * @param {object} object - the object to get the properties form\r\n   * @return {string} - the minimum key\r\n   */\r\n  this.min = function (object) {\r\n    return Math.min.apply(Math, Object.keys(object));\r\n  };\r\n\r\n  /**\r\n   * Gets the maximum key form object\r\n   * @param {object} object - the object to get the properties form\r\n   * @return {string} - the minimum key\r\n   */\r\n  this.max = function (object) {\r\n    return Math.max.apply(Math, Object.keys(object));\r\n  };\r\n\r\n  /**\r\n   * Sets an option given a key and value\r\n   * @param {string} key - the key to set\r\n   * @param {object} value - the value of the key\r\n   * @return {undefined}\r\n   */\r\n  this.setOption = function (key, value) {\r\n    common.options[key] = value;\r\n  };\r\n\r\n  /**\r\n   * Gets an option given a key\r\n   * @param {string} key - the key to set\r\n   * @return {undefined}\r\n   */\r\n  this.getOption = function (key) {\r\n    return common.options[key];\r\n  };\r\n\r\n  /**\r\n   * Returns the entire info object\r\n   * @return {object} - the info object\r\n   */\r\n  this.getInfo = function () {\r\n    return common.info;\r\n  };\r\n\r\n  /**\r\n   * Returns the entire options object\r\n   * @return {object} - the options object\r\n   */\r\n  this.getOptions = function () {\r\n    return common.options;\r\n  };\r\n\r\n  /**\r\n   * Tell api to use the server time to offset time indexes\r\n   * @param {function} callback - the callback function\r\n   * @return {promise or undefined} - omitting the callback returns a promise\r\n   */\r\n  this.useServerTime = (callback = false) => {\r\n    const parser = (data) => {\r\n      common.info.timeOffset = data.serverTime - Date.now();\r\n      return data;\r\n    };\r\n    return publicRequest(\r\n      common,\r\n      common.base + 'v3/time',\r\n      {},\r\n      callback,\r\n      false,\r\n      parser\r\n    );\r\n  };\r\n\r\n  /**\r\n   * Convert chart data to highstock array [timestamp,open,high,low,close]\r\n   * @param {object} chart - the chart\r\n   * @param {boolean} include_volume - to include the volume or not\r\n   * @return {array} - an array\r\n   */\r\n  this.highstock = function (chart, include_volume = false) {\r\n    let array = [];\r\n    for (let timestamp in chart) {\r\n      let obj = chart[timestamp];\r\n      let line = [\r\n        Number(timestamp),\r\n        parseFloat(obj.open),\r\n        parseFloat(obj.high),\r\n        parseFloat(obj.low),\r\n        parseFloat(obj.close),\r\n      ];\r\n      if (include_volume) line.push(parseFloat(obj.volume));\r\n      array.push(line);\r\n    }\r\n    return array;\r\n  };\r\n\r\n  /**\r\n   * Populates OHLC information\r\n   * @param {object} chart - the chart\r\n   * @return {object} - object with candle information\r\n   */\r\n  this.ohlc = function (chart) {\r\n    let open = [],\r\n      high = [],\r\n      low = [],\r\n      close = [],\r\n      volume = [];\r\n    for (let timestamp in chart) {\r\n      //common.ohlc[symbol][interval]\r\n      let obj = chart[timestamp];\r\n      open.push(parseFloat(obj.open));\r\n      high.push(parseFloat(obj.high));\r\n      low.push(parseFloat(obj.low));\r\n      close.push(parseFloat(obj.close));\r\n      volume.push(parseFloat(obj.volume));\r\n    }\r\n    return { open: open, high: high, low: low, close: close, volume: volume };\r\n  };\r\n\r\n  /**\r\n   * Queries the public api\r\n   * @param {string} url - the public api endpoint\r\n   * @param {object} data - the data to send\r\n   * @param {function} callback - the callback function\r\n   * @param {string} method - the http method\r\n   * @return {promise or undefined} - omitting the callback returns a promise\r\n   */\r\n  this.publicRequest = function (url, data, callback, method = 'GET') {\r\n    if (!callback) {\r\n      return new Promise((resolve, reject) => {\r\n        callback = (error, response) => {\r\n          if (error) {\r\n            reject(error);\r\n          } else {\r\n            resolve(response);\r\n          }\r\n        };\r\n        publicRequest(common, url, data, callback, method);\r\n      });\r\n    } else {\r\n      publicRequest(common, url, data, callback, method);\r\n    }\r\n  };\r\n\r\n  /**\r\n   * Queries the futures API by default\r\n   * @param {string} url - the signed api endpoint\r\n   * @param {{APIKEY: string, APISECRET: string }} params - additional parameters\r\n   * @param {object} flags - type of request, authentication method and endpoint url\r\n   * @param {function} callback - the callback function\r\n   * @return {?promise} returs promise if callback is not defined\r\n   */\r\n  this.promiseRequest = function (url, params = {}, flags = {}, callback) {\r\n    return promiseRequest(common, url, params, flags, callback);\r\n  };\r\n\r\n  /**\r\n   * Queries the signed api\r\n   * @param {string} url - the signed api endpoint\r\n   * @param {object} data - the data to send\r\n   * @param {function} callback - the callback function\r\n   * @param {string} method - the http method\r\n   * @param {boolean} noDataInSignature - Prevents data from being added to signature\r\n   * @return {?promise} returs promise if callback is not defined\r\n   */\r\n  this.signedRequest = function (\r\n    url,\r\n    data,\r\n    callback,\r\n    method = 'GET',\r\n    noDataInSignature = false\r\n  ) {\r\n    return signedRequest(\r\n      common,\r\n      url,\r\n      data,\r\n      callback,\r\n      pullKeys(data),\r\n      false,\r\n      method,\r\n      noDataInSignature\r\n    );\r\n  };\r\n\r\n  /**\r\n   * Gets the market asset of given symbol\r\n   * @param {string} symbol - the public api endpoint\r\n   * @return {undefined}\r\n   */\r\n  this.getMarket = function (symbol) {\r\n    if (symbol.endsWith('BTC')) return 'BTC';\r\n    else if (symbol.endsWith('ETH')) return 'ETH';\r\n    else if (symbol.endsWith('BNB')) return 'BNB';\r\n    else if (symbol.endsWith('XRP')) return 'XRP';\r\n    else if (symbol.endsWith('PAX')) return 'PAX';\r\n    else if (symbol.endsWith('USDT')) return 'USDT';\r\n    else if (symbol.endsWith('USDC')) return 'USDC';\r\n    else if (symbol.endsWith('USDS')) return 'USDS';\r\n    else if (symbol.endsWith('TUSD')) return 'TUSD';\r\n  };\r\n\r\n  /**\r\n   * Get the account binance lending information\r\n   * @param {object} params - additional params\r\n   * @param {function} callback - the callback function\r\n   * @return {promise or undefined} - omitting the callback returns a promise\r\n   */\r\n  this.lending = async (params = {}, callback) => {\r\n    return promiseRequest(\r\n      common,\r\n      'v1/lending/union/account',\r\n      params,\r\n      { base: common.sapi, type: 'SIGNED' },\r\n      callback\r\n    );\r\n  };\r\n\r\n  // futures websockets support: ticker bookTicker miniTicker aggTrade markPrice\r\n  /* TODO: https://binance-docs.github.io/apidocs/futures/en/#change-log\r\n        Cancel multiple orders DELETE /common.fapi/v1/batchOrders\r\n        New Future Account Transfer POST https://api.binance.com/sapi/v1/futures/transfer\r\n        Get Postion Margin Change History (TRADE)\r\n        \r\n        wss://fstream.binance.com/ws/<listenKey>\r\n        Diff. Book Depth Streams (250ms, 100ms, or realtime): <symbol>@depth OR <symbol>@depth@100ms OR <symbol>@depth@0ms\r\n        Partial Book Depth Streams (5, 10, 20): <symbol>@depth<levels> OR <symbol>@depth<levels>@100ms\r\n        All Market Liquidation Order Streams: !forceOrder@arr\r\n        Liquidation Order Streams for specific symbol: <symbol>@forceOrder\r\n        Chart data (250ms): <symbol>@kline_<interval>\r\n        SUBSCRIBE, UNSUBSCRIBE, LIST_SUBSCRIPTIONS, SET_PROPERTY, GET_PROPERTY\r\n        Live Subscribing/Unsubscribing to streams: requires sending futures subscription id when connecting\r\n        futuresSubscriptions { \"method\": \"LIST_SUBSCRIPTIONS\", \"id\": 1 }\r\n        futuresUnsubscribe { \"method\": \"UNSUBSCRIBE\", \"params\": [ \"btcusdt@depth\" ], \"id\": 1 }\r\n        futures depthCache & complete realtime chart updates\r\n        */\r\n};\r\n\r\nconst spot = require('./spot');\r\nconst futures = require('./futures');\r\nconst wapi = require('./wapi');\r\nconst margin = require('./margin');\r\nconst webSocket = require('./webSocket');\r\n\r\nfunction Binance(options = {}) {\r\n  // if (!new.target) {\r\n  //   // Legacy support for calling the constructor without 'new'\r\n  //   return new Binance(common);\r\n  // }\r\n  const common = createCommon();\r\n\r\n  if (options) setOptions(options, common);\r\n\r\n  const returnThis = {\r\n    //   /**\r\n    //    * Gets an option given a key\r\n    //    * @param {object} opt - the object with the class configuration\r\n    //    * @param {function} callback - the callback function\r\n    //    * @return {undefined}\r\n    //    */\r\n    options: (opt, callback) =>\r\n      setOptions.bind(returnThis)(opt, common, callback),\r\n    ...new main(common),\r\n    spot: new spot(common),\r\n    futures: new futures(common),\r\n    wapi: new wapi(common),\r\n    margin: new margin(common),\r\n    webSocket: new webSocket(common),\r\n    common,\r\n  };\r\n\r\n  return returnThis;\r\n}\r\nmodule.exports = Binance;\r\n//https://github.com/binance-exchange/binance-official-api-docs\r\n\r\n//error codes : https://github.com/binance-exchange/binance-official-api-docs/blob/master/errors.md\r\n"]}