UNPKG

crypto-portfolio-viewer

Version:

view your aggregated cryptocurrency portfolio across exchanges, ETH wallet, and any other places!

2 lines 1.97 MB
/*! For license information please see crypto-portfolio-viwer.bundle.js.LICENSE.txt */ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}}(this,(function(){return(()=>{var e={4277:e=>{"use strict";e.exports=({onlyFirst:e=!1}={})=>{const t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}},6434:(e,t,s)=>{"use strict";e=s.nmd(e);const i=(e,t)=>(...s)=>`[${e(...s)+t}m`,r=(e,t)=>(...s)=>{const i=e(...s);return`[${38+t};5;${i}m`},a=(e,t)=>(...s)=>{const i=e(...s);return`[${38+t};2;${i[0]};${i[1]};${i[2]}m`},n=e=>e,o=(e,t,s)=>[e,t,s],c=(e,t,s)=>{Object.defineProperty(e,t,{get:()=>{const i=s();return Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0}),i},enumerable:!0,configurable:!0})};let d;const h=(e,t,i,r)=>{void 0===d&&(d=s(2085));const a=r?10:0,n={};for(const[s,r]of Object.entries(d)){const o="ansi16"===s?"ansi":s;s===t?n[o]=e(i,a):"object"==typeof r&&(n[o]=e(r[t],a))}return n};Object.defineProperty(e,"exports",{enumerable:!0,get:function(){const e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(const[s,i]of Object.entries(t)){for(const[s,r]of Object.entries(i))t[s]={open:`[${r[0]}m`,close:`[${r[1]}m`},i[s]=t[s],e.set(r[0],r[1]);Object.defineProperty(t,s,{value:i,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="",t.bgColor.close="",c(t.color,"ansi",(()=>h(i,"ansi16",n,!1))),c(t.color,"ansi256",(()=>h(r,"ansi256",n,!1))),c(t.color,"ansi16m",(()=>h(a,"rgb",o,!1))),c(t.bgColor,"ansi",(()=>h(i,"ansi16",n,!0))),c(t.bgColor,"ansi256",(()=>h(r,"ansi256",n,!0))),c(t.bgColor,"ansi16m",(()=>h(a,"rgb",o,!0))),t}})},4658:e=>{"use strict";const t="[\ud800-\udbff][\udc00-\udfff]";e.exports=e=>e&&e.exact?new RegExp(`^${t}$`):new RegExp(t,"g")},9669:(e,t,s)=>{e.exports=s(1609)},7970:(e,t,s)=>{"use strict";var i=s(4867),r=s(6026),a=s(4097),n=s(5327),o=s(8605),c=s(7211),d=s(938).http,h=s(938).https,u=s(8835),l=s(8761),f=s(696),p=s(5061),m=s(481),y=/https:?/;function b(e,t,s){if(e.hostname=t.host,e.host=t.host,e.port=t.port,e.path=s,t.auth){var i=Buffer.from(t.auth.username+":"+t.auth.password,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+i}e.beforeRedirect=function(e){e.headers.host=e.host,b(e,t,e.href)}}e.exports=function(e){return new Promise((function(t,s){var g=function(e){t(e)},v=function(e){s(e)},w=e.data,k=e.headers;if(k["User-Agent"]||k["user-agent"]||(k["User-Agent"]="axios/"+f.version),w&&!i.isStream(w)){if(Buffer.isBuffer(w));else if(i.isArrayBuffer(w))w=Buffer.from(new Uint8Array(w));else{if(!i.isString(w))return v(p("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",e));w=Buffer.from(w,"utf-8")}k["Content-Length"]=w.length}var S=void 0;e.auth&&(S=(e.auth.username||"")+":"+(e.auth.password||""));var _=a(e.baseURL,e.url),O=u.parse(_),T=O.protocol||"http:";if(!S&&O.auth){var x=O.auth.split(":");S=(x[0]||"")+":"+(x[1]||"")}S&&delete k.Authorization;var C=y.test(T),I=C?e.httpsAgent:e.httpAgent,M={path:n(O.path,e.params,e.paramsSerializer).replace(/^\?/,""),method:e.method.toUpperCase(),headers:k,agent:I,agents:{http:e.httpAgent,https:e.httpsAgent},auth:S};e.socketPath?M.socketPath=e.socketPath:(M.hostname=O.hostname,M.port=O.port);var A,N=e.proxy;if(!N&&!1!==N){var D=T.slice(0,-1)+"_proxy",E=process.env[D]||process.env[D.toUpperCase()];if(E){var P=u.parse(E),B=process.env.no_proxy||process.env.NO_PROXY,V=!0;if(B&&(V=!B.split(",").map((function(e){return e.trim()})).some((function(e){return!!e&&("*"===e||"."===e[0]&&O.hostname.substr(O.hostname.length-e.length)===e||O.hostname===e)}))),V&&(N={host:P.hostname,port:P.port,protocol:P.protocol},P.auth)){var q=P.auth.split(":");N.auth={username:q[0],password:q[1]}}}}N&&(M.headers.host=O.hostname+(O.port?":"+O.port:""),b(M,N,T+"//"+O.hostname+(O.port?":"+O.port:"")+M.path));var R=C&&(!N||y.test(N.protocol));e.transport?A=e.transport:0===e.maxRedirects?A=R?c:o:(e.maxRedirects&&(M.maxRedirects=e.maxRedirects),A=R?h:d),e.maxBodyLength>-1&&(M.maxBodyLength=e.maxBodyLength);var L=A.request(M,(function(t){if(!L.aborted){var s=t,a=t.req||L;if(204!==t.statusCode&&"HEAD"!==a.method&&!1!==e.decompress)switch(t.headers["content-encoding"]){case"gzip":case"compress":case"deflate":s=s.pipe(l.createUnzip()),delete t.headers["content-encoding"]}var n={status:t.statusCode,statusText:t.statusMessage,headers:t.headers,config:e,request:a};if("stream"===e.responseType)n.data=s,r(g,v,n);else{var o=[];s.on("data",(function(t){o.push(t),e.maxContentLength>-1&&Buffer.concat(o).length>e.maxContentLength&&(s.destroy(),v(p("maxContentLength size of "+e.maxContentLength+" exceeded",e,null,a)))})),s.on("error",(function(t){L.aborted||v(m(t,e,null,a))})),s.on("end",(function(){var t=Buffer.concat(o);"arraybuffer"!==e.responseType&&(t=t.toString(e.responseEncoding),e.responseEncoding&&"utf8"!==e.responseEncoding||(t=i.stripBOM(t))),n.data=t,r(g,v,n)}))}}}));L.on("error",(function(t){L.aborted&&"ERR_FR_TOO_MANY_REDIRECTS"!==t.code||v(m(t,e,null,L))})),e.timeout&&L.setTimeout(e.timeout,(function(){L.abort(),v(p("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",L))})),e.cancelToken&&e.cancelToken.promise.then((function(e){L.aborted||(L.abort(),v(e))})),i.isStream(w)?w.on("error",(function(t){v(m(t,e,null,L))})).pipe(L):L.end(w)}))}},5448:(e,t,s)=>{"use strict";var i=s(4867),r=s(6026),a=s(4372),n=s(5327),o=s(4097),c=s(4109),d=s(7985),h=s(5061);e.exports=function(e){return new Promise((function(t,s){var u=e.data,l=e.headers;i.isFormData(u)&&delete l["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var p=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";l.Authorization="Basic "+btoa(p+":"+m)}var y=o(e.baseURL,e.url);if(f.open(e.method.toUpperCase(),n(y,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in f?c(f.getAllResponseHeaders()):null,a={data:e.responseType&&"text"!==e.responseType?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:i,config:e,request:f};r(t,s,a),f=null}},f.onabort=function(){f&&(s(h("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){s(h("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),s(h(t,e,"ECONNABORTED",f)),f=null},i.isStandardBrowserEnv()){var b=(e.withCredentials||d(y))&&e.xsrfCookieName?a.read(e.xsrfCookieName):void 0;b&&(l[e.xsrfHeaderName]=b)}if("setRequestHeader"in f&&i.forEach(l,(function(e,t){void 0===u&&"content-type"===t.toLowerCase()?delete l[t]:f.setRequestHeader(t,e)})),i.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),e.responseType)try{f.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),s(e),f=null)})),u||(u=null),f.send(u)}))}},1609:(e,t,s)=>{"use strict";var i=s(4867),r=s(1849),a=s(321),n=s(7185);function o(e){var t=new a(e),s=r(a.prototype.request,t);return i.extend(s,a.prototype,t),i.extend(s,t),s}var c=o(s(5655));c.Axios=a,c.create=function(e){return o(n(c.defaults,e))},c.Cancel=s(5263),c.CancelToken=s(4972),c.isCancel=s(6502),c.all=function(e){return Promise.all(e)},c.spread=s(8713),c.isAxiosError=s(6268),e.exports=c,e.exports.default=c},5263:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:(e,t,s)=>{"use strict";var i=s(5263);function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var s=this;e((function(e){s.reason||(s.reason=new i(e),t(s.reason))}))}r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e;return{token:new r((function(t){e=t})),cancel:e}},e.exports=r},6502:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:(e,t,s)=>{"use strict";var i=s(4867),r=s(5327),a=s(782),n=s(3572),o=s(7185);function c(e){this.defaults=e,this.interceptors={request:new a,response:new a}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=o(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[n,void 0],s=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)s=s.then(t.shift(),t.shift());return s},c.prototype.getUri=function(e){return e=o(this.defaults,e),r(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},i.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,s){return this.request(o(s||{},{method:e,url:t,data:(s||{}).data}))}})),i.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,s,i){return this.request(o(i||{},{method:e,url:t,data:s}))}})),e.exports=c},782:(e,t,s)=>{"use strict";var i=s(4867);function r(){this.handlers=[]}r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){i.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=r},4097:(e,t,s)=>{"use strict";var i=s(1793),r=s(7303);e.exports=function(e,t){return e&&!i(t)?r(e,t):t}},5061:(e,t,s)=>{"use strict";var i=s(481);e.exports=function(e,t,s,r,a){var n=new Error(e);return i(n,t,s,r,a)}},3572:(e,t,s)=>{"use strict";var i=s(4867),r=s(8527),a=s(6502),n=s(5655);function o(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return o(e),e.headers=e.headers||{},e.data=r(e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),i.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||n.adapter)(e).then((function(t){return o(e),t.data=r(t.data,t.headers,e.transformResponse),t}),(function(t){return a(t)||(o(e),t&&t.response&&(t.response.data=r(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:e=>{"use strict";e.exports=function(e,t,s,i,r){return e.config=t,s&&(e.code=s),e.request=i,e.response=r,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},7185:(e,t,s)=>{"use strict";var i=s(4867);e.exports=function(e,t){t=t||{};var s={},r=["url","method","data"],a=["headers","auth","proxy","params"],n=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function c(e,t){return i.isPlainObject(e)&&i.isPlainObject(t)?i.merge(e,t):i.isPlainObject(t)?i.merge({},t):i.isArray(t)?t.slice():t}function d(r){i.isUndefined(t[r])?i.isUndefined(e[r])||(s[r]=c(void 0,e[r])):s[r]=c(e[r],t[r])}i.forEach(r,(function(e){i.isUndefined(t[e])||(s[e]=c(void 0,t[e]))})),i.forEach(a,d),i.forEach(n,(function(r){i.isUndefined(t[r])?i.isUndefined(e[r])||(s[r]=c(void 0,e[r])):s[r]=c(void 0,t[r])})),i.forEach(o,(function(i){i in t?s[i]=c(e[i],t[i]):i in e&&(s[i]=c(void 0,e[i]))}));var h=r.concat(a).concat(n).concat(o),u=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===h.indexOf(e)}));return i.forEach(u,d),s}},6026:(e,t,s)=>{"use strict";var i=s(5061);e.exports=function(e,t,s){var r=s.config.validateStatus;s.status&&r&&!r(s.status)?t(i("Request failed with status code "+s.status,s.config,null,s.request,s)):e(s)}},8527:(e,t,s)=>{"use strict";var i=s(4867);e.exports=function(e,t,s){return i.forEach(s,(function(s){e=s(e,t)})),e}},5655:(e,t,s)=>{"use strict";var i=s(4867),r=s(6016),a={"Content-Type":"application/x-www-form-urlencoded"};function n(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var o,c={adapter:("undefined"!=typeof XMLHttpRequest?o=s(5448):"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)&&(o=s(7970)),o),transformRequest:[function(e,t){return r(t,"Accept"),r(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e)?e:i.isArrayBufferView(e)?e.buffer:i.isURLSearchParams(e)?(n(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):i.isObject(e)?(n(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),i.forEach(["post","put","patch"],(function(e){c.headers[e]=i.merge(a)})),e.exports=c},1849:e=>{"use strict";e.exports=function(e,t){return function(){for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];return e.apply(t,s)}}},5327:(e,t,s)=>{"use strict";var i=s(4867);function r(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,s){if(!t)return e;var a;if(s)a=s(t);else if(i.isURLSearchParams(t))a=t.toString();else{var n=[];i.forEach(t,(function(e,t){null!=e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,(function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),n.push(r(t)+"="+r(e))})))})),a=n.join("&")}if(a){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}},7303:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},4372:(e,t,s)=>{"use strict";var i=s(4867);e.exports=i.isStandardBrowserEnv()?{write:function(e,t,s,r,a,n){var o=[];o.push(e+"="+encodeURIComponent(t)),i.isNumber(s)&&o.push("expires="+new Date(s).toGMTString()),i.isString(r)&&o.push("path="+r),i.isString(a)&&o.push("domain="+a),!0===n&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},1793:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},6268:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},7985:(e,t,s)=>{"use strict";var i=s(4867);e.exports=i.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),s=document.createElement("a");function r(e){var i=e;return t&&(s.setAttribute("href",i),i=s.href),s.setAttribute("href",i),{href:s.href,protocol:s.protocol?s.protocol.replace(/:$/,""):"",host:s.host,search:s.search?s.search.replace(/^\?/,""):"",hash:s.hash?s.hash.replace(/^#/,""):"",hostname:s.hostname,port:s.port,pathname:"/"===s.pathname.charAt(0)?s.pathname:"/"+s.pathname}}return e=r(window.location.href),function(t){var s=i.isString(t)?r(t):t;return s.protocol===e.protocol&&s.host===e.host}}():function(){return!0}},6016:(e,t,s)=>{"use strict";var i=s(4867);e.exports=function(e,t){i.forEach(e,(function(s,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=s,delete e[i])}))}},4109:(e,t,s)=>{"use strict";var i=s(4867),r=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,s,a,n={};return e?(i.forEach(e.split("\n"),(function(e){if(a=e.indexOf(":"),t=i.trim(e.substr(0,a)).toLowerCase(),s=i.trim(e.substr(a+1)),t){if(n[t]&&r.indexOf(t)>=0)return;n[t]="set-cookie"===t?(n[t]?n[t]:[]).concat([s]):n[t]?n[t]+", "+s:s}})),n):n}},8713:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4867:(e,t,s)=>{"use strict";var i=s(1849),r=Object.prototype.toString;function a(e){return"[object Array]"===r.call(e)}function n(e){return void 0===e}function o(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==r.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function d(e){return"[object Function]"===r.call(e)}function h(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),a(e))for(var s=0,i=e.length;s<i;s++)t.call(null,e[s],s,e);else for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(null,e[r],r,e)}e.exports={isArray:a,isArrayBuffer:function(e){return"[object ArrayBuffer]"===r.call(e)},isBuffer:function(e){return null!==e&&!n(e)&&null!==e.constructor&&!n(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:o,isPlainObject:c,isUndefined:n,isDate:function(e){return"[object Date]"===r.call(e)},isFile:function(e){return"[object File]"===r.call(e)},isBlob:function(e){return"[object Blob]"===r.call(e)},isFunction:d,isStream:function(e){return o(e)&&d(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:h,merge:function e(){var t={};function s(s,i){c(t[i])&&c(s)?t[i]=e(t[i],s):c(s)?t[i]=e({},s):a(s)?t[i]=s.slice():t[i]=s}for(var i=0,r=arguments.length;i<r;i++)h(arguments[i],s);return t},extend:function(e,t,s){return h(t,(function(t,r){e[r]=s&&"function"==typeof t?i(t,s):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},696:e=>{"use strict";e.exports=JSON.parse('{"name":"axios","version":"0.21.1","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test && bundlesize","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://github.com/axios/axios","devDependencies":{"bundlesize":"^0.17.0","coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.0.2","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^20.1.0","grunt-karma":"^2.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^1.0.18","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^1.3.0","karma-chrome-launcher":"^2.2.0","karma-coverage":"^1.1.1","karma-firefox-launcher":"^1.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-opera-launcher":"^1.0.0","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^1.2.0","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.7","karma-webpack":"^1.7.0","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^5.2.0","sinon":"^4.5.0","typescript":"^2.8.1","url-search-params":"^0.10.0","webpack":"^1.13.1","webpack-dev-server":"^1.14.1"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.10.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')},5579:(e,t,s)=>{function i(e,t,s,i,r,a,n){try{var o=e[a](n),c=o.value}catch(e){return void s(e)}o.done?t(c):Promise.resolve(c).then(i,r)}var r=s(4061),a=s(5209),n=s(2129),o=s(1254),c=s(5572),d=s(119),{printPortfolioNicely:h}=a,{getPrices:u,getBTCPrice:l}=d,{overwritePrices:f,combineTokenCounts:p,getTokenValues:m,sumOtherTokenCounts:y}=n,{getERC20TokenCounts:b}=o,{getExchangeTokenCounts:g,fetchers:v}=c,{log:w}=console,k=function(){var e,t=(e=function*(){var{keys:e={},addresses:t=[],othertokens:s={},combineExchanges:i=!1,combineAddresses:a=!1,extraFetchers:n={},verbose:o=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o&&w(r.bgGreen(" started to fetch portfolio data ... ")),o&&w(r.green("(1/5)"),"fetching exchange token counts ...");var c=yield g(e,n,i);o&&w(r.green("(2/5)"),"fetching ERC20 token counts ...");var[d,h]=yield b(t,a);o&&w(r.green("(3/5)"),"fetching other token counts ...");var v=y(s),k=[...c,...d,...v],S=p(...k.map((e=>{var[,t]=e;return t})));k=[...k,["all",S]],o&&w(r.green("(4/5)"),"fetching all token prices ...");var _=yield l(),O=yield u(Object.keys(S),o);o&&w(r.green("(5/5)"),"calculating all token values ..."),O=f(O,h);var T=k.map((e=>{var[t,s]=e;return[t,m(s,O,_)]}));return o&&w(r.bgGreen(" finished!! Let's go Bitcoin!! ")),Object.fromEntries(T)},function(){var t=this,s=arguments;return new Promise((function(r,a){var n=e.apply(t,s);function o(e){i(n,r,a,o,c,"next",e)}function c(e){i(n,r,a,o,c,"throw",e)}o(void 0)}))});return function(){return t.apply(this,arguments)}}();e.exports={getPortfolio:k,printPortfolioNicely:h,fetchers:v}},1254:(e,t,s)=>{function i(e,t,s,i,r,a,n){try{var o=e[a](n),c=o.value}catch(e){return void s(e)}o.done?t(c):Promise.resolve(c).then(i,r)}function r(e){return function(){var t=this,s=arguments;return new Promise((function(r,a){var n=e.apply(t,s);function o(e){i(n,r,a,o,c,"next",e)}function c(e){i(n,r,a,o,c,"throw",e)}o(void 0)}))}}var a=s(9669),{isEmpty:n}=s(6486),o=s(2129),{sanitizeAddress:c}=s(5209),{combineTokenCounts:d}=o,h=function(){var e=r((function*(e){var t="".concat("https://api.ethplorer.io","/getAddressInfo/").concat(e,"?apiKey=freekey"),s=yield a.get(t),{ETH:{balance:i},tokens:r}=s.data,n={ETH:i},o={};return r.forEach((e=>{var{tokenInfo:{symbol:t,decimals:s,price:{rate:i}},balance:r}=e;t&&(n[t]=r/10**s,o[t]=i)})),[n,o]}));return function(t){return e.apply(this,arguments)}}(),u=function(){var e=r((function*(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n(e))return[[],{}];var s=[],i=[],a={};yield Promise.all(e.map(function(){var e=r((function*(e){var[t,r]=yield h(e);s.push([c(e),t]),i=d(i,t),a=d(a,r)}));return function(t){return e.apply(this,arguments)}}()));var o=t?[["eth",i]]:s;return[o,a]}));return function(t){return e.apply(this,arguments)}}();e.exports={getERC20TokenCounts:u}},5572:(e,t,s)=>{function i(e,t,s,i,r,a,n){try{var o=e[a](n),c=o.value}catch(e){return void s(e)}o.done?t(c):Promise.resolve(c).then(i,r)}function r(e){return function(){var t=this,s=arguments;return new Promise((function(r,a){var n=e.apply(t,s);function o(e){i(n,r,a,o,c,"next",e)}function c(e){i(n,r,a,o,c,"throw",e)}o(void 0)}))}}var a=s(1853),{isEmpty:n}=s(6486),o=s(5209),c=s(2129),{filterObj:d,ignoreValueBelow:h}=o,{combineTokenCounts:u}=c,l=function(){var e=r((function*(e){var t=yield e.fetchBalance({type:"future"}),s=t.info.positions.filter((e=>e.positionAmt>0)),i=t.total;return s.forEach((e=>{var{symbol:t,positionAmt:s,notional:r}=e,a=t.replace("USDT",""),n=parseInt(s,10);i[a]=i[a]?i[a]+n:n,i.USDT-=r})),d(i,(e=>{var[,t]=e;return 0!==t}))}));return function(t){return e.apply(this,arguments)}}(),f=function(){var e=r((function*(e){var t=new Set(["EXCH"]),s=(yield e.fetchPositions()).filter((e=>e.size>0)),i={USDT:0};return s.forEach((e=>{var{future:s,netSize:r,cost:a}=e,[n,o]=s.split("-"),c=parseInt(r,10);t.has(n)||("PERP"!==o&&(c*=1.08),i[n]=i[n]?i[n]+c:c,i.USDT-=a)})),d(i,(e=>{var[,t]=e;return 0!==t}))}));return function(t){return e.apply(this,arguments)}}(),p=function(){var e=r((function*(e,t){var s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(n(e))return[];var i={},o=[],c=Object.entries(e).map(function(){var e=r((function*(e){var[s,r]=e,n=new a[s](r),c=yield n.fetchBalance(),l=d(c.total,h(0)),f=t[s];if(f){var p=yield f(n);l=u(l,p)}i=u(i,l),o.push([s,l])}));return function(t){return e.apply(this,arguments)}}());return yield Promise.all(c),s?[["exchange",i]]:o}));return function(t,s){return e.apply(this,arguments)}}();e.exports={getExchangeTokenCounts:p,fetchers:{fetchBinanceContractBalances:l,fetchFTXContractBalances:f}}},119:(e,t,s)=>{function i(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function r(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?i(Object(s),!0).forEach((function(t){a(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):i(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function a(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function n(e,t,s,i,r,a,n){try{var o=e[a](n),c=o.value}catch(e){return void s(e)}o.done?t(c):Promise.resolve(c).then(i,r)}function o(e){return function(){var t=this,s=arguments;return new Promise((function(i,r){var a=e.apply(t,s);function o(e){n(a,i,r,o,c,"next",e)}function c(e){n(a,i,r,o,c,"throw",e)}o(void 0)}))}}var{memoize:c}=s(6486),d=s(8945),h=s(4061),u=s(5209),{sanitizetokenName:l}=u,{log:f}=console,p=new d,m=function(){var e=o((function*(e){try{var t=yield p.coins.markets({vs_currency:"usd",ids:e.join(","),order:"market_cap_desc"}),s={};return t.data.forEach(((e,t)=>{var{id:i}=e;s[i]=t})),s}catch(e){f("something went wrong when getting marketcaps..."),f(e)}}));return function(t){return e.apply(this,arguments)}}(),y=function(){var e=o((function*(e){var t=new Set(e.map((e=>l(e)))),s=(yield p.coins.list()).data.reduce(((e,s)=>{if(t.has(s.symbol)){var{id:i,symbol:r}=s;e[r]||(e[r]=[]),e[r].push(i)}return e}),{}),i=Object.values(s).reduce(((e,t)=>(t.length>1&&e.push(...t),e)),[]);return((e,t)=>Object.fromEntries(Object.entries(e).map((e=>{var[s,i]=e,r=i[0],a=t[r];return i.slice(1).forEach((e=>{var s=t[e];s<a&&(a=s,r=e)})),[s,r]}))))(s,yield m(i))}));return function(t){return e.apply(this,arguments)}}(),b=function(){var e=o((function*(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{vs_currency:t="usd",ids:s=""}=e,i=yield p.coins.markets({vs_currency:t,ids:s});return i.data.reduce(((e,t)=>{var{symbol:s,current_price:i}=t;return r(r({},e),{},{[s]:i})}),{})}));return function(){return e.apply(this,arguments)}}(),g=function(){var e=o((function*(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=yield y(e),i=[],a={};e.forEach((e=>{var r=s[l(e)];r?i.push(r):(t&&f(h.yellow("ignored token"),h.bgYellow(" ".concat(e," ")),h.yellow(": can't find it's coingecko id...")),a[e]=0)}));var n=yield b({ids:i.join(",")});return r(r({},n),a)}));return function(t){return e.apply(this,arguments)}}(),v=c(function(){var e=o((function*(){return(yield p.coins.markets({vs_currency:"usd",ids:"bitcoin"})).data[0].current_price}));return function(){return e.apply(this,arguments)}}());e.exports={getPrices:g,getBTCPrice:v}},2129:(e,t,s)=>{function i(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function r(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?i(Object(s),!0).forEach((function(t){a(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):i(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function a(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}var{sum:n}=s(6486),{isEmpty:o}=s(6486),c=s(5209),{sanitizetokenName:d,sortByValue:h,toFixedDecimal2:u}=c,l=(e,t)=>{var s=r({},e);return Object.entries(t).forEach((e=>{var[t,i]=e;s[t]?s[t]+=i:s[t]=i})),s},f=e=>{var t={count:0,USD:0,BTC:0,price:0};return Object.values(e).forEach((e=>{var{BTC:s,USD:i}=e;t.BTC+=s,t.USD+=i})),t.BTC=u(t.BTC),t},p=function(e,t,s){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,r={};return Object.entries(e).forEach((e=>{var[a,n]=e,o={count:n},c=t[d(a)],h=parseInt(n*c),l=h/s;Math.abs(h)>=i&&(o.USD=parseInt(n*c),o.BTC=u(l),o.price=c,r[a]=o)})),r.TOTAL=f(r),r},m=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"USDT",s=new Set(["USDT","USD","DAI"]),i={[t]:0};return Object.entries(e).forEach((e=>{var[r,a]=e;s.has(r)?i[t]+=a:i[r]=u(a)})),i[t]=u(i[t]),i};e.exports={overwritePrices:(e,t)=>{var s=r({},e);return Object.entries(t).forEach((e=>{var[t,i]=e;i&&(s[d(t)]=i)})),s},combineTokenCounts:function(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.reduce(((e,t)=>l(e,t)),{})},getTokenValues:function(e,t,s){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:h,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:m,a=e;"function"==typeof r&&(a=r(a));var n=p(a,t,s);return"function"==typeof i&&(n=i(n)),n},sumOtherTokenCounts:e=>{if(o(e))return[];var t={};return Object.entries(e).forEach((e=>{var[s,i]=e;t[s]=n(i)})),[["other",t]]}}},5209:(e,t,s)=>{var{pad:i}=s(6486),{table:r}=s(107),a=s(4061),{log:n}=console,o=e=>t=>parseFloat(parseFloat(t).toFixed(e)),c=o(1),d=o(2);e.exports={sanitizetokenName:e=>e.toLowerCase(),sanitizeAddress:e=>"".concat(e.slice(0,6),"...").concat(e.slice(e.length-4)),filterObj:(e,t)=>Object.fromEntries(Object.entries(e).filter(t)),ignoreValueBelow:e=>t=>{var[,s]=t;return s>e},sortByValue:e=>Object.entries(e).sort(((e,t)=>{var[,{USD:s}]=e,[,{USD:i}]=t;return i-s})),toFixedDecimal:o,toFixedDecimal2:d,printPortfolioNicely:e=>{Object.entries(e).forEach((e=>{var[t,s]=e;n(a.green("-".repeat(58))),n(a.green("₿ ".concat(i("".concat(t," tokens "),54)," ₿"))),n(a.green("-".repeat(58))),(e=>{var t=e.find((e=>{var[t]=e;return"TOTAL"===t}))[1].USD,s=e.map((e=>{var s,[i,{count:r,USD:a,BTC:n,price:o}]=e,d=c(100*a/t);return[i,"$".concat(a),"".concat(d,"%"),"₿".concat(n),"$".concat((s=o,parseFloat(s.toPrecision(5)))),r]})),i=r([["name","USD","ratio","BTC","price","count"],...s]);n(i)})(s),n("")}))}}},1924:(e,t,s)=>{"use strict";var i=s(210),r=s(5559),a=r(i("String.prototype.indexOf"));e.exports=function(e,t){var s=i(e,!!t);return"function"==typeof s&&a(e,".prototype.")>-1?r(s):s}},5559:(e,t,s)=>{"use strict";var i=s(8612),r=s(210),a=r("%Function.prototype.apply%"),n=r("%Function.prototype.call%"),o=r("%Reflect.apply%",!0)||i.call(n,a),c=r("%Object.getOwnPropertyDescriptor%",!0),d=r("%Object.defineProperty%",!0),h=r("%Math.max%");if(d)try{d({},"a",{value:1})}catch(e){d=null}e.exports=function(e){var t=o(i,n,arguments);if(c&&d){var s=c(t,"length");s.configurable&&d(t,"length",{value:1+h(0,e.length-(arguments.length-1))})}return t};var u=function(){return o(i,a,arguments)};d?d(e.exports,"apply",{value:u}):e.exports.apply=u},1853:(e,t,s)=>{"use strict";const i=s(8819),r=s(5806),a=s(3449),n="1.47.93";i.ccxtVersion=n;const o={aax:s(9133),aofex:s(1272),ascendex:s(2300),bequant:s(1366),bibox:s(7838),bigone:s(4400),binance:s(6056),binanceus:s(3393),bit2c:s(2455),bitbank:s(9703),bitbay:s(3528),bitcoincom:s(3334),bitfinex:s(7965),bitfinex2:s(5328),bitflyer:s(5421),bitforex:s(2519),bitget:s(829),bithumb:s(9202),bitkk:s(6571),bitmart:s(9102),bitmex:s(7763),bitpanda:s(3223),bitso:s(5686),bitstamp:s(7653),bitstamp1:s(2554),bittrex:s(9461),bitvavo:s(4253),bitz:s(6424),bl3p:s(5480),bleutrade:s(5243),braziliex:s(6147),btcalpha:s(6492),btcbox:s(6142),btcmarkets:s(9284),btctradeua:s(233),btcturk:s(1899),buda:s(4875),bw:s(1520),bybit:s(3803),bytetrade:s(2291),cdax:s(9124),cex:s(4228),coinbase:s(2939),coinbaseprime:s(8806),coinbasepro:s(1241),coincheck:s(1770),coinegg:s(6347),coinex:s(8427),coinfalcon:s(6810),coinfloor:s(1224),coingi:s(8697),coinmarketcap:s(6410),coinmate:s(948),coinone:s(9261),coinspot:s(8974),crex24:s(7268),currencycom:s(9610),delta:s(4237),deribit:s(1680),digifinex:s(6755),equos:s(6159),eterbase:s(355),exmo:s(4101),exx:s(5982),fcoin:s(4591),fcoinjp:s(128),flowbtc:s(3513),foxbit:s(3103),ftx:s(9636),gateio:s(4663),gemini:s(3094),gopax:s(6039),hbtc:s(4493),hitbtc:s(8267),hollaex:s(4693),huobijp:s(4072),huobipro:s(3775),idex:s(2574),independentreserve:s(3585),indodax:s(4535),itbit:s(1431),kraken:s(6594),kucoin:s(6987),kuna:s(3112),lakebtc:s(8663),latoken:s(2444),lbank:s(1524),liquid:s(4352),luno:s(5439),lykke:s(5591),mercado:s(7551),mixcoins:s(4554),ndax:s(1985),novadax:s(1541),oceanex:s(7426),okcoin:s(1384),okex:s(8579),paymium:s(757),phemex:s(788),poloniex:s(7497),probit:s(6818),qtrade:s(2715),rightbtc:s(3348),ripio:s(2041),southxchange:s(8405),stex:s(842),surbitcoin:s(1870),therock:s(9269),tidebit:s(1783),tidex:s(6974),timex:s(1378),upbit:s(7705),vbtc:s(42),vcc:s(3571),wavesexchange:s(6091),whitebit:s(390),xbtce:s(7666),xena:s(9741),yobit:s(5927),zaif:s(4422),zb:s(927)};e.exports=Object.assign({version:n,Exchange:i,exchanges:Object.keys(o)},o,r,a)},9133:(e,t,s)=>{"use strict";const i=s(8819),{ArgumentsRequired:r,AuthenticationError:a,ExchangeError:n,ExchangeNotAvailable:o,OrderNotFound:c,InvalidOrder:d,CancelPending:h,RateLimitExceeded:u,InsufficientFunds:l,BadRequest:f,BadSymbol:p,PermissionDenied:m}=s(3449),{TICK_SIZE:y}=s(2115),b=s(6832);e.exports=class extends i{describe(){return this.deepExtend(super.describe(),{id:"aax",name:"AAX",countries:["MT"],enableRateLimit:!0,rateLimit:500,version:"v2",hostname:"aaxpro.com",certified:!0,has:{cancelAllOrders:!0,cancelOrder:!0,createOrder:!0,editOrder:!0,fetchBalance:!0,fetchCanceledOrders:!0,fetchClosedOrders:!0,fetchDepositAddress:!0,fetchMarkets:!0,fetchMyTrades:!0,fetchOHLCV:!0,fetchOpenOrders:!0,fetchOrder:!0,fetchOrderBook:!0,fetchOrders:!0,fetchStatus:!0,fetchTicker:"emulated",fetchTickers:!0,fetchTrades:!0},timeframes:{"1m":"1m","5m":"5m","15m":"15m","30m":"30m","1h":"1h","2h":"2h","4h":"4h","12h":"12h","1d":"1d","3d":"3d","1w":"1w"},urls:{logo:"https://user-images.githubusercontent.com/1294454/104140087-a27f2580-53c0-11eb-87c1-5d9e81208fe9.jpg",test:{v1:"https://api.testnet.{hostname}/marketdata/v1",public:"https://api.testnet.{hostname}",private:"https://api.testnet.{hostname}"},api:{v1:"https://api.{hostname}/marketdata/v1",public:"https://api.{hostname}",private:"https://api.{hostname}"},www:"https://www.aaxpro.com",doc:"https://www.aaxpro.com/apidoc/index.html",fees:"https://www.aaxpro.com/en-US/fees/",referral:"https://www.aaxpro.com/invite/sign-up?inviteCode=JXGm5Fy7R2MB"},api:{v1:{get:["getHistMarketData"]},public:{get:["announcement/maintenance","instruments","market/orderbook","futures/position/openInterest","market/tickers","market/candles","market/history/candles","market/trades","market/markPrice","futures/funding/predictedFunding/{symbol}","futures/funding/prevFundingRate/{symbol}","market/candles/index"]},private:{get:["user/info","account/balances","account/deposit/address","spot/trades","spot/openOrders","spot/orders","futures/position","futures/position/closed","futures/trades","futures/openOrders","futures/orders","futures/funding/predictedFundingFee/{symbol}"],post:["account/transfer","spot/orders","spot/orders/cancelAllOnTimeout","futures/orders","futures/orders/cancelAllOnTimeout","futures/position/sltp","futures/position/close","futures/position/leverage","futures/position/margin"],put:["spot/orders","futures/orders"],delete:["spot/orders/cancel/{orderID}","spot/orders/cancel/all","futures/orders/cancel/{orderID}","futures/orders/cancel/all"]}},fees:{trading:{tierBased:!1,percentage:!0,maker:6e-4,taker:.001},funding:{tierBased:!1,percentage:!0,withdraw:{}}},commonCurrencies:{XBT:"XBT"},exceptions:{exact:{2002:l,2003:c,10003:f,10006:a,10007:a,11007:a,20001:l,20009:d,3e4:c,30001:d,30004:d,30005:d,30006:d,30007:d,30008:d,30009:d,30010:d,30011:h,30012:f,30013:p,30014:c,30015:d,30016:n,30017:d,30018:d,30019:d,30020:d,30021:d,30022:d,30023:d,30024:d,30025:d,30026:d,30027:d,30028:p,30029:d,30030:d,30031:d,30032:d,30033:d,30034:u,30035:u,30036:o,30037:d,30038:n,30039:l,30040:d,30041:d,30042:d,30043:d,30044:f,30045:d,30046:d,30047:d,30048:d,30049:d,30050:d,40004:f,40009:u,40102:a,40103:a,40303:m,41001:f,41002:f,42001:o,50001:n,50002:n},broad:{}},precisionMode:y,options:{defaultType:"spot"}})}async fetchStatus(e={}){const t=await this.publicGetAnnouncementMaintenance(e),s=this.safeValue(t,"data",{}),i=this.milliseconds(),r=this.parse8601(this.safeString(s,"startTime")),a=this.parse8601(this.safeString(s,"endTime")),n={updated:this.safeInteger(t,"ts",i)};if(void 0!==a){const e=void 0===r||i<r,t=i>a||e;n.eta=a,n.status=t?"ok":"maintenance"}return this.status=this.extend(this.status,n),this.status}async fetchMarkets(e={}){const t=await this.publicGetInstruments(e),s=this.safeValue(t,"data"),i=[];for(let e=0;e<s.length;e++){const t=s[e],r=this.safeString(t,"symbol"),a=this.safeString(t,"base"),n=this.safeString(t,"quote"),o=this.safeCurrencyCode(a),c=this.safeCurrencyCode(n),d="enable"===this.safeString(t,"status"),h=this.safeNumber(t,"takerFee"),u=this.safeNumber(t,"makerFee"),l=this.safeString(t,"type");let f,p,m;const y="spot"===l,b="futures"===l,g=this.safeStringLower(t,"settleType");void 0!==g&&(f="inverse"===g,p="vanilla"===g,m="quanto"===g);let v=r;"spot"===l&&(v=o+"/"+c);const w={amount:this.safeNumber(t,"lotSize"),price:this.safeNumber(t,"tickSize")};i.push({id:r,symbol:v,base:o,quote:c,baseId:a,quoteId:n,type:l,spot:y,futures:b,inverse:f,linear:p,quanto:m,precision:w,info:t,active:d,taker:h,maker:u,percentage:!1,tierBased:!0,limits:{amount:{min:this.safeString(t,"minQuantity"),max:this.safeString(t,"maxQuantity")},price:{min:this.safeString(t,"minPrice"),max:this.safeString(t,"maxPrice")},cost:{min:void 0,max:void 0}}})}return i}parseTicker(e,t){const s=this.safeInteger(e,"t"),i=this.safeString(e,"s"),r=this.safeSymbol(i,t),a=this.safeNumber(e,"c"),n=this.safeNumber(e,"o");let o,c,d;void 0!==a&&void 0!==n&&(o=a-n,n>0&&(c=o/n*100),d=this.sum(a,n)/2);const h=this.safeNumber(e,"v");return{symbol:r,timestamp:s,datetime:this.iso8601(s),high:this.safeNumber(e,"h"),low:this.safeNumber(e,"l"),bid:void 0,bidVolume:void 0,ask:void 0,askVolume:void 0,vwap:void 0,open:n,close:a,last:a,previousClose:void 0,change:o,percentage:c,average:d,baseVolume:void 0,quoteVolume:h,info:e}}async fetchTicker(e,t={}){const s=await this.fetchTickers(void 0,t);if(e in s)return s[e];throw new p(this.id+" fetchTicker() symbol "+e+" ticker not found")}async fetchTickers(e,t={}){await this.loadMarkets();const s=await this.publicGetMarketTickers(t),i=this.safeValue(s,"tickers",[]),r=[],a=this.safeInteger(s,"t");for(let e=0;e<i.length;e++){const t=this.parseTicker(this.extend(i[e],{t:a}));r.push(t)}return this.filterByArray(r,"symbol",e)}async fetchOrderBook(e,t,s={}){await this.loadMarkets();const i=this.market(e);if(void 0===t)t=20;else if(20!==t&&50!==t)throw new f(this.id+" fetchOrderBook() limit argument must be undefined, 20 or 50");const r={symbol:i.id,level:t},a=await this.publicGetMarketOrderbook(this.extend(r,s)),n=this.safeInteger(a,"t");return this.parseOrderBook(a,n)}parseTrade(e,t){let s=this.safeInteger(e,"t");void 0===s&&(s=this.parse8601(this.safeString(e,"createTime")));const i=this.safeString2(e,"tid","tradeID");let r;const a=this.safeString(e,"symbol");void 0!==(t=this.safeMarket(a,t))&&(r=t.symbol);let n=this.safeString2(e,"p","filledPrice");const o=this.safeString2(e,"q","filledQty"),c=this.safeString(e,"orderID"),d=this.safeValue(e,"taker");let h;void 0!==d&&(h=d?"taker":"maker");let u=this.safeString(e,"side");"1"===u?u="buy":"2"===u&&(u="sell"),void 0===u&&(u="-"===n[0]?"sell":"buy"),n=b.stringAbs(n);const l=this.parseNumber(n),f=this.parseNumber(o),p=this.parseNumber(b.stringMul(n,o)),m=this.parseOrderType(this.safeString(e,"orderType"));let y;const g=this.safeNumber(e,"commission");if(void 0!==g){let e;void 0!==t&&("buy"===u?e=t.base:"sell"===u&&(e=t.quote)),y={currency:e,cost:g}}return{info:e,id:i,timestamp:s,datetime:this.iso8601(s),symbol:r,type:m,side:u,order:c,takerOrMaker:h,price:l,amount:f,cost:p,fee:y}}async fetchTrades(e,t,s,i={}){await this.loadMarkets();const r=this.market(e);s=void 0===s?2e3:s,s=Math.min(s,2e3);const a={symbol:r.id,limit:s},n=await this.publicGetMarketTrades(a),o=this.safeValue(n,"trades",[]);return this.parseTrades(o,r,t,s)}parseOHLCV(e,t){return[this.safeTimestamp(e,5),this.safeNumber(e,0),this.safeNumber(e,1),this.safeNumber(e,2),this.safeNumber(e,3),this.safeNumber(e,4)]}async fetchOHLCV(e,t="1h",s,i,r={}){await this.loadMarkets();const a=this.market(e),n={symbol:a.id,timeFrame:this.timeframes[t]};i=void 0===i?500:i;const o=this.parseTimeframe(t);if(void 0===s){const e=this.seconds();n.start=e-o*i,n.end=e}else{const e=parseInt(s/1e3);n.start=e,n.end=this.sum(e,o*i)}const c=await this.publicGetMarketHistoryCandles(this.extend(n,r)),d=this.safeValue(c,"data",[]);return this.parseOHLCVs(d,a,t,s,i)}async fetchBalance(e={}){await this.loadMarkets();const t=this.safeString2(this.options,"fetchBalance","defaultType","spot"),s=this.safeString(e,"type",t),i=this.safeString({spot:"SPTP",future:"FUTP",otc:"F2CP",saving:"VLTP"},s,s),r={purseType:i};e=this.omit(e,"type");const a=await this.privateGetAccountBalances(this.extend(r,e)),n=this.safeValue(a,"data"),o={info:a};for(let e=0;e<n.length;e++){const t=n[e];if(this.safeString(t,"purseType")===i){const e=this.safeString(t,"currency"),s=this.safeCurrencyCode(e),i=this.account();i.free=this.safeString(t,"available"),i.used=this.safeString(t,"unavailable"),o[s]=i}}return this.parseBalance(o,!1)}async createOrder(e,t,s,i,a,n={}){let o=t.toUpperCase();const c=s.toUpperCase();await this.loadMarkets();const d=this.market(e),h={symbol:d.id,orderQty:this.amountToPrecision(e,i),side:c},u=this.safeString(n,"timeInForce");void 0!==u&&(h.timeInForce=u,n=this.omit(n,"timeInForce"));const l=this.safeString2(n,"clOrdID","clientOrderId");void 0!==l&&(h.clOrdID=l,n=this.omit(n,["clOrdID","clientOrderId"]));const f=this.safeNumber(n,"stopPrice");if(void 0===f){if("STOP-LIMIT"===o||"STOP"===o)throw new r(this.id+" createOrder() requires a stopPrice parameter for "+o+" orders")}else"LIMIT"===o?o="STOP-LIMIT":"MARKET"===o&&(o="STOP"),h.stopPrice=this.priceToPrecision(e,f),n=this.omit(n,"stopPrice");let p;"LIMIT"!==o&&"STOP-LIMIT"!==o||(h.price=this.priceToPrecision(e,a)),h.orderType=o,d.spot?p="privatePostSpotOrders":d.futures&&(p="privatePostFuturesOrders");const m=await this[p](this.extend(h,n)),y=this.safeValue(m,"data",{});return this.parseOrder(y,d)}async editOrder(e,t,s,i,r,a,n={}){await this.loadMarkets();const o=this.market(t),c={orderID:e},d=this.safeNumber(n,"stopPrice");let h;void 0!==d&&(c.stopPrice=this.priceToPrecision(t,d),n=this.omit(n,"stopPrice")),void 0!==a&&(c.price=this.priceToPrecision(t,a)),void 0!==r&&(c.orderQty=this.amountToPrecision(t,r)),o.spot?h="privatePutSpotOrders":o.futures&&(h="privatePutFuturesOrders");const u=await this[h](this.extend(c,n)),l=this.safeValue(u,"data",{});return this.parseOrder(l,o)}async cancelOrder(e,t,s={}){await this.loadMarkets();const i={orderID:e};let r;const a=this.safeString2(this.options,"cancelOrder","defaultType","spot");let n,o=this.safeString(s,"type",a);s=this.omit(s,"type"),void 0!==t&&(n=this.market(t),o=n.type),"spot"===o?r="privateDeleteSpotOrdersCancelOrderID":"futures"===o&&(r="privateDeleteFuturesOrdersCancelOrderID");const c=await this[r](this.extend(i,s)),d=this.safeValue(c,"data",{});return this.parseOrder(d,n)}async cancelAllOrders(e,t={}){if(void 0===e)throw new r(this.id+" cancelAllOrders() requires a symbol argument");await this.loadMarkets();const s=this.market(e),i={symbol:s.id};let a;return s.spot?a="privateDeleteSpotOrdersCancelAll":s.futures&&(a="privateDeleteFuturesOrdersCancelAll"),await this[a](this.extend(i,t))}async fetchOrder(e,t,s={}){await this.loadMarkets();const i=this.safeString2(this.options,"fetchOrder","defaultType","spot");s.type=this.safeString(s,"type",i);const r={},a=this.safeString2(s,"clOrdID","clientOrderId");void 0===a?r.orderID=e:(r.clOrdID=a,s=this.omit(s,["clOrdID","clientOrderId"]));const n=await this.fetchOrders(t,void 0,void 0,this.extend(r,s)),o=this.safeValue(n,0);if(void 0===o)throw new c(void 0===a?this.id+" fetchOrder() could not find order id "+e:this.id+" fetchOrder() could not find order clientOrderID "+a);return o}async fetchOpenOrders(e,t,s,i={}){await this.loadMarkets();const r={},a=this.safeString2(this.options,"fetchOpenOrders","defaultType","spot");let n,o=this.safeString(i,"type",a);i=this.omit(i,"type"),void 0!==e&&(n=this.market(e),r.symbol=n.id,o=n.type);const c=this.safeString2(i,"clOrdID","clientOrderId");let d;void 0!==c&&(r.clOrdID=c,i=this.omit(i,["clOrdID","clientOrderId"])),"spot"===o?d="privateGetSpotOpenOrders":"futures"===o&&(d="privateGetFuturesOpenOrders"),void 0!==s&&(r.pageSize=s);const h=await this[d](this.extend(r,i)),u=this.safeValue(h,"data",{}),l=this.safeValue(u,"list",[]);return this.parseOrders(l,n,t,s)}async fetchClosedOrders(e,t,s,i={}){return await this.fetchOrders(e,t,s,this.extend({orderStatus:"2"},i))}async fetchCanceledOrders(e,t,s,i={}){return await this.fetchOrders(e,t,s,this.extend({orderStatus:"3"},i))}async fetchOrders(e,t,s,i={}){await this.loadMarkets();const r={};let a;const n=this.safeString2(this.options,"fetchOrders","defaultType","spot");let o,c=this.safeString(i,"type",n);i=this.omit(i,"type"),void 0!==e&&(o=this.market(e),r.symbol=o.id,c=o.type),"spot"===c?a="privateGetSpotOrders":"futures"===c&&(a="privateGetFuturesOrders");const d=this.safeString2(i,"clOrdID","clientOrderId");void 0!==d&&(r.clOrdID=d,i=this.omit(i,["clOrdID","clientOrderId"])),void 0!==s&&(r.pageSize=s),void 0!==t&&(r.startDate=this.ymd(t));const h=await this[a](this.extend(r,i)),u=this.safeValue(h,"data",{}),l=this.safeValue(u,"list",[]);return this.parseOrders(l,o,t,s)}parseOrderStatus(e){return this.safeString({0:"open",1:"open",2:"open",3:"closed",4:"canceled",5:"canceled",6:"rejected",10:"expired",11:"rejected"},e,e)}parseOrderType(e){return this.safeString({1:"market",2:"limit",3:"stop",4:"stop-limit",7:"stop-loss",8:"take-profit"},e,e)}parseTimeInForce(e){return this.safeString({1:"GTC",3:"IOC",4:"FOK"},e,e)}parseOrder(e,t){let s=this.safeValue(e,"createTime");"string"==typeof s&&(s=this.parse8601(s));const i=this.parseOrderStatus(this.safeString(e,"orderStatus")),r=this.parseOrderType(this.safeString(e,"orderType"));let a=this.safeString(e,"side");"1"===a?a="buy":"2"===a&&(a="sell");const n=this.safeString(e,"orderID"),o=this.safeString(e,"clOrdID"),c=this.safeString(e,"symbol"),d=(t=this.safeMarket(c,t)).symbol,h=this.safeNumber(e,"price"),u=this.safeNumber(e,"stopPrice"),l=this.parseTimeInForce(this.safeString(e,"timeInForce")),f="Post-Only"===this.safeString(e,"execInst"),p=this.safeNumber(e,"avgPrice"),m=this.safeNumber(e,"orderQty"),y=this.safeNumber(e,"cumQty");let b,g,v,w=this.safeNumber(e,"leavesQty");0===y&&0===w&&(w=void 0),void 0!==y&&(void 0!==h&&(b=y*h),y>0&&(g=this.safeValue(e,"transactTime"),"string"==typeof g&&(g=this.parse8601(g))));const k=this.safeNumber(e,"commission");if(void 0!==k){let e;void 0!==t&&("buy"===a?e=t.base:"sell"===a&&(e=t.quote)),v={currency:e,cost:k}}return{id:n,info:e,clientOrderId:o,timestamp:s,datetime:this.iso8601(s),lastTradeTimestamp:g,status:i,symbol:d,type:r,timeInForce:l,postOnly:f,side:a,price:h,stopPrice:u,average:p,amount:m,filled:y,remaining: