poloniex-api-node
Version:
Simple node.js wrapper for Poloniex REST and WebSocket API.
1 lines • 96.4 kB
Source Map (JSON)
{"version":3,"file":"poloniex.cjs","names":["_axios","_interopRequireDefault","require","_cryptoJs","_debug","_foreverWebsocket","obj","__esModule","default","dbg_rest","Debug","dbg_wsPub","dbg_wsAuth","Poloniex","baseUrl","rest","wsPrivate","wsPublic","apiRateLimitsEndpointsSets","nriPriv","riPriv","nriPub","riPub","apiRateLimits","apiCallTimeStamps","apiKey","apiSecret","constructor","makeRegexp","set","map","item","regex","replace","RegExp","k","Object","keys","key","apiCallRates","defineProperty","get","removeExpiredTimestamps","length","value","n","Array","fill","Date","now","splice","#removeExpiredTimestamps","timestampsArray","oneMinuteAgo","index","classifyApiCall","#classifyApiCall","method","path","endpoint","setName","entries","j","test","cloneObjectExceptKeys","#cloneObjectExceptKeys","src","excludeKeys","cloned","includes","customErrorMessage","#customErrorMessage","err","message","messageArr","response","status","push","statusText","join","data","code","requestPub","#requestPub","params","body","getApiCallRateInfo","apiCallRateLimits","Promise","resolve","reject","url","axios","then","res","catch","errData","error","Error","getRequestHeaders","#getRequestHeaders","timestamp","composeParamString","values","forEach","v","encodeURIComponent","sort","composeBodyString","JSON","stringify","sign","requestString","payload","hmacData","CryptoJS","HmacSHA256","enc","Base64","signature","requestAuth","#requestAuth","headers","getSymbols","requestParameters","symbol","filter","p","getCurrencies","currency","getTimestamp","getPrices","getMarkPrice","getMarkPriceComponents","getOrderBook","getCandles","getTrades","getTicker","getCollateralInfo","getBorrowRatesInfo","getAccountsInfo","getAccountsBalances","id","getAccountsActivity","accountsTransfer","getAccountsTransferRecords","getFeeInfo","getSubaccountsInfo","getSubaccountsBalances","subaccountsTransfer","getSubaccountsTransferRecords","getDepositAddresses","getWalletsActivityRecords","createNewCurrencyAddress","withdrawCurrency","getMarginAccountInfo","getMarginBorrowStatus","getMarginMaxSize","createOrder","createBatchOrders","replaceOrder","getOpenOrders","getOrderDetails","cancelOrder","cancelBatchOrders","cancelAllOrders","setKillSwitch","getKillSwitchStatus","createSmartOrder","replaceSmartOrder","getSmartOpenOrders","getSmartOrderDetails","cancelSmartOrder","cancelBatchSmartOrders","cancelAllSmartOrders","getOrdersHistory","getSmartOrdersHistory","getTradesHistory","getOrderTrades","newPublicWebSocket","options","automaticOpen","undefined","reconnect","timeout","ping","interval","event","ws","ForeverWebSocket","enabled","send","prototype","call","on","toString","reason","newAuthenticatedWebSocket","channel","signTimestamp","exports","module"],"sources":["../../lib/poloniex.mjs"],"sourcesContent":["import axios from 'axios'\nimport CryptoJS from 'crypto-js'\nimport Debug from 'debug'\nimport { ForeverWebSocket } from 'forever-websocket'\n\nconst dbg_rest = Debug('plx:rest')\nconst dbg_wsPub = Debug('plx:ws:pub')\nconst dbg_wsAuth = Debug('plx:ws:auth')\n\n/**\n * Creates a new Poloniex object\n * @class Poloniex\n * @param {String} [apiKey]\n * @param {String} [apiSecret]\n * @returns this\n */\nexport default class Poloniex {\n // API endpoints\n static #baseUrl = {\n rest: 'https://api.poloniex.com',\n wsPrivate: 'wss://ws.poloniex.com/ws/private',\n wsPublic: 'wss://ws.poloniex.com/ws/public',\n }\n\n // API endpoints sets (for rate limits)\n #apiRateLimitsEndpointsSets = {\n // non-resource intensive private endpoints\n nriPriv: [\n 'GET/accounts',\n 'GET/accounts/balances',\n 'GET/accounts/{id}/balances',\n 'POST/accounts/transfer',\n 'GET/accounts/transfer/{id}',\n 'GET/subaccounts',\n 'GET/subaccounts/{id}/balances',\n 'GET/subaccounts/transfer/{id}',\n 'GET/margin/accountMargin',\n 'GET/margin/borrowStatus',\n 'GET/margin/maxSize',\n 'POST/orders',\n 'GET/orders/{id}',\n 'DELETE/orders/{id}',\n 'GET/orders/{id}/trades',\n 'POST/orders/killSwitch',\n 'GET/orders/killSwitchStatus',\n 'POST/smartorders',\n 'GET/smartorders/{id}',\n 'DELETE/smartorders/{id}',\n ],\n // resource intensive private endpoints\n riPriv: [\n 'GET/accounts/transfer',\n 'GET/accounts/activity',\n 'GET/subaccounts/balances',\n 'GET/subaccounts/transfer',\n 'POST/subaccounts/transfer',\n 'GET/feeinfo',\n 'GET/wallets/addresses',\n 'GET/wallets/addresses/{currency}',\n 'POST/wallets/address',\n 'POST/wallets/withdraw',\n 'GET/wallets/activity',\n 'GET/orders',\n 'POST/orders/batch',\n 'PUT/orders',\n 'DELETE/orders/cancelByIds',\n 'DELETE/orders',\n 'GET/orders/history',\n 'GET/smartorders',\n 'PUT/smartorders',\n 'DELETE/smartorders/cancelByIds',\n 'DELETE/smartorders',\n 'GET/smartorders/history',\n 'GET/trades',\n ],\n // non-resource intensive public endpoints\n nriPub: [\n \"GET/markets/{symbol}\",\n \"GET/markets/price\",\n \"GET/markets/{symbol}/price\",\n \"GET/markets/markPrice\",\n \"GET/markets/{symbol}/markPrice\",\n \"GET/markets/{symbol}/markPriceComponents\",\n \"GET/markets/{symbol}/orderBook\",\n \"GET/markets/{symbol}/candles\",\n \"GET/timestamp\",\n \"GET/markets/collateralInfo\",\n \"GET/markets/{currency}/collateralInfo\",\n \"GET/markets/borrowRatesInfo\"\n ],\n // resource intensive public endpoints\n riPub: [\n \"GET/markets\",\n \"GET/markets/{symbol}/trades\",\n \"GET/markets/ticker24h\",\n \"GET/markets/{symbol}/ticker24h\",\n \"GET/currencies\",\n \"GET/currencies/{currency}\"\n ]\n }\n\n // API rate limits for endpoints sets\n #apiRateLimits = { riPub: 10, nriPub: 200, nriPriv: 50, riPriv: 10 }\n // timestamps of all API calls \n #apiCallTimeStamps = {}\n\n #apiKey\n #apiSecret\n\n constructor({ apiKey = '', apiSecret = '' } = {}) {\n this.#apiKey = apiKey\n this.#apiSecret = apiSecret\n\n // makes the regexp sets from endpoint sets\n const makeRegexp = function makeRegexp(set) {\n return set.map((item) => {\n const regex = item.replace(/{([a-zA-Z0-9_]+)}/g, \"[a-zA-Z0-9_]+\");\n return new RegExp(\"^\" + regex + \"$\");\n })\n }\n\n //convert endpoint sets to regexp sets\n for (const k of Object.keys(this.#apiRateLimitsEndpointsSets)) {\n this.#apiRateLimitsEndpointsSets[k] = makeRegexp(this.#apiRateLimitsEndpointsSets[k])\n }\n\n // define setters and getters which are storing API calls timestamps in appropriate arrays\n for (const key of Object.keys(this.apiCallRates)) {\n this.#apiCallTimeStamps[key] = []\n Object.defineProperty(this.apiCallRates, key, {\n get: () => {\n this.#removeExpiredTimestamps(key)\n return this.#apiCallTimeStamps[key].length\n },\n set: (value) => {\n this.#removeExpiredTimestamps(key)\n const n = value - this.#apiCallTimeStamps[key].length\n if (n > 0) {\n // add n elements to the array, with value Date.now()\n this.#apiCallTimeStamps[key] = [...this.#apiCallTimeStamps[key], ...Array(n).fill(Date.now())]\n } else {\n // remove -n elements from the array\n this.#apiCallTimeStamps[key].splice(0, -n)\n }\n }\n })\n }\n }\n\n // remove timestamps older than one second from API call timestamp array\n #removeExpiredTimestamps(key) {\n const timestampsArray = this.#apiCallTimeStamps[key]\n const now = Date.now()\n const oneMinuteAgo = now - 1000\n let index = 0\n while (index < timestampsArray.length && timestampsArray[index] <= oneMinuteAgo) {\n index += 1\n }\n\n timestampsArray.splice(0, index)\n }\n\n // Classifies the API call based on endpoint sets, returns the set name\n #classifyApiCall(method, path) {\n const endpoint = method + path\n for (const [setName, set] of Object.entries(this.#apiRateLimitsEndpointsSets)) {\n for (let j = 0; j < set.length; j += 1)\n if (set[j].test(endpoint)) {\n return setName\n }\n }\n }\n\n// Copies all keys from src object to a destination object, except excludeKeys. It returns the destination object.\n static #cloneObjectExceptKeys(src = {}, excludeKeys = []) {\n const cloned = {}\n for (const key in src) {\n if (!excludeKeys.includes(key)) {\n cloned[key] = src[key]\n }\n }\n\n return cloned\n }\n\n #customErrorMessage(err) {\n let message\n let messageArr = []\n if (err.response?.status) messageArr.push(err.response.status)\n if (err.response?.statusText) messageArr.push(err.response.statusText)\n if (messageArr.length > 0) messageArr = [messageArr.join(' ') + ':']\n if (err.response?.data?.message) messageArr.push(err.response.data.message)\n if (messageArr.length > 0) {\n message = messageArr.join(' ')\n } else {\n message = err.message\n }\n\n const code = err.response?.data?.code || err.code\n return { message, code }\n }\n\n /**\n * Makes a request to a public API endpoint (no authentication is necessary)\n * \n * @private\n * @param method\n * @param path\n * @param params\n * @param body\n * @param getApiCallRateInfo\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - returns either Poloniex result or API call rate information\n */\n #requestPub(method, path, params, body, getApiCallRateInfo) {\n if (getApiCallRateInfo) {\n const key = this.#classifyApiCall(method, path)\n return [key, this.apiCallRates[key], this.apiCallRateLimits[key]]\n }\n\n return new Promise((resolve, reject) => {\n const url = Poloniex.#baseUrl.rest + path\n axios({ method, url, params, data: body })\n .then((res) => resolve (res.data))\n .then((res) => resolve (res.data))\n .catch((err) => {\n const errData = this.#customErrorMessage(err)\n const error = new Error(errData.message)\n error.code = errData.code\n reject(error)\n })\n })\n }\n\n // Generates signed request headers\n static #getRequestHeaders(method, path, params, body, apiKey, apiSecret) {\n const timestamp = Date.now()\n // Composes the parameters string: the timestamp parameter and the list of parameters, sorted by ASCII order and delimited by &. All parameters are URL/UTF-8 encoded (i.e. space is encoded as \"%20\").\n const composeParamString = function (params, timestamp) {\n const values = [`signTimestamp=${timestamp}`]\n Object.entries(params).forEach(([k, v]) => values.push(`${k}=${encodeURIComponent(v)}`))\n return values.sort().join(\"&\")\n }\n\n // Composes the body string. signTimestamp needs to be added, even if there is no body\n const composeBodyString = function (body, timestamp) {\n if (Object.keys(body).length > 0) {\n return `requestBody=${JSON.stringify(body)}` + `&signTimestamp=${timestamp}`\n } else {\n return `signTimestamp=${timestamp}`\n }\n }\n\n // Generates the digital signature\n const sign = function sign(method, path, requestString, apiSecret) {\n const payload = method + \"\\n\" + path + \"\\n\" + requestString\n const hmacData = CryptoJS.HmacSHA256(payload, apiSecret)\n return CryptoJS.enc.Base64.stringify(hmacData)\n }\n\n let requestString\n if (method === 'DELETE' || method === 'POST' || method === 'PUT') {\n requestString = composeBodyString(body, timestamp)\n } else {\n requestString = composeParamString(params, timestamp)\n }\n\n const signature = sign(method, path, requestString, apiSecret, timestamp)\n return {\n \"Content-Type\": \"application/json\",\n \"key\": apiKey,\n 'signatureMethod': 'HmacSHA256',\n \"signature\": signature,\n \"signTimestamp\": timestamp\n }\n }\n\n /**\n * Makes a request to an authenticated API endpoint (API signature is required)\n * \n * @private\n * @param method\n * @param path\n * @param params\n * @param body\n * @param getApiCallRateInfo\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - returns either Poloniex result or API call rate information\n */\n #requestAuth(method, path, params, body, getApiCallRateInfo) {\n if (getApiCallRateInfo) {\n const key = this.#classifyApiCall(method, path)\n return [key, this.apiCallRates[key], this.apiCallRateLimits[key]]\n }\n\n return new Promise((resolve, reject) => {\n const headers = Poloniex.#getRequestHeaders(method, path, params, body, this.#apiKey, this.#apiSecret)\n const url = Poloniex.#baseUrl.rest + path\n axios({ method, url, headers, params, data: body })\n .then((res) => resolve (res.data))\n .catch((err) => {\n const errData = this.#customErrorMessage(err)\n const error = new Error(errData.message)\n error.code = errData.code\n reject(error)\n })\n })\n }\n\n /**\n * API call rate limits for endpoints sets\n * @type {{riPriv: number, riPub: number, nriPub: number, nriPriv: number}}\n */\n apiCallRateLimits = {\n riPub: 10,\n nriPub: 200,\n nriPriv: 50,\n riPriv: 10\n }\n\n /**\n * Current call rate for resource-intensive and non-resource-intensive private and public API calls\n *\n * @type {{riPriv: number, riPub: number, nriPub: number, nriPriv: number}}\n */\n apiCallRates = {\n nriPub: 0,\n riPub: 0,\n nriPriv: 0,\n riPriv: 0,\n }\n\n /**\n * Get symbols and their trade info.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.symbol] - a single symbol name\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getSymbols(requestParameters) {\n const path = ['/markets', requestParameters?.symbol].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['symbol', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get supported currencies.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.currency] - a single currency\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getCurrencies(requestParameters) {\n const path = ['/currencies', requestParameters?.currency].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['currency', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get current server time.\n *\n * @param {Object} [requestParameters]\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getTimestamp(requestParameters) {\n const path = '/timestamp'\n return this.#requestPub('GET', path, {}, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get the latest trade price for symbols.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.symbol] - a single symbol\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getPrices(requestParameters) {\n const path = ['/markets', requestParameters?.symbol, 'price'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['symbol', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get the latest mark price for cross margin symbols.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.symbol] - a single symbol\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getMarkPrice(requestParameters) {\n const path = ['/markets', requestParameters?.symbol, 'markPrice'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['symbol', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get components of the mark price for a given symbol.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.symbol - a single symbol\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getMarkPriceComponents(requestParameters) {\n const path = ['/markets', requestParameters?.symbol, 'markPriceComponents'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['symbol', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get the order book for a given symbol.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.symbol - a single symbol\n * @param {String} [requestParameters.scale] - controls aggregation by price\n * @param {Number} [requestParameters.limit] - controls aggregation by price\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getOrderBook(requestParameters) {\n const path = ['/markets', requestParameters?.symbol, 'orderBook'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['orderBook', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Returns OHLC for a symbol at given timeframe (interval).\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.symbol - a single symbol\n * @param {\"MINUTE_1\"|\"MINUTE_5\"|\"MINUTE_10\"|\"MINUTE_15\"|\"MINUTE_30\"|\"HOUR_1\"|\"HOUR_2\"|\"HOUR_4\"|\"HOUR_6\"|\"HOUR_12\"|\"DAY_1\"|\"DAY_3\"|\"WEEK_1\"|\"MONTH_1\"} requestParameters.interval - the unit of time to aggregate data by\n * @param {Number} [requestParameters.limit] - maximum number of records returned\n * @param {Number} [requestParameters.startTime] - filters by time\n * @param {Number} [requestParameters.endTime] - filters by time\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getCandles(requestParameters) {\n const path = ['/markets', requestParameters?.symbol, 'candles'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['candles', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Returns a list of recent trades.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.symbol - a single symbol\n * @param {Number} [requestParameters.limit] - maximum number of records returned\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getTrades(requestParameters) {\n const path = ['/markets', requestParameters?.symbol, 'trades'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['trades', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Returns ticker in last 24 hours for all symbols.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.symbol] - a single symbol\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getTicker(requestParameters) {\n const path = ['/markets', requestParameters?.symbol, 'ticker24h'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['symbol', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get collateral information for currencies.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.currency] - a single currency\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getCollateralInfo(requestParameters) {\n const path = ['/markets', requestParameters?.currency, 'collateralInfo'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['currency', 'getApiCallRateInfo'])\n return this.#requestPub('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get borrow rates information for all tiers and currencies.\n *\n * @param {Object} [requestParameters]\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getBorrowRatesInfo(requestParameters) {\n const path = '/markets/borrowRatesInfo'\n return this.#requestPub('GET', path, {}, {}, requestParameters?.getApiCallRateInfo)\n }\n\n // Authenticated Methods\n\n /**\n * Get a list of all accounts of a use.\n *\n * @param {Object} [requestParameters]\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getAccountsInfo(requestParameters) {\n const path = '/accounts'\n return this.#requestAuth('GET', path, {}, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get a list of accounts of a user with each account’s id, type and balances.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.id] - a single account\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getAccountsBalances(requestParameters) {\n const path = ['/accounts', requestParameters?.id, 'balances'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['id', 'getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get a list of activities such as airdrop, rebates, staking, credit/debit adjustments, and other (historical adjustments).\n *\n * @param {Object} [requestParameters]\n * @param {Number} [requestParameters.startTime] - trades filled before startTime will not be retrieved\n * @param {Number} [requestParameters.endTime] - trades filled after endTime will not be retrieved\n * @param {Number} [requestParameters.activityType] - type of activity\n * @param {Number} [requestParameters.limit] - max number of records\n * @param {Number} [requestParameters.from] - it is 'id'. The query begin at ‘from', and the default is 0\n * @param {\"PRE\"|\"NEXT\"} [requestParameters.direction] - PRE, NEXT, default is NEXT\n * @param {String} [requestParameters.currency] - transferred currency\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getAccountsActivity(requestParameters) {\n const path = '/accounts/activity'\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Transfer amount of currency from an account to another account for a user.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.currency - currency to transfer\n * @param {String} requestParameters.amount - amount to transfer\n * @param {String} requestParameters.fromAccount - account from which the currency is transferred\n * @param {String} requestParameters.toAccount - account to which the currency is transferred\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n accountsTransfer(requestParameters) {\n const path = '/accounts/transfer'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('POST', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get a list of transfer records of a user.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.id] - get a single transfer record corresponding to the transferId\n * @param {Number} [requestParameters.limit] - a single account\n * @param {Number} [requestParameters.from] - It is 'transferId'. The query begin at ‘from', and the default is 0\n * @param {\"PRE\"|\"NEXT\"} [requestParameters.direction] - PRE, NEXT, default is NEXT\n * @param {String} [requestParameters.currency] - transferred currency\n * @param {Number} [requestParameters.startTime] - transfers before start time will not be retrieved\n * @param {Number} [requestParameters.endTime] - transfers after end time will not be retrieved\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getAccountsTransferRecords(requestParameters) {\n const path = ['/accounts/transfer', requestParameters?.id].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['id', 'getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get fee rate.\n *\n * @param {Object} [requestParameters]\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getFeeInfo(requestParameters) {\n const path = '/feeinfo'\n return this.#requestAuth('GET', path, {}, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get a list of all the accounts within an Account Group for a user.\n *\n * @param {Object} [requestParameters]\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getSubaccountsInfo(requestParameters) {\n const path = '/subaccounts'\n return this.#requestAuth('GET', path, {}, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get balances information by currency and account type.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.id] - a single account\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getSubaccountsBalances(requestParameters) {\n const path = ['/subaccounts', requestParameters?.id, 'balances'].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['id', 'getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Transfer amount of currency from an account and account type to another account and account type among the accounts in the account group.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.currency - currency to transfer\n * @param {String} requestParameters.amount - amount to transfer\n * @param {String} requestParameters.fromAccountId - external UID of the from account\n * @param {\"SPOT\"|\"FUTURES\"} requestParameters.fromAccountType - from account type\n * @param {String} requestParameters.toAccountId - external UID of the to account\n * @param {\"SPOT\"|\"FUTURES\"} requestParameters.toAccountType - to account type\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n subaccountsTransfer(requestParameters) {\n const path = '/subaccounts/transfer'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('POST', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get a list of transfer records of a user.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.id] - get a single transfer record corresponding to the transferId\n * @param {Number} [requestParameters.limit] - max number of records\n * @param {Number} [requestParameters.from] - it is 'transferId'. The query begin at ‘from', and the default is 0\n * @param {\"PRE\"|\"NEXT\"} [requestParameters.direction] - PRE, NEXT, default is NEXT\n * @param {String} [requestParameters.currency] - transferred currency\n * @param {String} [requestParameters.fromAccountId] - external UID of the from account\n * @param {\"SPOT\"|\"FUTURES\"} [requestParameters.fromAccountType] - from account type\n * @param {String} [requestParameters.toAccountId] - external UID of the to account\n * @param {\"SPOT\"|\"FUTURES\"} [requestParameters.toAccountType] - to account type\n * @param {Number} [requestParameters.startTime] - transfers before start time will not be retrieved\n * @param {Number} [requestParameters.endTime] - transfers after end time will not be retrieved\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getSubaccountsTransferRecords(requestParameters) {\n const path = ['/subaccounts/transfer', requestParameters?.id].filter(p => p).join('/')\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['id', 'getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get deposit addresses for a user.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.currency] - for a single the currency\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getDepositAddresses(requestParameters) {\n const path = '/wallets/addresses'\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get deposit and withdrawal activity history.\n *\n * @param {Object} requestParameters\n * @param {Number} requestParameters.start - records before start time will not be retrieved\n * @param {Number} requestParameters.end - records after end time will not be retrieved\n * @param {\"deposits\"|\"withdrawals\"} [requestParameters.activityType] - type of activity\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getWalletsActivityRecords(requestParameters) {\n const path = '/wallets/activity'\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Create a new address for a currency.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.currency - the currency to use for the deposit address\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n createNewCurrencyAddress(requestParameters) {\n const path = '/wallets/address'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('POST', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Immediately places a withdrawal for a given currency.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.currency - currency name\n * @param {String} requestParameters.amount - withdrawal amount\n * @param {String} requestParameters.address - withdrawal address\n * @param {String} [requestParameters.paymentId] - paymentId for currencies that use a command deposit address\n * @param {String} [requestParameters.allowBorrow] - allow to transfer borrowed funds\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n withdrawCurrency(requestParameters) {\n const path = '/wallets/withdraw'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('POST', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get account margin information.\n *\n * @param {Object} [requestParameters]\n * @param {\"SPOT\"} [requestParameters.accountType] - account type. Currently only SPOT is supported\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getMarginAccountInfo(requestParameters) {\n const path = '/margin/accountMargin'\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get borrow status of currencies.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.currency] - currency name\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getMarginBorrowStatus(requestParameters) {\n const path = '/margin/borrowStatus'\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get maximum and available buy/sell amount for a given symbol.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.symbol - symbol name\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getMarginMaxSize(requestParameters) {\n const path = '/margin/maxSize'\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Create an order for an account.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.symbol - symbol to trade\n * @param {\"BUY\"|\"SELL\"} requestParameters.side - BUY, SELL\n * @param {\"GTC\"|\"IOC\"|\"FOK\"} [requestParameters.timeInForce] - GTC, IOC, FOK\n * @param {\"MARKET\"|\"LIMIT\"|\"LIMIT_MAKER\"} [requestParameters.type] - MARKET, LIMIT, LIMIT_MAKER (for placing post only orders)\n * @param {\"SPOT\"} [requestParameters.accountType] - SPOT is the default and only supported one\n * @param {String} [requestParameters.price] - price is required for non-market orders\n * @param {String} [requestParameters.quantity] - base units for the order. Quantity is required for MARKET SELL or any LIMIT orders\n * @param {String} [requestParameters.amount] - quote units for the order. Amount is required for MARKET BUY order\n * @param {String} [requestParameters.clientOrderId] - maximum 64-character length\n * @param {Boolean} [requestParameters.allowBorrow] - allow order to be placed by borrowing funds\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n createOrder(requestParameters) {\n const path = '/orders'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('POST', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Create multiple orders via a single request.\n *\n * @param {Object} requestParameters\n * @param {Array<{\n * symbol: String,\n * side: \"BUY\"|\"SELL\",\n * timeInForce: \"GTC\"|\"IOC\"|\"FOK\",\n * type: \"MARKET\"|\"LIMIT\"|\"LIMIT_MAKER\",\n * accountType: \"SPOT\",\n * price: String,\n * quantity: String,\n * amount: String,\n * clientOrderId: String,\n * }>} requestParameters.orders - array of json objects with order details\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call *\n */\n createBatchOrders(requestParameters) {\n const path = '/orders/batch'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('POST', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Cancel an existing active order, new or partially filled, and place a new order.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.id - specify the existing order id. If id is a clientOrderId, prefix with cid: e.g. cid:myId-1\n * @param {String} [requestParameters.clientOrderId] - clientOrderId of the new order\n * @param {String} [requestParameters.price] - amended price\n * @param {String} [requestParameters.quantity] - amended quantity\n * @param {String} [requestParameters.amount] - amended amount (needed for MARKET buy)\n * @param {\"MARKET\"|\"LIMIT\"|\"LIMIT_MAKER\"} [requestParameters.type] - MARKET, LIMIT, LIMIT_MAKER (for placing post only orders)\n * @param {\"GTC\"|\"IOC\"|\"FOK\"} [requestParameters.timeInForce] - GTC, IOC, FOK\n * @param {Boolean} [requestParameters.allowBorrow] - allow order to be placed by borrowing funds\n * @param {Boolean} [requestParameters.proceedOnFailure] - new order should be placed if cancellation of the existing order fails\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n replaceOrder(requestParameters) {\n const path = ['/orders', requestParameters.id].filter(p => p).join('/')\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['id', 'getApiCallRateInfo'])\n return this.#requestAuth('PUT', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get a list of active orders for an account.\n *\n * @param {Object} [requestParameters]\n * @param {String} [requestParameters.symbol] - symbol to trade\n * @param {\"BUY\"|\"SELL\"} [requestParameters.side] - BUY, SELL\n * @param {String} [requestParameters.from] - it is 'orderId'. The query begin at ‘from', and it is 0 when you first query\n * @param {\"PRE\"|\"NEXT\"} [requestParameters.direction] - PRE, NEXT\n * @param {Number} [requestParameters.limit] - max number of records to return\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getOpenOrders(requestParameters) {\n const path = '/orders'\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get an order’s status.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.id - either orderId or clientOrderId (prefix with cid: )\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getOrderDetails(requestParameters) {\n const path = `/orders/${requestParameters.id}`\n const params = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('GET', path, params, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Cancel an active order.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.id - order's id or its clientOrderId (prefix with cid: )\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n cancelOrder(requestParameters) {\n const path = `/orders/${requestParameters.id}`\n return this.#requestAuth('DELETE', path, {}, {}, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Batch cancel one or many active orders in an account by IDs.\n *\n * @param {Object} requestParameters\n * @param {Array<String>} [requestParameters.orderIds] - array of order ids. Required if clientOrderIds is null or empty\n * @param {Array<String>} [requestParameters.clientOrderIds] - array of order clientOrderIds. Required if orderIds is null or empty\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n cancelBatchOrders(requestParameters) {\n const path = '/orders/cancelByIds'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('DELETE', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Cancel all orders in an account.\n *\n * @param {Object} [requestParameters]\n * @param {Array<String>} [requestParameters.symbols] - if specified, only orders with those symbols are canceled\n * @param {Array<\"SPOT\">} [requestParameters.accountTypes] - SPOT is the default and only supported one\n * @required\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n cancelAllOrders(requestParameters) {\n const path = '/orders'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('DELETE', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Set a timer that cancels all regular and smartorders after the timeout has expired.\n *\n * @param {Object} requestParameters\n * @param {String} requestParameters.timeout - timer value in seconds\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n setKillSwitch(requestParameters) {\n const path = '/orders/killSwitch'\n const body = Poloniex.#cloneObjectExceptKeys(requestParameters, ['getApiCallRateInfo'])\n return this.#requestAuth('POST', path, {}, body, requestParameters?.getApiCallRateInfo)\n }\n\n /**\n * Get status of kill switch.\n *\n * @param {Object} requestParameters\n * @param {Boolean} [requestParameters.getApiCallRateInfo=false] - if api call rate info should be returned, instead of executing the API call\n * @returns {Promise<*>|[\"riPub\"|\"nriPub\"|\"riPriv\"|\"nriPriv\",number, number]} - Poloniex response or rate and rate limit for the API call\n */\n getKillSwitchStatus(requestParameters) {\n const path = '/orders/killSwitchStatus'\n retu