@barchart/marketdata-api-js
Advanced tools
Comparing version 3.1.1 to 3.1.2
{ | ||
"name": "barchart-marketdata-api", | ||
"version": "3.0.8", | ||
"version": "3.1.2", | ||
"homepage": "https://github.com/barchart/marketdata-api-js", | ||
"description": "Barchart Market Data API for JavaScript", | ||
"main": "dist/barchart-marketdata-api-3.0.js", | ||
"main": "dist/barchart-marketdata-api-3.1.js", | ||
"dependencies": {}, | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,(t.Barchart||(t.Barchart={})).RealtimeData=e()}}(function(){return function e(t,r,n){function i(s,o){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return i(r?r:e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,r){"use strict";t.exports=function(){var e={keys:function t(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(r);return t}};return e}()},{}],2:[function(e,t,r){"use strict";var n=e("./websocket/Connection");t.exports=function(){return n}()},{"./websocket/Connection":5}],3:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("./../marketState/MarketState");t.exports=function(){var e=function(){function e(){var t=this;n(this,e),this._server=null,this._username=null,this._password=null,this._marketState=new a(function(e){return t._handleProfileRequest(e)}),this._pollingFrequency=null}return i(e,[{key:"connect",value:function(e,t,r){this._server=e,this._username=t,this._password=r,this._connect()}},{key:"_connect",value:function(){}},{key:"disconnect",value:function(){this._server=null,this._username=null,this._password=null,this._disconnect()}},{key:"_disconnect",value:function(){}},{key:"on",value:function(){this._on.apply(this,arguments)}},{key:"_on",value:function(){}},{key:"off",value:function(){this._off.apply(this,arguments)}},{key:"_off",value:function(){}},{key:"getActiveSymbolCount",value:function(){return this._getActiveSymbolCount()}},{key:"_getActiveSymbolCount",value:function(){return null}},{key:"getPollingFrequency",value:function(){return this._pollingFrequency}},{key:"setPollingFrequency",value:function(e){this._pollingFrequency!==e&&(e&&e>0?this._pollingFrequency=e:this._pollingFrequency=null,this._onPollingFrequencyChanged(this._pollingFrequency))}},{key:"_onPollingFrequencyChanged",value:function(e){}},{key:"_handleProfileRequest",value:function(e){}},{key:"getMarketState",value:function(){return this._marketState}},{key:"getServer",value:function(){return this._server}},{key:"getPassword",value:function(){return this._password}},{key:"getUsername",value:function(){return this._username}},{key:"toString",value:function(){return"[ConnectionBase]"}}]),e}();return e}()},{"./../marketState/MarketState":8}],4:[function(e,t,r){"use strict";var n=e("./Connection");t.exports=function(){return n}()},{"./Connection":2}],5:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e("@barchart/marketdata-utilities-js"),u=e("./../../../common/lang/object"),c=e("./../../ConnectionBase"),l=e("./../../../messageParser/parseMessage");t.exports=function(){function e(e){function n(e,t){var r=V.length-1;r>0&&V[r].id===e?V[r].symbols.push(t):V.push({id:e,symbols:[t]})}function i(e,t){var r=void 0;switch(e){case"events":r=G.events;break;case"marketDepth":r=G.marketDepth[t.symbol];break;case"marketUpdate":r=G.marketUpdate[t.symbol];break;case"timestamp":r=G.timestamp}r&&r.forEach(function(e){return e(t)})}function a(){u.keys(R).forEach(function(e){n("MU_GO",e)}),u.keys(z).forEach(function(e){n("MU_GO",e)}),u.keys(U).forEach(function(e){n("MD_GO",e)})}function s(){u.keys(R).forEach(function(e){n("MU_STOP",e)}),u.keys(z).forEach(function(e){n("MU_STOP",e)}),u.keys(U).forEach(function(e){n("MU_STOP",e)})}function c(e,t,n){A||D||(X.username=t,X.password=n,X.server=e,window.WebSocket?(M=r.disconnected,A=new WebSocket("wss://"+X.server+"/jerq"),A.binaryType="arraybuffer",A.onclose=function(e){console.warn(new Date+" connection closed."),A=null,M===r.authenticated&&(M=r.disconnected,i("events",{event:"disconnect"}),setTimeout(function(){A=null,c(X.server,X.username,X.password),a()},m))},A.onmessage=function(e){if(e.data instanceof ArrayBuffer){var t=$.decode(e.data);t&&H.push(t)}else H.push(e.data)},A.onopen=function(e){console.log(new Date+" connection open.")}):console.warn("Websockets are not supported by this browser."))}function d(){M=r.disconnected,null!==A&&(A.send("LOGOUT\r\n"),A.close()),V=[],B=[],q=[],U={},R={},z={}}function p(e){if(M===r.disconnected&&(M=r.connecting),M===r.connecting){var n=e.split("\n");n.forEach(function(e){"+++"==e&&(M=r.authenticating,B.push("LOGIN "+X.username+":"+X.password+" VERSION="+t+"\r\n"))})}else if(M===r.authenticating){var a=e.charAt(0);"+"===a?(M=r.authenticated,i("events",{event:"login success"})):"-"===a&&(d(),i("events",{event:"login fail"}))}M===r.authenticated&&q.push(e)}function h(){if(arguments.length<2)throw new Error("Wrong number of arguments. Must pass in an eventId and handler.");var e=arguments[0],t=arguments[1],r=void 0;r=arguments.length>2?arguments[2]:null;var i=function(e){var r=e||[];return r.filter(function(e){return e!==t})},a=function(e,t){return t.reduce(function(t,r){return t||r.hasOwnProperty(e)},!1)},s=function(e,t,s,u,c){var l=r,f=o.symbolParser.getProducerSymbol(l),m=s[l]||[],d=i(m);if(s[l]=d,m.length>0&&0===d.length){delete s[l];var p=!0,h=!0,v=F[f]||[];a(l,c)||(p=!0),p&&(v=v.filter(function(e){var t=e!==l;return!t&&a(e,[s])&&(h=!1),t}),F[f]=v),h&&(delete e[f],u.forEach(function(e){e.hasOwnProperty(f)&&(h=!1)}),h&&n(t,f))}};switch(e){case"events":G.events=i(G.events);break;case"marketDepth":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('marketDepth', handler, symbol)");s(U,"MD_STOP",G.marketDepth,[],[]);break;case"marketUpdate":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('marketUpdate', handler, symbol)");s(R,"MU_STOP",G.marketUpdate,[z],[G.cumulativeVolume]);break;case"cumulativeVolume":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('cumulativeVolume', handler, symbol)");s(z,"MU_STOP",G.cumulativeVolume,[R],[G.marketUpdate]),N.getCumulativeVolume(r,function(e){e.off("events",t)});break;case"timestamp":G.timestamp=i(G.timestamp)}}function v(){if(arguments.length<2)throw new Error("Bad number of arguments. Must pass in an eventId and handler.");var e=arguments[0],t=arguments[1],r=void 0;r=arguments.length>2?arguments[2]:null;var i=function(e){e=e||[];var r=!e.some(function(e){return e===t}),n=void 0;return r?(n=e.slice(0),n.push(t)):n=e,n},a=function(e,t,a,s){var u=r,c=o.symbolParser.getProducerSymbol(u);a[u]=i(a[u]);var l=F[c]||[],f=!l.some(function(e){return e===u});if(f&&(l=l.slice(0),l.push(u),F[c]=l),!e[c]){e[c]=!0;var m=!s.some(function(e){return e[c]});m&&n(t,c)}};switch(e){case"events":G.events=i(G.events);break;case"marketDepth":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: on('marketDepth', handler, symbol)");a(U,"MD_GO",G.marketDepth,[]),N.getBook(r)&&t({type:"INIT",symbol:r});break;case"marketUpdate":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: on('marketUpdate', handler, symbol)");a(R,"MU_GO",G.marketUpdate,[z]),N.getQuote(r)&&t({type:"INIT",symbol:r});break;case"cumulativeVolume":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: on('cumulativeVolume', handler, symbol)");a(z,"MU_GO",G.cumulativeVolume,[R]),N.getCumulativeVolume(r,function(e){e.on("events",t)});break;case"timestamp":G.timestamp=i(G.timestamp)}}function b(e){switch(N.processMessage(e),e.type){case"BOOK":i("marketDepth",e);break;case"TIMESTAMP":i("timestamp",N.getTimestamp());break;default:i("marketUpdate",e)}}function y(e){var t=void 0;try{if(t=l(e),t.type)if(t.symbol){var r=F[t.symbol]||[];L.hasOwnProperty(t.symbol)&&(r=r.concat(L[t.symbol]).filter(function(e,t,r){return r.indexOf(e)===t}),delete L[t.symbol]),r.forEach(function(e){var r=void 0;e===t.symbol?r=t:(r=Object.assign({},t),r.symbol=e),b(r)})}else b(t);else console.log(e)}catch(n){console.error(n),console.log(t)}}function g(){if(M===r.authenticating||M===r.authenticated)for(var e=B.shift();e;)console.log(e),A.send(e),e=B.shift();setTimeout(g,200)}function P(){for(var e=9,t=!1;!t;){var r=q.shift();if(r){var n=!1,i=1,a=-1,s=r.indexOf(f.etx),o=r.indexOf(f.lf);if(o>-1&&(s<0||o<s)?(a=o,i=2):s>-1&&(a=s),a>-1){var u=a+1;if(1==i&&(r.length<a+e+1?(q.length>0?q[0]=r+q[0]:(q.unshift(r),t=!0),n=!0):r.substr(a+1,1)==f.dc4&&(u+=e+1)),!n){var c=r.substring(0,u);2==i?c=c.trim():(a=c.indexOf(f.soh),a>0&&(c=c.substring(a))),c.length>0&&y(c),r=r.substring(u),r.length>0&&(q.length>0?q[0]=r+q[0]:q.unshift(r))}}else r.length>0&&(q.length>0?q[0]=r+q[0]:(q.unshift(r),t=!0))}else t=!0;0===q.length&&(t=!0)}setTimeout(P,125)}function k(){for(var e=H.shift();e;)p(e),e=H.shift();setTimeout(k,125)}function w(e){if(M===r.authenticated)for(;V.length>0;){var t=V.shift();if(t.callback)t.callback();else if(t.id){var n="",i="";switch(t.id){case"MD_GO":n="GO",i="Bb";break;case"MU_GO":n="GO",i="Ssc";break;case"MD_STOP":n="STOP",i="Bb";break;case"MU_STOP":n="STOP",i="Ssc";break;case"P_SNAPSHOT":n="GO",i="s"}var a=t.symbols.filter(function(e,t,r){return r.indexOf(e)===t}),s=void 0;for(s="MD_GO"===t.id||"MD_STOP"===t.id?1:250;a.length>0;){var o=a.splice(0,s);B.push(n+" "+o.join(",")+"="+i)}}}e||S(!1)}function I(){if(M===r.authenticated&&0===B.length){V=[];var e=function(e){for(var t=[];0!==e.length;)t.push(e.splice(0,250));return t},t=e(T([R,z]));t.forEach(function(e){B.push("GO "+e.join(",")+"=sc")});e(u.keys(U));t.forEach(function(e){B.push("GO "+e.join(",")+"=b")});var n=e(u.keys(L)).filter(function(e){return!t.some(function(t){return t===e})});n.forEach(function(e){B.push("GO "+e.join(",")+"=s")})}S(!0)}function _(e){j!==e&&(j=e)}function T(e){return u.keys(e.reduce(function(e,t){for(var r in t)t[r]===!0&&(e[r]=!0);return e},{}))}function O(){return T([R,U,z]).length}function S(e){var t=void 0,r=void 0;j?(e||(s(),w(!0)),t=I,r=j):(e&&a(),t=w,r=250),setTimeout(t,r)}function C(e,t,r){D=!1,c(e,t,r)}function E(){D=!0,X.username=null,X.password=null,X.server=null,d()}function x(e){var t=o.symbolParser.getProducerSymbol(e);L[t]=[e,t],n("P_SNAPSHOT",t)}var N=e,M=r.disconnected,D=!1,j=null,A=null,F={},U={},R={},z={},L={},V=[],B=[],q=[],H=[],G={events:[],marketDepth:{},marketUpdate:{},cumulativeVolume:{},timestamp:[]},X={username:null,password:null,server:null},$=void 0;return $=window.TextDecoder?new TextDecoder:{decode:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},setTimeout(g,200),setTimeout(k,125),setTimeout(P,125),setTimeout(S,250),{connect:C,disconnect:E,off:h,on:v,getActiveSymbolCount:O,setPollingFrequency:_,handleProfileRequest:x}}var t=4,r={connecting:"CONNECTING",authenticating:"LOGGING_IN",authenticated:"LOGGED_IN",disconnected:"DISCONNECTED"},f={soh:"",etx:"",lf:"\n",dc4:""},m=5e3,d=function(t){function r(){n(this,r);var t=i(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t._internal=e(t.getMarketState()),t}return a(r,t),s(r,[{key:"_connect",value:function(){this._internal.connect(this.getServer(),this.getUsername(),this.getPassword())}},{key:"_disconnect",value:function(){this._internal.disconnect()}},{key:"_on",value:function(){this._internal.on.apply(this._internal,arguments)}},{key:"_off",value:function(){this._internal.off.apply(this._internal,arguments)}},{key:"_getActiveSymbolCount",value:function(){return this._internal.getActiveSymbolCount()}},{key:"_onPollingFrequencyChanged",value:function(e){return this._internal.setPollingFrequency(e)}},{key:"_handleProfileRequest",value:function(e){this._internal.handleProfileRequest(e)}},{key:"toString",value:function(){return"[Connection]"}}]),r}(c);return d}()},{"./../../../common/lang/object":1,"./../../../messageParser/parseMessage":13,"./../../ConnectionBase":3,"@barchart/marketdata-utilities-js":31}],6:[function(e,t,r){"use strict";var n=e("./connection/index"),i=e("./marketState/index"),a=e("./messageParser/index"),s=e("./util/index");t.exports=function(){return{Connection:n,MarketState:i,MessageParser:a,messageParser:a,Util:s,util:s,version:"3.1.1"}}()},{"./connection/index":4,"./marketState/index":11,"./messageParser/index":12,"./util/index":22}],7:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("./../common/lang/object");t.exports=function(){var e={update:"update",reset:"reset"},t=function(){function t(e,r){n(this,t),this.symbol=e,this._tickIncrement=r,this._handlers=[],this._priceLevels={},this._highPrice=null,this._lowPrice=null}return i(t,[{key:"on",value:function(e,t){var n=this;if("events"===e){var i=this._handlers.indexOf(t);if(i<0){var a=this._handlers.slice(0);a.push(t),this._handlers=a,this.toArray().forEach(function(e){r(n,t,e)})}}}},{key:"off",value:function(e,t){if("events"===e){var r=this._handlers.indexOf(t);if(!(r<0)){var n=this._handlers.slice(0);n.splice(r,1),this._handlers=n}}}},{key:"getTickIncrement",value:function(){return this._tickIncrement}},{key:"getVolume",value:function(e){var t=e.toString(),r=this._priceLevels[t];return r?r.volume:0}},{key:"incrementVolume",value:function(e,t){if(this._highPrice&&this._lowPrice){if(e>this._highPrice){for(var r=this._highPrice+this._tickIncrement;r<e;r+=this._tickIncrement)s(this,this._handlers,o(this._priceLevels,r.toString(),r));this._highPrice=e}else if(e<this._lowPrice){for(var n=this._lowPrice-this._tickIncrement;n>e;n-=this._tickIncrement)s(this,this._handlers,o(this._priceLevels,n.toString(),n));this._lowPrice=e}}else this._lowPrice=this._highPrice=e;var i=e.toString(),a=this._priceLevels[i];a||(a=o(this._priceLevels,i,e)),a.volume+=t,s(this,this._handlers,a)}},{key:"reset",value:function(){var t=this;this._priceLevels={},this._highPrice=null,this._lowPrice=null,this._handlers.forEach(function(r){r({container:t,event:e.reset})})}},{key:"toArray",value:function(){var e=this,t=a.keys(this._priceLevels).map(function(t){var r=e._priceLevels[t];return{price:r.price,volume:r.volume}});return t.sort(function(e,t){return e.price-t.price}),t}},{key:"dispose",value:function(){this._priceLevels={},this._highPrice=null,this._lowPrice=null,this._handlers=[]}}],[{key:"clone",value:function u(e,r){var u=new t(e,r.getTickIncrement());return r.toArray().forEach(function(e){u.incrementVolume(e.price,e.volume)}),u}}]),t}(),r=function(t,r,n){try{r({container:t,event:e.update,price:n.price,volume:n.volume})}catch(i){console.error("An error was thrown by a cumulative volume observer.",i)}},s=function(e,t,n){t.forEach(function(t){r(e,t,n)})},o=function(e,t,r){var n={price:r,volume:0};return e[t]=n,n};return t}()},{"./../common/lang/object":1}],8:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("@barchart/marketdata-utilities-js"),s=e("./CumulativeVolume"),o=e("./Profile"),u=e("./Quote"),c=e("./../util/convertDayCodeToNumber");t.exports=function(){function e(e){var t={},r={},n={},i={},l=void 0,f=function(e){var r=t[e];if(!r){r={symbol:e,bids:[],asks:[]};var n=a.symbolParser.getProducerSymbol(e),i=t[n];i&&(r.bids=i.bids.slice(0),r.asks=i.asks.slice(0)),t[e]=r}return r},m=function(e){var t=n[e];if(!t){t={container:null,callbacks:[]};var r=a.symbolParser.getProducerSymbol(e),i=n[r];i&&i.container&&(t.container=s.clone(e,i.container)),n[e]=t}return t},d=function(e){var t=r[e];if(!t){var n=a.symbolParser.getProducerSymbol(e),i=r[n];t=i?u.clone(e,i):new u(e),r[e]=t}return t},p=function(e){var t=o.Profiles[e];if(!t){var r=a.symbolParser.getProducerSymbol(e),n=o.Profiles[r];n&&(t=new o(e,n.name,n.exchange,n.unitcode,n.pointValue,n.tickIncrement))}return t},h=function(e){var t=e.symbol;if("TIMESTAMP"===e.type)return void(l=e.timestamp);if("BOOK"===e.type){var r=f(t);return r.asks=e.asks,void(r.bids=e.bids)}if("REFRESH_CUMULATIVE_VOLUME"==e.type){var a=m(t),u=a.container;if(u)u.reset();else{a.container=u=new s(t,e.tickIncrement);var h=a.callbacks||[];h.forEach(function(e){e(u)}),a.callbacks=null}return void e.priceLevels.forEach(function(e){u.incrementVolume(e.price,e.volume)})}var v=p(t);if(!v&&"REFRESH_QUOTE"!==e.type)return console.warn("No profile found for "+t),void console.log(e);var b=d(t);if(!b.day&&e.day&&(b.day=e.day,b.dayNum=c(b.day)),b.day&&e.day){var y=c(e.day);if(y>b.dayNum||b.dayNum-y>5)b.day=e.day,b.dayNum=y,b.flag="p",b.bidPrice=0,b.bidSize=void 0,b.askPrice=void 0,b.askSize=void 0,b.settlementPrice?(b.previousPrice=b.settlementPrice,b.settlementPrice=void 0):b.lastPrice&&(b.previousPrice=b.lastPrice),b.lastPrice=void 0,b.tradePrice=void 0,b.tradeSize=void 0,b.numberOfTrades=void 0,b.openPrice=void 0,b.highPrice=void 0,b.lowPrice=void 0,b.volume=void 0;else if(b.dayNum>y)return;var g=n[t];switch(e.type){case"HIGH":b.highPrice=e.value;break;case"LOW":b.lowPrice=e.value;break;case"OPEN":b.flag=void 0,b.openPrice=e.value,b.highPrice=e.value,b.lowPrice=e.value,b.lastPrice=e.value,g&&g.container&&g.container.reset();break;case"OPEN_INTEREST":b.openInterest=e.value;break;case"REFRESH_DDF":switch(e.subrecord){case"1":case"2":case"3":b.message=e,null===e.openPrice?b.openPrice=void 0:e.openPrice&&(b.openPrice=e.openPrice),null===e.highPrice?b.highPrice=void 0:e.highPrice&&(b.highPrice=e.highPrice),null===e.lowPrice?b.lowPrice=void 0:e.lowPrice&&(b.lowPrice=e.lowPrice),null===e.lastPrice?b.lastPrice=void 0:e.lastPrice&&(b.lastPrice=e.lastPrice),null===e.bidPrice?b.bidPrice=void 0:e.bidPrice&&(b.bidPrice=e.bidPrice),null===e.askPrice?b.askPrice=void 0:e.askPrice&&(b.askPrice=e.askPrice),null===e.previousPrice?b.previousPrice=void 0:e.previousPrice&&(b.previousPrice=e.previousPrice),null===e.settlementPrice?(b.settlementPrice=void 0,"s"==b.flag&&(b.flag=void 0)):e.settlementPrice&&(b.settlementPrice=e.settlementPrice),null===e.volume?b.volume=void 0:e.volume&&(b.volume=e.volume),null===e.openInterest?b.openInterest=void 0:e.openInterest&&(b.openInterest=e.openInterest),"1"==e.subsrecord&&(b.lastUpdate=e.time)}break;case"REFRESH_QUOTE":v=new o(t,e.name,e.exchange,e.unitcode,e.pointValue,e.tickIncrement),b.message=e,b.flag=e.flag,b.mode=e.mode,b.lastUpdate=e.lastUpdate,b.bidPrice=e.bidPrice,b.bidSize=e.bidSize,b.askPrice=e.askPrice,b.askSize=e.askSize,b.lastPrice=e.lastPrice,b.tradeSize=e.tradeSize,b.numberOfTrades=e.numberOfTrades,b.previousPrice=e.previousPrice,b.settlementPrice=e.settlementPrice,b.openPrice=e.openPrice,b.highPrice=e.highPrice,b.lowPrice=e.lowPrice,b.volume=e.volume,b.openInterest=e.openInterest,e.tradeTime?b.time=e.tradeTime:e.timeStamp&&(b.time=e.timeStamp),i.hasOwnProperty(t)&&(i[t].forEach(function(e){e(v)}),delete i[t]);break;case"SETTLEMENT":b.lastPrice=e.value,b.settlement=e.value,"D"===e.element&&(b.flag="s");break;case"TOB":b.bidPrice=e.bidPrice,b.bidSize=e.bidSize,b.askPrice=e.askPrice,b.askSize=e.askSize,e.time&&(b.time=e.time);break;case"TRADE":for(b.flag=void 0,b.tradePrice=e.tradePrice,b.lastPrice=e.tradePrice,e.tradeSize&&(b.tradeSize=e.tradeSize,b.volume+=e.tradeSize),b.ticks.push({price:b.tradePrice,size:b.tradeSize});b.ticks.length>50;)b.ticks.shift();b.numberOfTrades||(b.numberOfTrades=0),b.numberOfTrades++,e.time&&(b.time=e.time),g&&g.container&&e.tradePrice&&e.tradeSize&&g.container.incrementVolume(b.tradePrice,b.tradeSize);break;case"TRADE_OUT_OF_SEQUENCE":e.tradeSize&&(b.volume+=e.tradeSize),g&&g.container&&e.tradePrice&&e.tradeSize&&g.container.incrementVolume(b.tradePrice,b.tradeSize);break;case"VOLUME":b.volume=e.value;break;case"VOLUME_YESTERDAY":break;case"VWAP":b.vwap1=e.value;break;default:console.error("Unhandled Market Message:"),console.log(e)}}},v=function(e){return t[e]},b=function(e,t){var r=m(e),n=void 0;return n=r.container?Promise.resolve(r.container):new Promise(function(e){r.callbacks.push(e)}),n.then(function(e){return"function"==typeof t&&t(e),e})},y=function(t,r){var n=p(t),a=void 0;return a=n?Promise.resolve(n):new Promise(function(r){i.hasOwnProperty(t)||(i[t]=[]),i[t].push(function(e){return r(e)}),e&&"function"==typeof e&&e(t)}),a.then(function(e){return"function"==typeof r&&r(e),e})},g=function(e){return r[e]},P=function(){return l};return{getBook:v,getCumulativeVolume:b,getProfile:y,getQuote:g,getTimestamp:P,processMessage:h}}var t=function(){function t(r){n(this,t),this._internal=e(r)}return i(t,[{key:"getBook",value:function(e){return this._internal.getBook(e)}},{key:"getCumulativeVolume",value:function(e,t){return this._internal.getCumulativeVolume(e,t)}},{key:"getProfile",value:function(e,t){return this._internal.getProfile(e,t)}},{key:"getQuote",value:function(e){return this._internal.getQuote(e)}},{key:"getTimestamp",value:function(){return this._internal.getTimestamp()}},{key:"processMessage",value:function(e){return this._internal.processMessage(e)}}],[{key:"CumulativeVolume",get:function(){return s}},{key:"Profile",get:function(){return o}},{key:"Quote",get:function(){return u}}]),t}();return t}()},{"./../util/convertDayCodeToNumber":19,"./CumulativeVolume":7,"./Profile":9,"./Quote":10,"@barchart/marketdata-utilities-js":31}],9:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("./../util/parseSymbolType"),s=e("./../util/priceFormatter");t.exports=function(){var e={},t=s("-",!0,",").format,r=function(){function r(t,i,s,o,u,c){n(this,r),this.symbol=t,this.name=i,this.exchange=s,this.unitCode=o,this.pointValue=u,this.tickIncrement=c;var l=a(this.symbol);l&&"future"===l.type&&(this.root=l.root,this.month=l.month,this.year=l.year),e[t]=this}return i(r,[{key:"formatPrice",value:function(e){return t(e,this.unitCode)}}],[{key:"setPriceFormatter",value:function(e,r,n){t=s(e,r,n).format}},{key:"PriceFormatter",value:function(e,t,n){r.setPriceFormatter(e,t,n)}},{key:"Profiles",get:function(){return e}}]),r}();return r}()},{"./../util/parseSymbolType":24,"./../util/priceFormatter":25}],10:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.exports=function(){var e=function(){function e(t){n(this,e),this.symbol=t||null,this.message=null,this.flag=null,this.mode=null,this.day=null,this.dayNum=0,this.session=null,this.lastUpdate=null,this.bidPrice=null,this.bidSize=null,this.askPrice=null,this.askSize=null,this.lastPrice=null,this.tradePrice=null,this.tradeSize=null,this.numberOfTrades=null,this.vwap1=null,this.vwap2=null,this.settlementPrice=null,this.openPrice=null,this.highPrice=null,this.lowPrice=null,this.volume=null,this.openInterest=null,this.previousPrice=null,this.time=null,this.ticks=[]}return i(e,null,[{key:"clone",value:function t(e,r){var t=Object.assign({},r);return t.symbol=e,t}}]),e}();return e}()},{}],11:[function(e,t,r){"use strict";var n=e("./MarketState");t.exports=function(){return n}()},{"./MarketState":8}],12:[function(e,t,r){"use strict";var n=e("./parseMessage"),i=e("./parseTimestamp"),a=e("./parseValue");t.exports=function(){return{parseMessage:n,parseTimestamp:i,parseValue:a,Parse:n,ParseTimestamp:i,ParseValue:a}}()},{"./parseMessage":13,"./parseTimestamp":14,"./parseValue":15}],13:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.messageParser}()},{"@barchart/marketdata-utilities-js":31}],14:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.timestampParser}()},{"@barchart/marketdata-utilities-js":31}],15:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.priceParser}()},{"@barchart/marketdata-utilities-js":31}],16:[function(e,t,r){"use strict";var n=e("xhr");t.exports=function(){return function(e){return Promise.resolve().then(function(){if("string"!=typeof e)throw new Error('The "symbol" argument must be a string.');if(0===e.length)throw new Error('The "symbol" argument must be at least one character.');return new Promise(function(t,r){try{var i={url:"https://instruments-prod.aws.barchart.com/instruments/"+encodeURIComponent(e),method:"GET"};n(i,function(n,i,a){if(n)r(n);else if(200!==i.statusCode)r("The server returned an HTTP "+i.statusCode+" response code.");else{var s=JSON.parse(a);s&&s.instrument&&s.instrument.symbol?t(s.instrument.symbol):r("The server was unable to resolve symbol "+e+".")}})}catch(a){r(a)}})})}}()},{xhr:46}],17:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.baseCodeToUnitCode}()},{"@barchart/marketdata-utilities-js":31}],18:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.dateToDayCode}()},{"@barchart/marketdata-utilities-js":31}],19:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.dayCodeToNumber}()},{"@barchart/marketdata-utilities-js":31}],20:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.unitCodeToBaseCode}()},{"@barchart/marketdata-utilities-js":31}],21:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.decimalFormatter}()},{"@barchart/marketdata-utilities-js":31}],22:[function(e,t,r){"use strict";var n=e("./convertBaseCodeToUnitCode"),i=e("./convertDateToDayCode"),a=e("./convertDayCodeToNumber"),s=e("./convertUnitCodeToBaseCode"),o=e("./decimalFormatter"),u=e("./monthCodes"),c=e("./parseSymbolType"),l=e("./priceFormatter"),f=e("./symbolResolver"),m=e("./timeFormatter");t.exports=function(){return{convertBaseCodeToUnitCode:n,convertUnitCodeToBaseCode:s,convertDateToDayCode:i,convertDayCodeToNumber:a,decimalFormatter:o,monthCodes:u,parseSymbolType:c,symbolResolver:f,BaseCode2UnitCode:n,DateToDayCode:i,DayCodeToNumber:a,MonthCodes:u,ParseSymbolType:c,PriceFormatter:l,TimeFormatter:m,UnitCode2BaseCode:s}}()},{"./convertBaseCodeToUnitCode":17,"./convertDateToDayCode":18,"./convertDayCodeToNumber":19,"./convertUnitCodeToBaseCode":20,"./decimalFormatter":21,"./monthCodes":23,"./parseSymbolType":24,"./priceFormatter":25,"./symbolResolver":16,"./timeFormatter":26}],23:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.monthCodes.getCodeToNameMap()}()},{"@barchart/marketdata-utilities-js":31}],24:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.symbolParser.parseInstrumentType}()},{"@barchart/marketdata-utilities-js":31}],25:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.priceFormatter}()},{"@barchart/marketdata-utilities-js":31}],26:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.timeFormatter}()},{"@barchart/marketdata-utilities-js":31}],27:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.exports=function(){var e=function(){function e(){n(this,e)}return i(e,[{key:"parse",value:function(e){if("string"!=typeof e)throw new Error('The "textDocument" argument must be a string.');return this._parse(e)}},{key:"_parse",value:function(e){return null}},{key:"toString",value:function(){return"[XmlDomParserBase]"}}]),e}();return e}()},{}],28:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e("./../XmlDomParserBase");t.exports=function(){var e=function(e){function t(){n(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return window.DOMParser?e._xmlDomParser=new DOMParser:e._xmlDomParser=null,e}return a(t,e),s(t,[{key:"_parse",value:function(e){var t=void 0;return this._xmlDomParser?t=this._xmlDomParser.parseFromString(e,"text/xml"):(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)),t}},{key:"toString",value:function(){return"[XmlDomParser]"}}]),t}(o);return e}()},{"./../XmlDomParserBase":27}],29:[function(e,t,r){"use strict";t.exports=function(){return{unitCodeToBaseCode:function(e){switch(e){case"2":return-1;case"3":return-2;case"4":return-3;case"5":return-4;case"6":return-5;case"7":return-6;case"8":return 0;case"9":return 1;case"A":return 2;case"B":return 3;case"C":return 4;case"D":return 5;case"E":return 6;case"F":return 7;default:return 0}},baseCodeToUnitCode:function(e){switch(e){case-1:return"2";case-2:return"3";case-3:return"4";case-4:return"5";case-5:return"6";case-6:return"7";case 0:return"8";case 1:return"9";case 2:return"A";case 3:return"B";case 4:return"C";case 5:return"D";case 6:return"E";case 7:return"F";default:return 0}},dateToDayCode:function(e){var t=e.getDate();return t>=1&&t<=9?String.fromCharCode("1".charCodeAt(0)+t-1):10==t?"0":String.fromCharCode("A".charCodeAt(0)+t-11)},dayCodeToNumber:function(e){ | ||
var t=parseInt(e,31);return t>9?t++:0===t&&(t=10),t}}}()},{}],30:[function(e,t,r){"use strict";var n=e("lodash.isnan");t.exports=function(){return function(e,t,r,i){if(""===e||void 0===e||null===e||n(e))return"";var a=e<0&&i===!0;a&&(e=0-e);var s=e.toFixed(t);if(!r||e>-1e3&&e<1e3)a&&(s="("+s+")");else{for(var o=s.length,u=e<0,c=0===t,l=0,f=[],m=o-1;!(m<0);m--){3!==l||u&&0===m||(f.unshift(r),l=0);var d=s.charAt(m);f.unshift(d),c?l+=1:"."===d&&(c=!0)}a&&(f.unshift("("),f.push(")")),s=f.join("")}return s}}()},{"lodash.isnan":43}],31:[function(e,t,r){"use strict";var n=e("./convert"),i=e("./decimalFormatter"),a=e("./messageParser"),s=e("./monthCodes"),o=e("./priceFormatter"),u=e("./symbolFormatter"),c=e("./symbolParser"),l=e("./priceParser"),f=e("./timeFormatter"),m=e("./timestampParser");t.exports=function(){return{convert:n,decimalFormatter:i,monthCodes:s,messageParser:a,priceFormatter:o,symbolParser:c,priceParser:l,symbolFormatter:u,timeFormatter:f,timestampParser:m}}()},{"./convert":29,"./decimalFormatter":30,"./messageParser":32,"./monthCodes":33,"./priceFormatter":34,"./priceParser":35,"./symbolFormatter":36,"./symbolParser":37,"./timeFormatter":38,"./timestampParser":39}],32:[function(e,t,r){"use strict";var n=e("./priceParser"),i=e("./timestampParser"),a=e("./common/xml/XmlDomParser");t.exports=function(){return function(e){var t={message:e,type:null};switch(e.substr(0,1)){case"%":var r=void 0;try{var s=new a;r=s.parse(e.substring(1))}catch(o){r=void 0}if(r){var u=r.firstChild;switch(u.nodeName){case"BOOK":t.symbol=u.attributes.getNamedItem("symbol").value,t.unitcode=u.attributes.getNamedItem("basecode").value,t.askDepth=parseInt(u.attributes.getNamedItem("bidcount").value),t.bidDepth=parseInt(u.attributes.getNamedItem("bidcount").value),t.asks=[],t.bids=[];var c=void 0,l=void 0;if(u.attributes.getNamedItem("askprices")&&u.attributes.getNamedItem("asksizes")){c=u.attributes.getNamedItem("askprices").value.split(","),l=u.attributes.getNamedItem("asksizes").value.split(",");for(var f=0;f<c.length;f++)t.asks.push({price:n(c[f],t.unitcode),size:parseInt(l[f])})}if(u.attributes.getNamedItem("bidprices")&&u.attributes.getNamedItem("bidsizes")){c=u.attributes.getNamedItem("bidprices").value.split(","),l=u.attributes.getNamedItem("bidsizes").value.split(",");for(var m=0;m<c.length;m++)t.bids.push({price:n(c[m],t.unitcode),size:parseInt(l[m])})}t.type="BOOK";break;case"QUOTE":for(var d=0;d<u.attributes.length;d++){switch(u.attributes[d].name){case"symbol":t.symbol=u.attributes[d].value;break;case"name":t.name=u.attributes[d].value;break;case"exchange":t.exchange=u.attributes[d].value;break;case"basecode":t.unitcode=u.attributes[d].value;break;case"pointvalue":t.pointValue=parseFloat(u.attributes[d].value);break;case"tickincrement":t.tickIncrement=parseInt(u.attributes[d].value);break;case"flag":t.flag=u.attributes[d].value;break;case"lastupdate":var p=u.attributes[d].value;t.lastUpdate=new Date(parseInt(p.substr(0,4)),parseInt(p.substr(4,2))-1,parseInt(p.substr(6,2)),parseInt(p.substr(8,2)),parseInt(p.substr(10,2)),parseInt(p.substr(12,2)));break;case"bid":t.bidPrice=n(u.attributes[d].value,t.unitcode);break;case"bidsize":t.bidSize=parseInt(u.attributes[d].value);break;case"ask":t.askPrice=n(u.attributes[d].value,t.unitcode);break;case"asksize":t.askSize=parseInt(u.attributes[d].value);break;case"mode":t.mode=u.attributes[d].value}for(var h={},v=0;v<u.childNodes.length;v++)if("SESSION"==u.childNodes[v].nodeName){var b={},y=u.childNodes[v].attributes;if(y.getNamedItem("id")&&(b.id=y.getNamedItem("id").value),y.getNamedItem("day")&&(b.day=y.getNamedItem("day").value),y.getNamedItem("last")&&(b.lastPrice=n(y.getNamedItem("last").value,t.unitcode)),y.getNamedItem("previous")&&(b.previousPrice=n(y.getNamedItem("previous").value,t.unitcode)),y.getNamedItem("open")&&(b.openPrice=n(y.getNamedItem("open").value,t.unitcode)),y.getNamedItem("high")&&(b.highPrice=n(y.getNamedItem("high").value,t.unitcode)),y.getNamedItem("low")&&(b.lowPrice=n(y.getNamedItem("low").value,t.unitcode)),y.getNamedItem("tradesize")&&(b.tradeSize=parseInt(y.getNamedItem("tradesize").value)),y.getNamedItem("numtrades")&&(b.numberOfTrades=parseInt(y.getNamedItem("numtrades").value)),y.getNamedItem("settlement")&&(b.settlementPrice=n(y.getNamedItem("settlement").value,t.unitcode)),y.getNamedItem("volume")&&(b.volume=parseInt(y.getNamedItem("volume").value)),y.getNamedItem("openinterest")&&(b.openInterest=parseInt(y.getNamedItem("openinterest").value)),y.getNamedItem("timestamp")){var g=y.getNamedItem("timestamp").value;b.timeStamp=new Date(parseInt(g.substr(0,4)),parseInt(g.substr(4,2))-1,parseInt(g.substr(6,2)),parseInt(g.substr(8,2)),parseInt(g.substr(10,2)),parseInt(g.substr(12,2)))}if(y.getNamedItem("tradetime")){var P=y.getNamedItem("tradetime").value;b.tradeTime=new Date(parseInt(P.substr(0,4)),parseInt(P.substr(4,2))-1,parseInt(P.substr(6,2)),parseInt(P.substr(8,2)),parseInt(P.substr(10,2)),parseInt(P.substr(12,2)))}b.id&&(h[b.id]=b)}var k="undefined"==typeof h.combined.lastPrice,w=!k&&"undefined"!=typeof h.combined.settlementPrice,I=k?h.previous:h.combined;h.combined.previousPrice?t.previousPrice=h.combined.previousPrice:t.previousPrice=h.previous.previousPrice,I.lastPrice&&(t.lastPrice=I.lastPrice),I.openPrice&&(t.openPrice=I.openPrice),I.highPrice&&(t.highPrice=I.highPrice),I.lowPrice&&(t.lowPrice=I.lowPrice),I.tradeSize&&(t.tradeSize=I.tradeSize),I.numberOfTrades&&(t.numberOfTrades=I.numberOfTrades),I.settlementPrice&&(t.settlementPrice=I.settlementPrice),I.volume&&(t.volume=I.volume),I.openInterest&&(t.openInterest=I.openInterest),"combined"===I.id&&h.previous.openInterest&&(t.openInterest=h.previous.openInterest),I.timeStamp&&(t.timeStamp=I.timeStamp),I.tradeTime&&(t.tradeTime=I.tradeTime),h.combined.day&&(t.day=h.combined.day),k&&"undefined"==typeof t.flag&&(t.flag="p");var _=h.previous;if(t.previousPreviousPrice=_.previousPrice,t.previousSettlementPrice=_.settlementPrice,t.previousOpenPrice=_.openPrice,t.previousHighPrice=_.highPrice,t.previousLowPrice=_.lowPrice,t.previousTimeStamp=_.timeStamp,h.combined.day){var T="session_"+h.combined.day+"_T";if(h.hasOwnProperty(T)){var O=h[T],S=O.lastPrice;if(S){var C=O.tradeTime,E=O.tradeSize,x=void 0;if(C){var N=new Date(C.getFullYear(),C.getMonth(),C.getDate(),12,0,0,0);x=C.getTime()>N.getTime()}else x=!1;t.sessionT=x;var M=k||x;M&&(t.lastPriceT=S),(k||w)&&(t.session="T",M&&(C&&(t.tradeTime=C),E&&(t.tradeSize=E)),k&&(O.volume&&(t.volume=O.volume),O.previousPrice&&(t.previousPrice=O.previousPrice)))}}}}t.type="REFRESH_QUOTE";break;case"CV":t.type="REFRESH_CUMULATIVE_VOLUME",t.symbol=u.attributes.getNamedItem("symbol").value,t.unitCode=u.attributes.getNamedItem("basecode").value,t.tickIncrement=n(u.attributes.getNamedItem("tickincrement").value,t.unitCode);var D=u.attributes.getNamedItem("data");if(D){for(var j=D.value||"",A=j.split(":"),F=0;F<A.length;F++){var U=A[F],R=U.split(",");A[F]={price:n(R[0],t.unitCode),volume:parseInt(R[1])}}A.sort(function(e,t){return e.price-t.price}),t.priceLevels=A}else t.priceLevels=[];break;default:console.log(e)}}break;case"":switch(e.substr(1,1)){case"#":t.type="TIMESTAMP",t.timestamp=new Date(parseInt(e.substr(2,4)),parseInt(e.substr(6,2))-1,parseInt(e.substr(8,2)),parseInt(e.substr(10,2)),parseInt(e.substr(12,2)),parseInt(e.substr(14,2)));break;case"2":t.record="2";var z=e.indexOf(",",0);switch(t.symbol=e.substring(2,z),t.subrecord=e.substr(z+1,1),t.unitcode=e.substr(z+3,1),t.exchange=e.substr(z+4,1),t.delay=parseInt(e.substr(z+5,2)),t.subrecord){case"0":var L=e.indexOf(",",z+7);switch(t.value=n(e.substring(z+7,L),t.unitcode),t.element=e.substr(L+1,1),t.modifier=e.substr(L+2,1),t.element){case"A":t.type="OPEN";break;case"C":"1"==t.modifier&&(t.type="OPEN_INTEREST");break;case"D":case"d":"0"==t.modifier&&(t.type="SETTLEMENT");break;case"V":"0"==t.modifier&&(t.type="VWAP");break;case"0":"0"==t.modifier&&(t.tradePrice=t.value,t.type="TRADE");break;case"5":t.type="HIGH";break;case"6":t.type="LOW";break;case"7":"1"==t.modifier?t.type="VOLUME_YESTERDAY":"6"==t.modifier&&(t.type="VOLUME")}t.day=e.substr(L+3,1),t.session=e.substr(L+4,1),t.time=i(e.substr(e.indexOf("")+1,9));break;case"1":case"2":case"3":case"4":var V=e.substring(z+8).split(",");t.openPrice=n(V[0],t.unitcode),t.highPrice=n(V[1],t.unitcode),t.lowPrice=n(V[2],t.unitcode),t.lastPrice=n(V[3],t.unitcode),t.bidPrice=n(V[4],t.unitcode),t.askPrice=n(V[5],t.unitcode),t.previousPrice=n(V[7],t.unitcode),t.settlementPrice=n(V[10],t.unitcode),t.volume=V[13].length>0?parseInt(V[13]):void 0,t.openInterest=V[12].length>0?parseInt(V[12]):void 0,t.day=V[14].substr(0,1),t.session=V[14].substr(1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="REFRESH_DDF";break;case"7":var B=e.indexOf(",",z+7);t.tradePrice=n(e.substring(z+7,B),t.unitcode),z=B+1,B=e.indexOf(",",z),t.tradeSize=parseInt(e.substring(z,B)),z=B+1,t.day=e.substr(z,1),t.session=e.substr(z+1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="TRADE";break;case"8":var q=e.indexOf(",",z+7);t.bidPrice=n(e.substring(z+7,q),t.unitcode),z=q+1,q=e.indexOf(",",z),t.bidSize=parseInt(e.substring(z,q)),z=q+1,q=e.indexOf(",",z),t.askPrice=n(e.substring(z,q),t.unitcode),z=q+1,q=e.indexOf(",",z),t.askSize=parseInt(e.substring(z,q)),z=q+1,t.day=e.substr(z,1),t.session=e.substr(z+1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="TOB";break;case"Z":var H=e.indexOf(",",z+7);t.tradePrice=n(e.substring(z+7,H),t.unitcode),z=H+1,H=e.indexOf(",",z),t.tradeSize=parseInt(e.substring(z,H)),z=H+1,t.day=e.substr(z,1),t.session=e.substr(z+1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="TRADE_OUT_OF_SEQUENCE"}break;case"3":var G=e.indexOf(",",0);switch(t.symbol=e.substring(2,G),t.subrecord=e.substr(G+1,1),t.subrecord){case"B":t.unitcode=e.substr(G+3,1),t.exchange=e.substr(G+4,1),t.bidDepth="A"==e.substr(G+5,1)?10:parseInt(e.substr(G+5,1)),t.askDepth="A"==e.substr(G+6,1)?10:parseInt(e.substr(G+6,1)),t.bids=[],t.asks=[];for(var X=e.substring(G+8).split(","),$=0;$<X.length;$++){var Q=X[$].split(/[A-Z]/),Z=X[$].substr(Q[0].length,1);Z<="J"?t.asks.push({price:n(Q[0],t.unitcode),size:parseInt(Q[1])}):t.bids.push({price:n(Q[0],t.unitcode),size:parseInt(Q[1])})}t.type="BOOK"}break;default:t.type="UNKNOWN"}}return t}}()},{"./common/xml/XmlDomParser":28,"./priceParser":35,"./timestampParser":39}],33:[function(e,t,r){"use strict";t.exports=function(){var e={},t={},r=function(r,n,i){e[r]=n,t[r]=i};return r("F","January",1),r("G","February",2),r("H","March",3),r("J","April",4),r("K","May",5),r("M","June",6),r("N","July",7),r("Q","August",8),r("U","September",9),r("V","October",10),r("X","November",11),r("Z","December",12),r("Y","Cash",0),{getCodeToNameMap:function(){return e},getCodeToNumberMap:function(){return t}}}()},{}],34:[function(e,t,r){"use strict";var n=e("lodash.isnan"),i=e("./decimalFormatter");t.exports=function(){function e(e,t){return["000",Math.floor(e)].join("").substr(-1*t)}return function(t,r,a,s){function o(e){var r=Math.floor(e);return 0===r&&""===t?"":r}function u(e,t){return i(e,t,a,s)}var c=void 0;return c="."===t?function(e,t){switch(t){case"2":return u(e,3);case"3":return u(e,4);case"4":return u(e,5);case"5":return u(e,6);case"6":return u(e,7);case"7":return u(e,8);case"8":return u(e,0);case"9":return u(e,1);case"A":return u(e,2);case"B":return u(e,3);case"C":return u(e,4);case"D":return u(e,5);case"E":return u(e,6);default:return""===e||void 0===e||null===e||n(e)?"":e}}:function(i,a){if(""===i||void 0===i||null===i||n(i))return"";var c=i,l=Math.abs(i),f=i<0,m=void 0,d=void 0;switch(f?s===!0?(m="(",d=")"):(m="-",d=""):(m="",d=""),a){case"2":return[m,o(l),t,e(8*(l-Math.floor(l)),1),d].join("");case"3":return[m,o(l),t,e(16*(l-Math.floor(l)),2),d].join("");case"4":return[m,o(l),t,e(32*(l-Math.floor(l)),2),d].join("");case"5":return[m,o(l),t,e((l-Math.floor(l))*(r?320:64),r?3:2),d].join("");case"6":return[m,o(l),t,e((l-Math.floor(l))*(r?320:128),3),d].join("");case"7":return[m,o(l),t,e((l-Math.floor(l))*(r?320:256),3),d].join("");case"8":return u(c,0);case"9":return u(c,1);case"A":return u(c,2);case"B":return u(c,3);case"C":return u(c,4);case"D":return u(c,5);case"E":return u(c,6);default:return c}},{format:c}}}()},{"./decimalFormatter":30,"lodash.isnan":43}],35:[function(e,t,r){"use strict";t.exports=function(){function e(e){return t.hasOwnProperty(e)||(t[e]=new RegExp(e,"g")),t[e]}var t={};return function(t,r,n){if(!(t.length<1)){if("-"===t)return null;if(n&&(t=t.replace(e(n),"")),!(t.indexOf(".")<0))return parseFloat(t);var i="-"==t.substr(0,1)?-1:1;switch(i===-1&&(t=t.substr(1)),r){case"2":return i*((t.length>1?parseInt(t.substr(0,t.length-1)):0)+parseInt(t.substr(-1))/8);case"3":return i*((t.length>2?parseInt(t.substr(0,t.length-2)):0)+parseInt(t.substr(-2))/16);case"4":return i*((t.length>2?parseInt(t.substr(0,t.length-2)):0)+parseInt(t.substr(-2))/32);case"5":return i*((t.length>2?parseInt(t.substr(0,t.length-2)):0)+parseInt(t.substr(-2))/64);case"6":return i*((t.length>3?parseInt(t.substr(0,t.length-3)):0)+parseInt(t.substr(-3))/128);case"7":return i*((t.length>3?parseInt(t.substr(0,t.length-3)):0)+parseInt(t.substr(-3))/256);case"8":return i*parseInt(t);case"9":return i*(parseInt(t)/10);case"A":return i*(parseInt(t)/100);case"B":return i*(parseInt(t)/1e3);case"C":return i*(parseInt(t)/1e4);case"D":return i*(parseInt(t)/1e5);case"E":return i*(parseInt(t)/1e6);default:return i*parseInt(t)}}}}()},{}],36:[function(e,t,r){"use strict";t.exports=function(){return{format:function(e){return null!==e&&"string"==typeof e?e.toUpperCase():e}}}()},{}],37:[function(e,t,r){"use strict";t.exports=function(){function e(e,t){var r=h.parseInstrumentType(e);return null!==r&&r.type===t}function t(e){var t=new Date,r=t.getFullYear(),n=parseInt(e);if(n<10)n=10*Math.floor(r/10)+n;else if(n<100&&(n=100*Math.floor(r/100)+n,n<r)){var i=n+100;r-n>i-r&&(n=i)}return n}var r=/^(.*)\\.([A-Z]{1,4})$/i,n=/(.{1,3})([A-Z]{1})([0-9]{3}|[0-9]{1})?([0-9]{1})$/i,i=/^(.{1,3})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,a=/^(.{1,3})(\*{1})([0-9]{1})$/i,s=/^_S_/i,o=/^(.{1,2})([A-Z])([0-9]{1,4})([A-Z])$/i,u=/^(.{1,3})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,c=/^\^([A-Z]{3})([A-Z]{3})$/i,l=/^\-(.*)$/i,f=/^\$(.*)$/i,m=/^(.*)\.BZ$/i,d=/(\.RT)$/,p={A:"F",B:"G",C:"H",D:"J",E:"K",I:"M",L:"N",O:"Q",P:"U",R:"V",S:"X",T:"Z"},h={parseInstrumentType:function(e){if("string"!=typeof e)return null;var n=e.match(r);if(null!==n&&(e=n[1]),s.test(e))return{symbol:e,type:"future_spread"};var m=e.match(i);if(null!==m)return{symbol:e,type:"future",root:m[1],dynamic:!1,month:m[2],year:t(m[3])};var d=e.match(a);if(null!==d)return{symbol:e,type:"future",root:d[1],dynamic:!0,dynamicCode:d[3]};var h=e.match(o);if(null!==h){var v=new Date,b=v.getFullYear(),y=void 0,g=void 0;return h[4]>="P"?(g=b+(h[4].charCodeAt(0)-"P".charCodeAt(0)),y="put"):(g=b+(h[4].charCodeAt(0)-"C".charCodeAt(0)),y="call"),{symbol:e,type:"future_option",root:h[1],month:h[2],year:g,strike:parseInt(h[3]),option_type:y}}var P=e.match(u);if(null!==P){var k=P[2];return{symbol:e,type:"future_option",root:P[1],month:p.hasOwnProperty(k)?p[k]:k,year:t(P[3]),strike:parseInt(P[4]),option_type:"C"===P[5]?"call":"put"}}var w=e.match(c);if(null!==w)return{symbol:e,type:"forex"};var I=e.match(f);if(null!==I)return{symbol:e,type:"index"};var _=e.match(l);return null!==_?{symbol:e,type:"sector"}:null},getIsConcrete:function(e){return!h.getIsReference(e)},getIsReference:function(e){return a.test(e)},getIsFuture:function(t){return e(t,"future")},getIsFutureSpread:function(t){return e(t,"future_spread")},getIsFutureOption:function(t){return e(t,"future_option")},getIsForex:function(t){return e(t,"forex")},getIsSector:function(t){return e(t,"sector")},getIsIndex:function(t){return e(t,"index")},getIsBats:function(e){return m.test(e)},getProducerSymbol:function(e){return"string"==typeof e?e.replace(n,"$1$2$4"):null},displayUsingPercent:function(e){return d.test(e)}};return h}()},{}],38:[function(e,t,r){"use strict";t.exports=function(){function e(e){var t=e.getHours(),r=void 0;return 0===t?(t=12,r="AM"):12===t?(t=t,r="PM"):t>12?(t-=12,r="PM"):(t=t,r="AM"),i(t)+":"+i(e.getMinutes())+":"+i(e.getSeconds())+" "+r}function t(e){var t=e.getHours(),r=void 0;return 0===t?(t=12,r="A"):12===t?(t=t,r="P"):t>12?(t-=12,r="P"):(t=t,r="A"),i(t)+":"+i(e.getMinutes())+r}function r(e){return i(e.getHours())+":"+i(e.getMinutes())+":"+i(e.getSeconds())}function n(e){return i(e.getHours())+":"+i(e.getMinutes())}function i(e){return("00"+e).substr(-2)}return function(a,s){var o=void 0;o=a?s?t:e:s?n:r;var u={format:function(e){var t=e.time;return t?!e.lastPrice||e.flag||e.sessionT?u.formatDate(t):u.formatTime(t,e.timezone):""},formatTime:function(e,t){var r=void 0;return e?(r=o(e),t&&(r=r+" "+t)):r="",r},formatDate:function(e){return e?i(e.getMonth()+1)+"/"+i(e.getDate())+"/"+i(e.getFullYear()):""}};return u}}()},{}],39:[function(e,t,r){"use strict";t.exports=function(){return function(e){if(9!==e.length)return null;var t=100*e.charCodeAt(0)+e.charCodeAt(1)-64,r=e.charCodeAt(2)-64-1,n=e.charCodeAt(3)-64,i=e.charCodeAt(4)-64,a=e.charCodeAt(5)-64,s=e.charCodeAt(6)-64,o=(255&e.charCodeAt(7))+((255&e.charCodeAt(8))<<8);return new Date(t,r,n,i,a,s,o)}}()},{}],40:[function(e,t,r){function n(e,t,r){if(!o(t))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this),"[object Array]"===u.call(e)?i(e,t,r):"string"==typeof e?a(e,t,r):s(e,t,r)}function i(e,t,r){for(var n=0,i=e.length;n<i;n++)c.call(e,n)&&t.call(r,e[n],n,e)}function a(e,t,r){for(var n=0,i=e.length;n<i;n++)t.call(r,e.charAt(n),n,e)}function s(e,t,r){for(var n in e)c.call(e,n)&&t.call(r,e[n],n,e)}var o=e("is-function");t.exports=n;var u=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":42}],41:[function(e,t,r){(function(e){var r;r="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],42:[function(e,t,r){function n(e){var t=i.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}t.exports=n;var i=Object.prototype.toString},{}],43:[function(e,t,r){function n(e){return!!e&&"object"==typeof e}function i(e){return a(e)&&e!=+e}function a(e){return"number"==typeof e||n(e)&&u.call(e)==s}var s="[object Number]",o=Object.prototype,u=o.toString;t.exports=i},{}],44:[function(e,t,r){var n=e("trim"),i=e("for-each"),a=function(e){return"[object Array]"===Object.prototype.toString.call(e)};t.exports=function(e){if(!e)return{};var t={};return i(n(e).split("\n"),function(e){var r=e.indexOf(":"),i=n(e.slice(0,r)).toLowerCase(),s=n(e.slice(r+1));"undefined"==typeof t[i]?t[i]=s:a(t[i])?t[i].push(s):t[i]=[t[i],s]}),t}},{"for-each":40,trim:45}],45:[function(e,t,r){function n(e){return e.replace(/^\s*|\s*$/g,"")}r=t.exports=n,r.left=function(e){return e.replace(/^\s*/,"")},r.right=function(e){return e.replace(/\s*$/,"")}},{}],46:[function(e,t,r){"use strict";function n(e,t){for(var r=0;r<e.length;r++)t(e[r])}function i(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function a(e,t,r){var n=e;return f(t)?(r=t,"string"==typeof e&&(n={uri:e})):n=d(t,{uri:e}),n.callback=r,n}function s(e,t,r){return t=a(e,t,r),o(t)}function o(e){function t(){4===l.readyState&&a()}function r(){var e=void 0;if(e=l.response?l.response:l.responseText||u(l),P)try{e=JSON.parse(e)}catch(t){}return e}function n(e){return clearTimeout(p),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,c(e,k)}function a(){if(!d){var t;clearTimeout(p),t=e.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var n=k,i=null;return 0!==t?(n={body:r(),statusCode:t,method:v,headers:{},url:h,rawRequest:l},l.getAllResponseHeaders&&(n.headers=m(l.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),c(i,n,n.body)}}if("undefined"==typeof e.callback)throw new Error("callback argument missing");var o=!1,c=function(t,r,n){o||(o=!0,e.callback(t,r,n))},l=e.xhr||null;l||(l=e.cors||e.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,d,p,h=l.url=e.uri||e.url,v=l.method=e.method||"GET",b=e.body||e.data||null,y=l.headers=e.headers||{},g=!!e.sync,P=!1,k={body:void 0,headers:{},statusCode:0,method:v,url:h,rawRequest:l};if("json"in e&&e.json!==!1&&(P=!0,y.accept||y.Accept||(y.Accept="application/json"),"GET"!==v&&"HEAD"!==v&&(y["content-type"]||y["Content-Type"]||(y["Content-Type"]="application/json"),b=JSON.stringify(e.json===!0?b:e.json))),l.onreadystatechange=t,l.onload=a,l.onerror=n,l.onprogress=function(){},l.onabort=function(){d=!0},l.ontimeout=n,l.open(v,h,!g,e.username,e.password),g||(l.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(p=setTimeout(function(){if(!d){d=!0,l.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}},e.timeout)),l.setRequestHeader)for(f in y)y.hasOwnProperty(f)&&l.setRequestHeader(f,y[f]);else if(e.headers&&!i(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(l.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(l),l.send(b),l}function u(e){if("document"===e.responseType)return e.responseXML;var t=204===e.status&&e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;return""!==e.responseType||t?null:e.responseXML}function c(){}var l=e("global/window"),f=e("is-function"),m=e("parse-headers"),d=e("xtend");t.exports=s,s.XMLHttpRequest=l.XMLHttpRequest||c,s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:l.XDomainRequest,n(["get","put","post","patch","head","delete"],function(e){s["delete"===e?"del":e]=function(t,r,n){return r=a(t,r,n),r.method=e.toUpperCase(),o(r)}})},{"global/window":41,"is-function":42,"parse-headers":44,xtend:47}],47:[function(e,t,r){function n(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)i.call(r,n)&&(e[n]=r[n])}return e}t.exports=n;var i=Object.prototype.hasOwnProperty},{}]},{},[6])(6)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,(t.Barchart||(t.Barchart={})).RealtimeData=e()}}(function(){return function e(t,r,n){function i(s,o){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return i(r?r:e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,r){"use strict";t.exports=function(){var e={keys:function t(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(r);return t}};return e}()},{}],2:[function(e,t,r){"use strict";var n=e("./websocket/Connection");t.exports=function(){return n}()},{"./websocket/Connection":5}],3:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("./../marketState/MarketState");t.exports=function(){var e=function(){function e(){var t=this;n(this,e),this._server=null,this._username=null,this._password=null,this._marketState=new a(function(e){return t._handleProfileRequest(e)}),this._pollingFrequency=null}return i(e,[{key:"connect",value:function(e,t,r){this._server=e,this._username=t,this._password=r,this._connect()}},{key:"_connect",value:function(){}},{key:"disconnect",value:function(){this._server=null,this._username=null,this._password=null,this._disconnect()}},{key:"_disconnect",value:function(){}},{key:"on",value:function(){this._on.apply(this,arguments)}},{key:"_on",value:function(){}},{key:"off",value:function(){this._off.apply(this,arguments)}},{key:"_off",value:function(){}},{key:"getActiveSymbolCount",value:function(){return this._getActiveSymbolCount()}},{key:"_getActiveSymbolCount",value:function(){return null}},{key:"getPollingFrequency",value:function(){return this._pollingFrequency}},{key:"setPollingFrequency",value:function(e){this._pollingFrequency!==e&&(e&&e>0?this._pollingFrequency=e:this._pollingFrequency=null,this._onPollingFrequencyChanged(this._pollingFrequency))}},{key:"_onPollingFrequencyChanged",value:function(e){}},{key:"_handleProfileRequest",value:function(e){}},{key:"getMarketState",value:function(){return this._marketState}},{key:"getServer",value:function(){return this._server}},{key:"getPassword",value:function(){return this._password}},{key:"getUsername",value:function(){return this._username}},{key:"toString",value:function(){return"[ConnectionBase]"}}]),e}();return e}()},{"./../marketState/MarketState":8}],4:[function(e,t,r){"use strict";var n=e("./Connection");t.exports=function(){return n}()},{"./Connection":2}],5:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e("@barchart/marketdata-utilities-js"),u=e("./../../../common/lang/object"),c=e("./../../ConnectionBase"),l=e("./../../../messageParser/parseMessage");t.exports=function(){function e(e){function n(e,t){var r=V.length-1;r>0&&V[r].id===e?V[r].symbols.push(t):V.push({id:e,symbols:[t]})}function i(e,t){var r=void 0;switch(e){case"events":r=G.events;break;case"marketDepth":r=G.marketDepth[t.symbol];break;case"marketUpdate":r=G.marketUpdate[t.symbol];break;case"timestamp":r=G.timestamp}r&&r.forEach(function(e){return e(t)})}function a(){u.keys(R).forEach(function(e){n("MU_GO",e)}),u.keys(z).forEach(function(e){n("MU_GO",e)}),u.keys(U).forEach(function(e){n("MD_GO",e)})}function s(){u.keys(R).forEach(function(e){n("MU_STOP",e)}),u.keys(z).forEach(function(e){n("MU_STOP",e)}),u.keys(U).forEach(function(e){n("MU_STOP",e)})}function c(e,t,n){A||D||(X.username=t,X.password=n,X.server=e,window.WebSocket?(M=r.disconnected,A=new WebSocket("wss://"+X.server+"/jerq"),A.binaryType="arraybuffer",A.onclose=function(e){console.warn(new Date+" connection closed."),A=null,M===r.authenticated&&(M=r.disconnected,i("events",{event:"disconnect"}),setTimeout(function(){A=null,c(X.server,X.username,X.password),a()},m))},A.onmessage=function(e){if(e.data instanceof ArrayBuffer){var t=$.decode(e.data);t&&H.push(t)}else H.push(e.data)},A.onopen=function(e){console.log(new Date+" connection open.")}):console.warn("Websockets are not supported by this browser."))}function d(){M=r.disconnected,null!==A&&(A.send("LOGOUT\r\n"),A.close()),V=[],B=[],q=[],U={},R={},z={}}function p(e){if(M===r.disconnected&&(M=r.connecting),M===r.connecting){var n=e.split("\n");n.forEach(function(e){"+++"==e&&(M=r.authenticating,B.push("LOGIN "+X.username+":"+X.password+" VERSION="+t+"\r\n"))})}else if(M===r.authenticating){var a=e.charAt(0);"+"===a?(M=r.authenticated,i("events",{event:"login success"})):"-"===a&&(d(),i("events",{event:"login fail"}))}M===r.authenticated&&q.push(e)}function h(){if(arguments.length<2)throw new Error("Wrong number of arguments. Must pass in an eventId and handler.");var e=arguments[0],t=arguments[1],r=void 0;r=arguments.length>2?arguments[2]:null;var i=function(e){var r=e||[];return r.filter(function(e){return e!==t})},a=function(e,t){return t.reduce(function(t,r){return t||r.hasOwnProperty(e)},!1)},s=function(e,t,s,u,c){var l=r,f=o.symbolParser.getProducerSymbol(l),m=s[l]||[],d=i(m);if(s[l]=d,m.length>0&&0===d.length){delete s[l];var p=!0,h=!0,v=F[f]||[];a(l,c)||(p=!0),p&&(v=v.filter(function(e){var t=e!==l;return!t&&a(e,[s])&&(h=!1),t}),F[f]=v),h&&(delete e[f],u.forEach(function(e){e.hasOwnProperty(f)&&(h=!1)}),h&&n(t,f))}};switch(e){case"events":G.events=i(G.events);break;case"marketDepth":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('marketDepth', handler, symbol)");s(U,"MD_STOP",G.marketDepth,[],[]);break;case"marketUpdate":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('marketUpdate', handler, symbol)");s(R,"MU_STOP",G.marketUpdate,[z],[G.cumulativeVolume]);break;case"cumulativeVolume":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('cumulativeVolume', handler, symbol)");s(z,"MU_STOP",G.cumulativeVolume,[R],[G.marketUpdate]),N.getCumulativeVolume(r,function(e){e.off("events",t)});break;case"timestamp":G.timestamp=i(G.timestamp)}}function v(){if(arguments.length<2)throw new Error("Bad number of arguments. Must pass in an eventId and handler.");var e=arguments[0],t=arguments[1],r=void 0;r=arguments.length>2?arguments[2]:null;var i=function(e){e=e||[];var r=!e.some(function(e){return e===t}),n=void 0;return r?(n=e.slice(0),n.push(t)):n=e,n},a=function(e,t,a,s){var u=r,c=o.symbolParser.getProducerSymbol(u);a[u]=i(a[u]);var l=F[c]||[],f=!l.some(function(e){return e===u});if(f&&(l=l.slice(0),l.push(u),F[c]=l),!e[c]){e[c]=!0;var m=!s.some(function(e){return e[c]});m&&n(t,c)}};switch(e){case"events":G.events=i(G.events);break;case"marketDepth":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: on('marketDepth', handler, symbol)");a(U,"MD_GO",G.marketDepth,[]),N.getBook(r)&&t({type:"INIT",symbol:r});break;case"marketUpdate":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: on('marketUpdate', handler, symbol)");a(R,"MU_GO",G.marketUpdate,[z]),N.getQuote(r)&&t({type:"INIT",symbol:r});break;case"cumulativeVolume":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: on('cumulativeVolume', handler, symbol)");a(z,"MU_GO",G.cumulativeVolume,[R]),N.getCumulativeVolume(r,function(e){e.on("events",t)});break;case"timestamp":G.timestamp=i(G.timestamp)}}function b(e){switch(N.processMessage(e),e.type){case"BOOK":i("marketDepth",e);break;case"TIMESTAMP":i("timestamp",N.getTimestamp());break;default:i("marketUpdate",e)}}function y(e){var t=void 0;try{if(t=l(e),t.type)if(t.symbol){var r=F[t.symbol]||[];L.hasOwnProperty(t.symbol)&&(r=r.concat(L[t.symbol]).filter(function(e,t,r){return r.indexOf(e)===t}),delete L[t.symbol]),r.forEach(function(e){var r=void 0;e===t.symbol?r=t:(r=Object.assign({},t),r.symbol=e),b(r)})}else b(t);else console.log(e)}catch(n){console.error(n),console.log(t)}}function g(){if(M===r.authenticating||M===r.authenticated)for(var e=B.shift();e;)console.log(e),A.send(e),e=B.shift();setTimeout(g,200)}function P(){for(var e=9,t=!1;!t;){var r=q.shift();if(r){var n=!1,i=1,a=-1,s=r.indexOf(f.etx),o=r.indexOf(f.lf);if(o>-1&&(s<0||o<s)?(a=o,i=2):s>-1&&(a=s),a>-1){var u=a+1;if(1==i&&(r.length<a+e+1?(q.length>0?q[0]=r+q[0]:(q.unshift(r),t=!0),n=!0):r.substr(a+1,1)==f.dc4&&(u+=e+1)),!n){var c=r.substring(0,u);2==i?c=c.trim():(a=c.indexOf(f.soh),a>0&&(c=c.substring(a))),c.length>0&&y(c),r=r.substring(u),r.length>0&&(q.length>0?q[0]=r+q[0]:q.unshift(r))}}else r.length>0&&(q.length>0?q[0]=r+q[0]:(q.unshift(r),t=!0))}else t=!0;0===q.length&&(t=!0)}setTimeout(P,125)}function k(){for(var e=H.shift();e;)p(e),e=H.shift();setTimeout(k,125)}function w(e){if(M===r.authenticated)for(;V.length>0;){var t=V.shift();if(t.callback)t.callback();else if(t.id){var n="",i="";switch(t.id){case"MD_GO":n="GO",i="Bb";break;case"MU_GO":n="GO",i="Ssc";break;case"MD_STOP":n="STOP",i="Bb";break;case"MU_STOP":n="STOP",i="Ssc";break;case"P_SNAPSHOT":n="GO",i="s"}var a=t.symbols.filter(function(e,t,r){return r.indexOf(e)===t}),s=void 0;for(s="MD_GO"===t.id||"MD_STOP"===t.id?1:250;a.length>0;){var o=a.splice(0,s);B.push(n+" "+o.join(",")+"="+i)}}}e||S(!1)}function I(){if(M===r.authenticated&&0===B.length){V=[];var e=function(e){for(var t=[];0!==e.length;)t.push(e.splice(0,250));return t},t=e(T([R,z]));t.forEach(function(e){B.push("GO "+e.join(",")+"=sc")});e(u.keys(U));t.forEach(function(e){B.push("GO "+e.join(",")+"=b")});var n=e(u.keys(L)).filter(function(e){return!t.some(function(t){return t===e})});n.forEach(function(e){B.push("GO "+e.join(",")+"=s")})}S(!0)}function _(e){j!==e&&(j=e)}function T(e){return u.keys(e.reduce(function(e,t){for(var r in t)t[r]===!0&&(e[r]=!0);return e},{}))}function O(){return T([R,U,z]).length}function S(e){var t=void 0,r=void 0;j?(e||(s(),w(!0)),t=I,r=j):(e&&a(),t=w,r=250),setTimeout(t,r)}function C(e,t,r){D=!1,c(e,t,r)}function E(){D=!0,X.username=null,X.password=null,X.server=null,d()}function x(e){var t=o.symbolParser.getProducerSymbol(e);L[t]=[e,t],n("P_SNAPSHOT",t)}var N=e,M=r.disconnected,D=!1,j=null,A=null,F={},U={},R={},z={},L={},V=[],B=[],q=[],H=[],G={events:[],marketDepth:{},marketUpdate:{},cumulativeVolume:{},timestamp:[]},X={username:null,password:null,server:null},$=void 0;return $=window.TextDecoder?new TextDecoder:{decode:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},setTimeout(g,200),setTimeout(k,125),setTimeout(P,125),setTimeout(S,250),{connect:C,disconnect:E,off:h,on:v,getActiveSymbolCount:O,setPollingFrequency:_,handleProfileRequest:x}}var t=4,r={connecting:"CONNECTING",authenticating:"LOGGING_IN",authenticated:"LOGGED_IN",disconnected:"DISCONNECTED"},f={soh:"",etx:"",lf:"\n",dc4:""},m=5e3,d=function(t){function r(){n(this,r);var t=i(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return t._internal=e(t.getMarketState()),t}return a(r,t),s(r,[{key:"_connect",value:function(){this._internal.connect(this.getServer(),this.getUsername(),this.getPassword())}},{key:"_disconnect",value:function(){this._internal.disconnect()}},{key:"_on",value:function(){this._internal.on.apply(this._internal,arguments)}},{key:"_off",value:function(){this._internal.off.apply(this._internal,arguments)}},{key:"_getActiveSymbolCount",value:function(){return this._internal.getActiveSymbolCount()}},{key:"_onPollingFrequencyChanged",value:function(e){return this._internal.setPollingFrequency(e)}},{key:"_handleProfileRequest",value:function(e){this._internal.handleProfileRequest(e)}},{key:"toString",value:function(){return"[Connection]"}}]),r}(c);return d}()},{"./../../../common/lang/object":1,"./../../../messageParser/parseMessage":13,"./../../ConnectionBase":3,"@barchart/marketdata-utilities-js":31}],6:[function(e,t,r){"use strict";var n=e("./connection/index"),i=e("./marketState/index"),a=e("./messageParser/index"),s=e("./util/index");t.exports=function(){return{Connection:n,MarketState:i,MessageParser:a,messageParser:a,Util:s,util:s,version:"3.1.2"}}()},{"./connection/index":4,"./marketState/index":11,"./messageParser/index":12,"./util/index":22}],7:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("./../common/lang/object");t.exports=function(){var e={update:"update",reset:"reset"},t=function(){function t(e,r){n(this,t),this.symbol=e,this._tickIncrement=r,this._handlers=[],this._priceLevels={},this._highPrice=null,this._lowPrice=null}return i(t,[{key:"on",value:function(e,t){var n=this;if("events"===e){var i=this._handlers.indexOf(t);if(i<0){var a=this._handlers.slice(0);a.push(t),this._handlers=a,this.toArray().forEach(function(e){r(n,t,e)})}}}},{key:"off",value:function(e,t){if("events"===e){var r=this._handlers.indexOf(t);if(!(r<0)){var n=this._handlers.slice(0);n.splice(r,1),this._handlers=n}}}},{key:"getTickIncrement",value:function(){return this._tickIncrement}},{key:"getVolume",value:function(e){var t=e.toString(),r=this._priceLevels[t];return r?r.volume:0}},{key:"incrementVolume",value:function(e,t){if(this._highPrice&&this._lowPrice){if(e>this._highPrice){for(var r=this._highPrice+this._tickIncrement;r<e;r+=this._tickIncrement)s(this,this._handlers,o(this._priceLevels,r.toString(),r));this._highPrice=e}else if(e<this._lowPrice){for(var n=this._lowPrice-this._tickIncrement;n>e;n-=this._tickIncrement)s(this,this._handlers,o(this._priceLevels,n.toString(),n));this._lowPrice=e}}else this._lowPrice=this._highPrice=e;var i=e.toString(),a=this._priceLevels[i];a||(a=o(this._priceLevels,i,e)),a.volume+=t,s(this,this._handlers,a)}},{key:"reset",value:function(){var t=this;this._priceLevels={},this._highPrice=null,this._lowPrice=null,this._handlers.forEach(function(r){r({container:t,event:e.reset})})}},{key:"toArray",value:function(){var e=this,t=a.keys(this._priceLevels).map(function(t){var r=e._priceLevels[t];return{price:r.price,volume:r.volume}});return t.sort(function(e,t){return e.price-t.price}),t}},{key:"dispose",value:function(){this._priceLevels={},this._highPrice=null,this._lowPrice=null,this._handlers=[]}}],[{key:"clone",value:function u(e,r){var u=new t(e,r.getTickIncrement());return r.toArray().forEach(function(e){u.incrementVolume(e.price,e.volume)}),u}}]),t}(),r=function(t,r,n){try{r({container:t,event:e.update,price:n.price,volume:n.volume})}catch(i){console.error("An error was thrown by a cumulative volume observer.",i)}},s=function(e,t,n){t.forEach(function(t){r(e,t,n)})},o=function(e,t,r){var n={price:r,volume:0};return e[t]=n,n};return t}()},{"./../common/lang/object":1}],8:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("@barchart/marketdata-utilities-js"),s=e("./CumulativeVolume"),o=e("./Profile"),u=e("./Quote"),c=e("./../util/convertDayCodeToNumber");t.exports=function(){function e(e){var t={},r={},n={},i={},l=void 0,f=function(e){var r=t[e];if(!r){r={symbol:e,bids:[],asks:[]};var n=a.symbolParser.getProducerSymbol(e),i=t[n];i&&(r.bids=i.bids.slice(0),r.asks=i.asks.slice(0)),t[e]=r}return r},m=function(e){var t=n[e];if(!t){t={container:null,callbacks:[]};var r=a.symbolParser.getProducerSymbol(e),i=n[r];i&&i.container&&(t.container=s.clone(e,i.container)),n[e]=t}return t},d=function(e){var t=r[e];if(!t){var n=a.symbolParser.getProducerSymbol(e),i=r[n];t=i?u.clone(e,i):new u(e),r[e]=t}return t},p=function(e){var t=o.Profiles[e];if(!t){var r=a.symbolParser.getProducerSymbol(e),n=o.Profiles[r];n&&(t=new o(e,n.name,n.exchange,n.unitcode,n.pointValue,n.tickIncrement))}return t},h=function(e){var t=e.symbol;if("TIMESTAMP"===e.type)return void(l=e.timestamp);if("BOOK"===e.type){var r=f(t);return r.asks=e.asks,void(r.bids=e.bids)}if("REFRESH_CUMULATIVE_VOLUME"==e.type){var a=m(t),u=a.container;if(u)u.reset();else{a.container=u=new s(t,e.tickIncrement);var h=a.callbacks||[];h.forEach(function(e){e(u)}),a.callbacks=null}return void e.priceLevels.forEach(function(e){u.incrementVolume(e.price,e.volume)})}var v=p(t);if(!v&&"REFRESH_QUOTE"!==e.type)return console.warn("No profile found for "+t),void console.log(e);var b=d(t);if(!b.day&&e.day&&(b.day=e.day,b.dayNum=c(b.day)),b.day&&e.day){var y=c(e.day);if(y>b.dayNum||b.dayNum-y>5)b.day=e.day,b.dayNum=y,b.flag="p",b.bidPrice=0,b.bidSize=void 0,b.askPrice=void 0,b.askSize=void 0,b.settlementPrice?(b.previousPrice=b.settlementPrice,b.settlementPrice=void 0):b.lastPrice&&(b.previousPrice=b.lastPrice),b.lastPrice=void 0,b.tradePrice=void 0,b.tradeSize=void 0,b.numberOfTrades=void 0,b.openPrice=void 0,b.highPrice=void 0,b.lowPrice=void 0,b.volume=void 0;else if(b.dayNum>y)return;var g=n[t];switch(e.type){case"HIGH":b.highPrice=e.value;break;case"LOW":b.lowPrice=e.value;break;case"OPEN":b.flag=void 0,b.openPrice=e.value,b.highPrice=e.value,b.lowPrice=e.value,b.lastPrice=e.value,g&&g.container&&g.container.reset();break;case"OPEN_INTEREST":b.openInterest=e.value;break;case"REFRESH_DDF":switch(e.subrecord){case"1":case"2":case"3":b.message=e,null===e.openPrice?b.openPrice=void 0:e.openPrice&&(b.openPrice=e.openPrice),null===e.highPrice?b.highPrice=void 0:e.highPrice&&(b.highPrice=e.highPrice),null===e.lowPrice?b.lowPrice=void 0:e.lowPrice&&(b.lowPrice=e.lowPrice),null===e.lastPrice?b.lastPrice=void 0:e.lastPrice&&(b.lastPrice=e.lastPrice),null===e.bidPrice?b.bidPrice=void 0:e.bidPrice&&(b.bidPrice=e.bidPrice),null===e.askPrice?b.askPrice=void 0:e.askPrice&&(b.askPrice=e.askPrice),null===e.previousPrice?b.previousPrice=void 0:e.previousPrice&&(b.previousPrice=e.previousPrice),null===e.settlementPrice?(b.settlementPrice=void 0,"s"==b.flag&&(b.flag=void 0)):e.settlementPrice&&(b.settlementPrice=e.settlementPrice),null===e.volume?b.volume=void 0:e.volume&&(b.volume=e.volume),null===e.openInterest?b.openInterest=void 0:e.openInterest&&(b.openInterest=e.openInterest),"1"==e.subsrecord&&(b.lastUpdate=e.time)}break;case"REFRESH_QUOTE":v=new o(t,e.name,e.exchange,e.unitcode,e.pointValue,e.tickIncrement),b.message=e,b.flag=e.flag,b.mode=e.mode,b.lastUpdate=e.lastUpdate,b.bidPrice=e.bidPrice,b.bidSize=e.bidSize,b.askPrice=e.askPrice,b.askSize=e.askSize,b.lastPrice=e.lastPrice,b.tradeSize=e.tradeSize,b.numberOfTrades=e.numberOfTrades,b.previousPrice=e.previousPrice,b.settlementPrice=e.settlementPrice,b.openPrice=e.openPrice,b.highPrice=e.highPrice,b.lowPrice=e.lowPrice,b.volume=e.volume,b.openInterest=e.openInterest,e.tradeTime?b.time=e.tradeTime:e.timeStamp&&(b.time=e.timeStamp),i.hasOwnProperty(t)&&(i[t].forEach(function(e){e(v)}),delete i[t]);break;case"SETTLEMENT":b.lastPrice=e.value,b.settlement=e.value,"D"===e.element&&(b.flag="s");break;case"TOB":b.bidPrice=e.bidPrice,b.bidSize=e.bidSize,b.askPrice=e.askPrice,b.askSize=e.askSize,e.time&&(b.time=e.time);break;case"TRADE":for(b.flag=void 0,b.tradePrice=e.tradePrice,b.lastPrice=e.tradePrice,e.tradeSize&&(b.tradeSize=e.tradeSize,b.volume+=e.tradeSize),b.ticks.push({price:b.tradePrice,size:b.tradeSize});b.ticks.length>50;)b.ticks.shift();b.numberOfTrades||(b.numberOfTrades=0),b.numberOfTrades++,e.time&&(b.time=e.time),g&&g.container&&e.tradePrice&&e.tradeSize&&g.container.incrementVolume(b.tradePrice,b.tradeSize);break;case"TRADE_OUT_OF_SEQUENCE":e.tradeSize&&(b.volume+=e.tradeSize),g&&g.container&&e.tradePrice&&e.tradeSize&&g.container.incrementVolume(b.tradePrice,b.tradeSize);break;case"VOLUME":b.volume=e.value;break;case"VOLUME_YESTERDAY":break;case"VWAP":b.vwap1=e.value;break;default:console.error("Unhandled Market Message:"),console.log(e)}}},v=function(e){return t[e]},b=function(e,t){var r=m(e),n=void 0;return n=r.container?Promise.resolve(r.container):new Promise(function(e){r.callbacks.push(e)}),n.then(function(e){return"function"==typeof t&&t(e),e})},y=function(t,r){var n=p(t),a=void 0;return a=n?Promise.resolve(n):new Promise(function(r){i.hasOwnProperty(t)||(i[t]=[]),i[t].push(function(e){return r(e)}),e&&"function"==typeof e&&e(t)}),a.then(function(e){return"function"==typeof r&&r(e),e})},g=function(e){return r[e]},P=function(){return l};return{getBook:v,getCumulativeVolume:b,getProfile:y,getQuote:g,getTimestamp:P,processMessage:h}}var t=function(){function t(r){n(this,t),this._internal=e(r)}return i(t,[{key:"getBook",value:function(e){return this._internal.getBook(e)}},{key:"getCumulativeVolume",value:function(e,t){return this._internal.getCumulativeVolume(e,t)}},{key:"getProfile",value:function(e,t){return this._internal.getProfile(e,t)}},{key:"getQuote",value:function(e){return this._internal.getQuote(e)}},{key:"getTimestamp",value:function(){return this._internal.getTimestamp()}},{key:"processMessage",value:function(e){return this._internal.processMessage(e)}}],[{key:"CumulativeVolume",get:function(){return s}},{key:"Profile",get:function(){return o}},{key:"Quote",get:function(){return u}}]),t}();return t}()},{"./../util/convertDayCodeToNumber":19,"./CumulativeVolume":7,"./Profile":9,"./Quote":10,"@barchart/marketdata-utilities-js":31}],9:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("./../util/parseSymbolType"),s=e("./../util/priceFormatter");t.exports=function(){var e={},t=s("-",!0,",").format,r=function(){function r(t,i,s,o,u,c){n(this,r),this.symbol=t,this.name=i,this.exchange=s,this.unitCode=o,this.pointValue=u,this.tickIncrement=c;var l=a(this.symbol);l&&"future"===l.type&&(this.root=l.root,this.month=l.month,this.year=l.year),e[t]=this}return i(r,[{key:"formatPrice",value:function(e){return t(e,this.unitCode)}}],[{key:"setPriceFormatter",value:function(e,r,n){t=s(e,r,n).format}},{key:"PriceFormatter",value:function(e,t,n){r.setPriceFormatter(e,t,n)}},{key:"Profiles",get:function(){return e}}]),r}();return r}()},{"./../util/parseSymbolType":24,"./../util/priceFormatter":25}],10:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.exports=function(){var e=function(){function e(t){n(this,e),this.symbol=t||null,this.message=null,this.flag=null,this.mode=null,this.day=null,this.dayNum=0,this.session=null,this.lastUpdate=null,this.bidPrice=null,this.bidSize=null,this.askPrice=null,this.askSize=null,this.lastPrice=null,this.tradePrice=null,this.tradeSize=null,this.numberOfTrades=null,this.vwap1=null,this.vwap2=null,this.settlementPrice=null,this.openPrice=null,this.highPrice=null,this.lowPrice=null,this.volume=null,this.openInterest=null,this.previousPrice=null,this.time=null,this.ticks=[]}return i(e,null,[{key:"clone",value:function t(e,r){var t=Object.assign({},r);return t.symbol=e,t}}]),e}();return e}()},{}],11:[function(e,t,r){"use strict";var n=e("./MarketState");t.exports=function(){return n}()},{"./MarketState":8}],12:[function(e,t,r){"use strict";var n=e("./parseMessage"),i=e("./parseTimestamp"),a=e("./parseValue");t.exports=function(){return{parseMessage:n,parseTimestamp:i,parseValue:a,Parse:n,ParseTimestamp:i,ParseValue:a}}()},{"./parseMessage":13,"./parseTimestamp":14,"./parseValue":15}],13:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.messageParser}()},{"@barchart/marketdata-utilities-js":31}],14:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.timestampParser}()},{"@barchart/marketdata-utilities-js":31}],15:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.priceParser}()},{"@barchart/marketdata-utilities-js":31}],16:[function(e,t,r){"use strict";var n=e("xhr");t.exports=function(){return function(e){return Promise.resolve().then(function(){if("string"!=typeof e)throw new Error('The "symbol" argument must be a string.');if(0===e.length)throw new Error('The "symbol" argument must be at least one character.');return new Promise(function(t,r){try{var i={url:"https://instruments-prod.aws.barchart.com/instruments/"+encodeURIComponent(e),method:"GET"};n(i,function(n,i,a){if(n)r(n);else if(200!==i.statusCode)r("The server returned an HTTP "+i.statusCode+" response code.");else{var s=JSON.parse(a);s&&s.instrument&&s.instrument.symbol?t(s.instrument.symbol):r("The server was unable to resolve symbol "+e+".")}})}catch(a){r(a)}})})}}()},{xhr:46}],17:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.baseCodeToUnitCode}()},{"@barchart/marketdata-utilities-js":31}],18:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.dateToDayCode}()},{"@barchart/marketdata-utilities-js":31}],19:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.dayCodeToNumber}()},{"@barchart/marketdata-utilities-js":31}],20:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.unitCodeToBaseCode}()},{"@barchart/marketdata-utilities-js":31}],21:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.decimalFormatter}()},{"@barchart/marketdata-utilities-js":31}],22:[function(e,t,r){"use strict";var n=e("./convertBaseCodeToUnitCode"),i=e("./convertDateToDayCode"),a=e("./convertDayCodeToNumber"),s=e("./convertUnitCodeToBaseCode"),o=e("./decimalFormatter"),u=e("./monthCodes"),c=e("./parseSymbolType"),l=e("./priceFormatter"),f=e("./symbolResolver"),m=e("./timeFormatter");t.exports=function(){return{convertBaseCodeToUnitCode:n,convertUnitCodeToBaseCode:s,convertDateToDayCode:i,convertDayCodeToNumber:a,decimalFormatter:o,monthCodes:u,parseSymbolType:c,symbolResolver:f,BaseCode2UnitCode:n,DateToDayCode:i,DayCodeToNumber:a,MonthCodes:u,ParseSymbolType:c,PriceFormatter:l,TimeFormatter:m,UnitCode2BaseCode:s}}()},{"./convertBaseCodeToUnitCode":17,"./convertDateToDayCode":18,"./convertDayCodeToNumber":19,"./convertUnitCodeToBaseCode":20,"./decimalFormatter":21,"./monthCodes":23,"./parseSymbolType":24,"./priceFormatter":25,"./symbolResolver":16,"./timeFormatter":26}],23:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.monthCodes.getCodeToNameMap()}()},{"@barchart/marketdata-utilities-js":31}],24:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.symbolParser.parseInstrumentType}()},{"@barchart/marketdata-utilities-js":31}],25:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.priceFormatter}()},{"@barchart/marketdata-utilities-js":31}],26:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.timeFormatter}()},{"@barchart/marketdata-utilities-js":31}],27:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.exports=function(){var e=function(){function e(){n(this,e)}return i(e,[{key:"parse",value:function(e){if("string"!=typeof e)throw new Error('The "textDocument" argument must be a string.');return this._parse(e)}},{key:"_parse",value:function(e){return null}},{key:"toString",value:function(){return"[XmlDomParserBase]"}}]),e}();return e}()},{}],28:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e("./../XmlDomParserBase");t.exports=function(){var e=function(e){function t(){n(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return window.DOMParser?e._xmlDomParser=new DOMParser:e._xmlDomParser=null,e}return a(t,e),s(t,[{key:"_parse",value:function(e){var t=void 0;return this._xmlDomParser?t=this._xmlDomParser.parseFromString(e,"text/xml"):(t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e)),t}},{key:"toString",value:function(){return"[XmlDomParser]"}}]),t}(o);return e}()},{"./../XmlDomParserBase":27}],29:[function(e,t,r){"use strict";t.exports=function(){return{unitCodeToBaseCode:function(e){switch(e){case"2":return-1;case"3":return-2;case"4":return-3;case"5":return-4;case"6":return-5;case"7":return-6;case"8":return 0;case"9":return 1;case"A":return 2;case"B":return 3;case"C":return 4;case"D":return 5;case"E":return 6;case"F":return 7;default:return 0}},baseCodeToUnitCode:function(e){switch(e){case-1:return"2";case-2:return"3";case-3:return"4";case-4:return"5";case-5:return"6";case-6:return"7";case 0:return"8";case 1:return"9";case 2:return"A";case 3:return"B";case 4:return"C";case 5:return"D";case 6:return"E";case 7:return"F";default:return 0}},dateToDayCode:function(e){var t=e.getDate();return t>=1&&t<=9?String.fromCharCode("1".charCodeAt(0)+t-1):10==t?"0":String.fromCharCode("A".charCodeAt(0)+t-11)},dayCodeToNumber:function(e){ | ||
var t=parseInt(e,31);return t>9?t++:0===t&&(t=10),t}}}()},{}],30:[function(e,t,r){"use strict";var n=e("lodash.isnan");t.exports=function(){return function(e,t,r,i){if(""===e||void 0===e||null===e||n(e))return"";var a=e<0&&i===!0;a&&(e=0-e);var s=e.toFixed(t);if(!r||e>-1e3&&e<1e3)a&&(s="("+s+")");else{for(var o=s.length,u=e<0,c=0===t,l=0,f=[],m=o-1;!(m<0);m--){3!==l||u&&0===m||(f.unshift(r),l=0);var d=s.charAt(m);f.unshift(d),c?l+=1:"."===d&&(c=!0)}a&&(f.unshift("("),f.push(")")),s=f.join("")}return s}}()},{"lodash.isnan":43}],31:[function(e,t,r){"use strict";var n=e("./convert"),i=e("./decimalFormatter"),a=e("./messageParser"),s=e("./monthCodes"),o=e("./priceFormatter"),u=e("./symbolFormatter"),c=e("./symbolParser"),l=e("./priceParser"),f=e("./timeFormatter"),m=e("./timestampParser");t.exports=function(){return{convert:n,decimalFormatter:i,monthCodes:s,messageParser:a,priceFormatter:o,symbolParser:c,priceParser:l,symbolFormatter:u,timeFormatter:f,timestampParser:m}}()},{"./convert":29,"./decimalFormatter":30,"./messageParser":32,"./monthCodes":33,"./priceFormatter":34,"./priceParser":35,"./symbolFormatter":36,"./symbolParser":37,"./timeFormatter":38,"./timestampParser":39}],32:[function(e,t,r){"use strict";var n=e("./priceParser"),i=e("./timestampParser"),a=e("./common/xml/XmlDomParser");t.exports=function(){return function(e){var t={message:e,type:null};switch(e.substr(0,1)){case"%":var r=void 0;try{var s=new a;r=s.parse(e.substring(1))}catch(o){r=void 0}if(r){var u=r.firstChild;switch(u.nodeName){case"BOOK":t.symbol=u.attributes.getNamedItem("symbol").value,t.unitcode=u.attributes.getNamedItem("basecode").value,t.askDepth=parseInt(u.attributes.getNamedItem("bidcount").value),t.bidDepth=parseInt(u.attributes.getNamedItem("bidcount").value),t.asks=[],t.bids=[];var c=void 0,l=void 0;if(u.attributes.getNamedItem("askprices")&&u.attributes.getNamedItem("asksizes")){c=u.attributes.getNamedItem("askprices").value.split(","),l=u.attributes.getNamedItem("asksizes").value.split(",");for(var f=0;f<c.length;f++)t.asks.push({price:n(c[f],t.unitcode),size:parseInt(l[f])})}if(u.attributes.getNamedItem("bidprices")&&u.attributes.getNamedItem("bidsizes")){c=u.attributes.getNamedItem("bidprices").value.split(","),l=u.attributes.getNamedItem("bidsizes").value.split(",");for(var m=0;m<c.length;m++)t.bids.push({price:n(c[m],t.unitcode),size:parseInt(l[m])})}t.type="BOOK";break;case"QUOTE":for(var d=0;d<u.attributes.length;d++){switch(u.attributes[d].name){case"symbol":t.symbol=u.attributes[d].value;break;case"name":t.name=u.attributes[d].value;break;case"exchange":t.exchange=u.attributes[d].value;break;case"basecode":t.unitcode=u.attributes[d].value;break;case"pointvalue":t.pointValue=parseFloat(u.attributes[d].value);break;case"tickincrement":t.tickIncrement=parseInt(u.attributes[d].value);break;case"flag":t.flag=u.attributes[d].value;break;case"lastupdate":var p=u.attributes[d].value;t.lastUpdate=new Date(parseInt(p.substr(0,4)),parseInt(p.substr(4,2))-1,parseInt(p.substr(6,2)),parseInt(p.substr(8,2)),parseInt(p.substr(10,2)),parseInt(p.substr(12,2)));break;case"bid":t.bidPrice=n(u.attributes[d].value,t.unitcode);break;case"bidsize":t.bidSize=parseInt(u.attributes[d].value);break;case"ask":t.askPrice=n(u.attributes[d].value,t.unitcode);break;case"asksize":t.askSize=parseInt(u.attributes[d].value);break;case"mode":t.mode=u.attributes[d].value}for(var h={},v=0;v<u.childNodes.length;v++)if("SESSION"==u.childNodes[v].nodeName){var b={},y=u.childNodes[v].attributes;if(y.getNamedItem("id")&&(b.id=y.getNamedItem("id").value),y.getNamedItem("day")&&(b.day=y.getNamedItem("day").value),y.getNamedItem("last")&&(b.lastPrice=n(y.getNamedItem("last").value,t.unitcode)),y.getNamedItem("previous")&&(b.previousPrice=n(y.getNamedItem("previous").value,t.unitcode)),y.getNamedItem("open")&&(b.openPrice=n(y.getNamedItem("open").value,t.unitcode)),y.getNamedItem("high")&&(b.highPrice=n(y.getNamedItem("high").value,t.unitcode)),y.getNamedItem("low")&&(b.lowPrice=n(y.getNamedItem("low").value,t.unitcode)),y.getNamedItem("tradesize")&&(b.tradeSize=parseInt(y.getNamedItem("tradesize").value)),y.getNamedItem("numtrades")&&(b.numberOfTrades=parseInt(y.getNamedItem("numtrades").value)),y.getNamedItem("settlement")&&(b.settlementPrice=n(y.getNamedItem("settlement").value,t.unitcode)),y.getNamedItem("volume")&&(b.volume=parseInt(y.getNamedItem("volume").value)),y.getNamedItem("openinterest")&&(b.openInterest=parseInt(y.getNamedItem("openinterest").value)),y.getNamedItem("timestamp")){var g=y.getNamedItem("timestamp").value;b.timeStamp=new Date(parseInt(g.substr(0,4)),parseInt(g.substr(4,2))-1,parseInt(g.substr(6,2)),parseInt(g.substr(8,2)),parseInt(g.substr(10,2)),parseInt(g.substr(12,2)))}if(y.getNamedItem("tradetime")){var P=y.getNamedItem("tradetime").value;b.tradeTime=new Date(parseInt(P.substr(0,4)),parseInt(P.substr(4,2))-1,parseInt(P.substr(6,2)),parseInt(P.substr(8,2)),parseInt(P.substr(10,2)),parseInt(P.substr(12,2)))}b.id&&(h[b.id]=b)}var k="undefined"==typeof h.combined.lastPrice,w=!k&&"undefined"!=typeof h.combined.settlementPrice,I=k?h.previous:h.combined;h.combined.previousPrice?t.previousPrice=h.combined.previousPrice:t.previousPrice=h.previous.previousPrice,I.lastPrice&&(t.lastPrice=I.lastPrice),I.openPrice&&(t.openPrice=I.openPrice),I.highPrice&&(t.highPrice=I.highPrice),I.lowPrice&&(t.lowPrice=I.lowPrice),I.tradeSize&&(t.tradeSize=I.tradeSize),I.numberOfTrades&&(t.numberOfTrades=I.numberOfTrades),I.settlementPrice&&(t.settlementPrice=I.settlementPrice),I.volume&&(t.volume=I.volume),I.openInterest&&(t.openInterest=I.openInterest),"combined"===I.id&&h.previous.openInterest&&(t.openInterest=h.previous.openInterest),I.timeStamp&&(t.timeStamp=I.timeStamp),I.tradeTime&&(t.tradeTime=I.tradeTime),h.combined.day&&(t.day=h.combined.day),k&&"undefined"==typeof t.flag&&(t.flag="p");var _=h.previous;if(t.previousPreviousPrice=_.previousPrice,t.previousSettlementPrice=_.settlementPrice,t.previousOpenPrice=_.openPrice,t.previousHighPrice=_.highPrice,t.previousLowPrice=_.lowPrice,t.previousTimeStamp=_.timeStamp,h.combined.day){var T="session_"+h.combined.day+"_T";if(h.hasOwnProperty(T)){var O=h[T],S=O.lastPrice;if(S){var C=O.tradeTime,E=O.tradeSize,x=void 0;if(C){var N=new Date(C.getFullYear(),C.getMonth(),C.getDate(),12,0,0,0);x=C.getTime()>N.getTime()}else x=!1;t.sessionT=x;var M=k||x;M&&(t.lastPriceT=S),(k||w)&&(t.session="T",M&&(C&&(t.tradeTime=C),E&&(t.tradeSize=E)),k&&(O.volume&&(t.volume=O.volume),O.previousPrice&&(t.previousPrice=O.previousPrice)))}}}}t.type="REFRESH_QUOTE";break;case"CV":t.type="REFRESH_CUMULATIVE_VOLUME",t.symbol=u.attributes.getNamedItem("symbol").value,t.unitCode=u.attributes.getNamedItem("basecode").value,t.tickIncrement=n(u.attributes.getNamedItem("tickincrement").value,t.unitCode);var D=u.attributes.getNamedItem("data");if(D){for(var j=D.value||"",A=j.split(":"),F=0;F<A.length;F++){var U=A[F],R=U.split(",");A[F]={price:n(R[0],t.unitCode),volume:parseInt(R[1])}}A.sort(function(e,t){return e.price-t.price}),t.priceLevels=A}else t.priceLevels=[];break;default:console.log(e)}}break;case"":switch(e.substr(1,1)){case"#":t.type="TIMESTAMP",t.timestamp=new Date(parseInt(e.substr(2,4)),parseInt(e.substr(6,2))-1,parseInt(e.substr(8,2)),parseInt(e.substr(10,2)),parseInt(e.substr(12,2)),parseInt(e.substr(14,2)));break;case"2":t.record="2";var z=e.indexOf(",",0);switch(t.symbol=e.substring(2,z),t.subrecord=e.substr(z+1,1),t.unitcode=e.substr(z+3,1),t.exchange=e.substr(z+4,1),t.delay=parseInt(e.substr(z+5,2)),t.subrecord){case"0":var L=e.indexOf(",",z+7);switch(t.value=n(e.substring(z+7,L),t.unitcode),t.element=e.substr(L+1,1),t.modifier=e.substr(L+2,1),t.element){case"A":t.type="OPEN";break;case"C":"1"==t.modifier&&(t.type="OPEN_INTEREST");break;case"D":case"d":"0"==t.modifier&&(t.type="SETTLEMENT");break;case"V":"0"==t.modifier&&(t.type="VWAP");break;case"0":"0"==t.modifier&&(t.tradePrice=t.value,t.type="TRADE");break;case"5":t.type="HIGH";break;case"6":t.type="LOW";break;case"7":"1"==t.modifier?t.type="VOLUME_YESTERDAY":"6"==t.modifier&&(t.type="VOLUME")}t.day=e.substr(L+3,1),t.session=e.substr(L+4,1),t.time=i(e.substr(e.indexOf("")+1,9));break;case"1":case"2":case"3":case"4":var V=e.substring(z+8).split(",");t.openPrice=n(V[0],t.unitcode),t.highPrice=n(V[1],t.unitcode),t.lowPrice=n(V[2],t.unitcode),t.lastPrice=n(V[3],t.unitcode),t.bidPrice=n(V[4],t.unitcode),t.askPrice=n(V[5],t.unitcode),t.previousPrice=n(V[7],t.unitcode),t.settlementPrice=n(V[10],t.unitcode),t.volume=V[13].length>0?parseInt(V[13]):void 0,t.openInterest=V[12].length>0?parseInt(V[12]):void 0,t.day=V[14].substr(0,1),t.session=V[14].substr(1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="REFRESH_DDF";break;case"7":var B=e.indexOf(",",z+7);t.tradePrice=n(e.substring(z+7,B),t.unitcode),z=B+1,B=e.indexOf(",",z),t.tradeSize=parseInt(e.substring(z,B)),z=B+1,t.day=e.substr(z,1),t.session=e.substr(z+1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="TRADE";break;case"8":var q=e.indexOf(",",z+7);t.bidPrice=n(e.substring(z+7,q),t.unitcode),z=q+1,q=e.indexOf(",",z),t.bidSize=parseInt(e.substring(z,q)),z=q+1,q=e.indexOf(",",z),t.askPrice=n(e.substring(z,q),t.unitcode),z=q+1,q=e.indexOf(",",z),t.askSize=parseInt(e.substring(z,q)),z=q+1,t.day=e.substr(z,1),t.session=e.substr(z+1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="TOB";break;case"Z":var H=e.indexOf(",",z+7);t.tradePrice=n(e.substring(z+7,H),t.unitcode),z=H+1,H=e.indexOf(",",z),t.tradeSize=parseInt(e.substring(z,H)),z=H+1,t.day=e.substr(z,1),t.session=e.substr(z+1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="TRADE_OUT_OF_SEQUENCE"}break;case"3":var G=e.indexOf(",",0);switch(t.symbol=e.substring(2,G),t.subrecord=e.substr(G+1,1),t.subrecord){case"B":t.unitcode=e.substr(G+3,1),t.exchange=e.substr(G+4,1),t.bidDepth="A"==e.substr(G+5,1)?10:parseInt(e.substr(G+5,1)),t.askDepth="A"==e.substr(G+6,1)?10:parseInt(e.substr(G+6,1)),t.bids=[],t.asks=[];for(var X=e.substring(G+8).split(","),$=0;$<X.length;$++){var Q=X[$].split(/[A-Z]/),Z=X[$].substr(Q[0].length,1);Z<="J"?t.asks.push({price:n(Q[0],t.unitcode),size:parseInt(Q[1])}):t.bids.push({price:n(Q[0],t.unitcode),size:parseInt(Q[1])})}t.type="BOOK"}break;default:t.type="UNKNOWN"}}return t}}()},{"./common/xml/XmlDomParser":28,"./priceParser":35,"./timestampParser":39}],33:[function(e,t,r){"use strict";t.exports=function(){var e={},t={},r=function(r,n,i){e[r]=n,t[r]=i};return r("F","January",1),r("G","February",2),r("H","March",3),r("J","April",4),r("K","May",5),r("M","June",6),r("N","July",7),r("Q","August",8),r("U","September",9),r("V","October",10),r("X","November",11),r("Z","December",12),r("Y","Cash",0),{getCodeToNameMap:function(){return e},getCodeToNumberMap:function(){return t}}}()},{}],34:[function(e,t,r){"use strict";var n=e("lodash.isnan"),i=e("./decimalFormatter");t.exports=function(){function e(e,t){return["000",Math.floor(e)].join("").substr(-1*t)}return function(t,r,a,s){function o(e){var r=Math.floor(e);return 0===r&&""===t?"":r}function u(e,t){return i(e,t,a,s)}var c=void 0;return c="."===t?function(e,t){switch(t){case"2":return u(e,3);case"3":return u(e,4);case"4":return u(e,5);case"5":return u(e,6);case"6":return u(e,7);case"7":return u(e,8);case"8":return u(e,0);case"9":return u(e,1);case"A":return u(e,2);case"B":return u(e,3);case"C":return u(e,4);case"D":return u(e,5);case"E":return u(e,6);default:return""===e||void 0===e||null===e||n(e)?"":e}}:function(i,a){if(""===i||void 0===i||null===i||n(i))return"";var c=i,l=Math.abs(i),f=i<0,m=void 0,d=void 0;switch(f?s===!0?(m="(",d=")"):(m="-",d=""):(m="",d=""),a){case"2":return[m,o(l),t,e(8*(l-Math.floor(l)),1),d].join("");case"3":return[m,o(l),t,e(16*(l-Math.floor(l)),2),d].join("");case"4":return[m,o(l),t,e(32*(l-Math.floor(l)),2),d].join("");case"5":return[m,o(l),t,e((l-Math.floor(l))*(r?320:64),r?3:2),d].join("");case"6":return[m,o(l),t,e((l-Math.floor(l))*(r?320:128),3),d].join("");case"7":return[m,o(l),t,e((l-Math.floor(l))*(r?320:256),3),d].join("");case"8":return u(c,0);case"9":return u(c,1);case"A":return u(c,2);case"B":return u(c,3);case"C":return u(c,4);case"D":return u(c,5);case"E":return u(c,6);default:return c}},{format:c}}}()},{"./decimalFormatter":30,"lodash.isnan":43}],35:[function(e,t,r){"use strict";t.exports=function(){function e(e){return t.hasOwnProperty(e)||(t[e]=new RegExp(e,"g")),t[e]}var t={};return function(t,r,n){if(!(t.length<1)){if("-"===t)return null;if(n&&(t=t.replace(e(n),"")),!(t.indexOf(".")<0))return parseFloat(t);var i="-"==t.substr(0,1)?-1:1;switch(i===-1&&(t=t.substr(1)),r){case"2":return i*((t.length>1?parseInt(t.substr(0,t.length-1)):0)+parseInt(t.substr(-1))/8);case"3":return i*((t.length>2?parseInt(t.substr(0,t.length-2)):0)+parseInt(t.substr(-2))/16);case"4":return i*((t.length>2?parseInt(t.substr(0,t.length-2)):0)+parseInt(t.substr(-2))/32);case"5":return i*((t.length>2?parseInt(t.substr(0,t.length-2)):0)+parseInt(t.substr(-2))/64);case"6":return i*((t.length>3?parseInt(t.substr(0,t.length-3)):0)+parseInt(t.substr(-3))/128);case"7":return i*((t.length>3?parseInt(t.substr(0,t.length-3)):0)+parseInt(t.substr(-3))/256);case"8":return i*parseInt(t);case"9":return i*(parseInt(t)/10);case"A":return i*(parseInt(t)/100);case"B":return i*(parseInt(t)/1e3);case"C":return i*(parseInt(t)/1e4);case"D":return i*(parseInt(t)/1e5);case"E":return i*(parseInt(t)/1e6);default:return i*parseInt(t)}}}}()},{}],36:[function(e,t,r){"use strict";t.exports=function(){return{format:function(e){return null!==e&&"string"==typeof e?e.toUpperCase():e}}}()},{}],37:[function(e,t,r){"use strict";t.exports=function(){function e(e,t){var r=h.parseInstrumentType(e);return null!==r&&r.type===t}function t(e){var t=new Date,r=t.getFullYear(),n=parseInt(e);if(n<10)n=10*Math.floor(r/10)+n;else if(n<100&&(n=100*Math.floor(r/100)+n,n<r)){var i=n+100;r-n>i-r&&(n=i)}return n}var r=/^(.*)\\.([A-Z]{1,4})$/i,n=/(.{1,3})([A-Z]{1})([0-9]{3}|[0-9]{1})?([0-9]{1})$/i,i=/^(.{1,3})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,a=/^(.{1,3})(\*{1})([0-9]{1})$/i,s=/^_S_/i,o=/^(.{1,2})([A-Z])([0-9]{1,4})([A-Z])$/i,u=/^(.{1,3})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,c=/^\^([A-Z]{3})([A-Z]{3})$/i,l=/^\-(.*)$/i,f=/^\$(.*)$/i,m=/^(.*)\.BZ$/i,d=/(\.RT)$/,p={A:"F",B:"G",C:"H",D:"J",E:"K",I:"M",L:"N",O:"Q",P:"U",R:"V",S:"X",T:"Z"},h={parseInstrumentType:function(e){if("string"!=typeof e)return null;var n=e.match(r);if(null!==n&&(e=n[1]),s.test(e))return{symbol:e,type:"future_spread"};var m=e.match(i);if(null!==m)return{symbol:e,type:"future",root:m[1],dynamic:!1,month:m[2],year:t(m[3])};var d=e.match(a);if(null!==d)return{symbol:e,type:"future",root:d[1],dynamic:!0,dynamicCode:d[3]};var h=e.match(c);if(null!==h)return{symbol:e,type:"forex"};var v=e.match(f);if(null!==v)return{symbol:e,type:"index"};var b=e.match(l);if(null!==b)return{symbol:e,type:"sector"};var y=e.match(o);if(null!==y){var g=new Date,P=g.getFullYear(),k=void 0,w=void 0;return y[4]>="P"?(w=P+(y[4].charCodeAt(0)-"P".charCodeAt(0)),k="put"):(w=P+(y[4].charCodeAt(0)-"C".charCodeAt(0)),k="call"),{symbol:e,type:"future_option",root:y[1],month:y[2],year:w,strike:parseInt(y[3]),option_type:k}}var I=e.match(u);if(null!==I){var _=I[2];return{symbol:e,type:"future_option",root:I[1],month:p.hasOwnProperty(_)?p[_]:_,year:t(I[3]),strike:parseInt(I[4]),option_type:"C"===I[5]?"call":"put"}}return null},getIsConcrete:function(e){return!h.getIsReference(e)},getIsReference:function(e){return a.test(e)},getIsFuture:function(t){return e(t,"future")},getIsFutureSpread:function(t){return e(t,"future_spread")},getIsFutureOption:function(t){return e(t,"future_option")},getIsForex:function(t){return e(t,"forex")},getIsSector:function(t){return e(t,"sector")},getIsIndex:function(t){return e(t,"index")},getIsBats:function(e){return m.test(e)},getProducerSymbol:function(e){return"string"==typeof e?e.replace(n,"$1$2$4"):null},displayUsingPercent:function(e){return d.test(e)}};return h}()},{}],38:[function(e,t,r){"use strict";t.exports=function(){function e(e){var t=e.getHours(),r=void 0;return 0===t?(t=12,r="AM"):12===t?(t=t,r="PM"):t>12?(t-=12,r="PM"):(t=t,r="AM"),i(t)+":"+i(e.getMinutes())+":"+i(e.getSeconds())+" "+r}function t(e){var t=e.getHours(),r=void 0;return 0===t?(t=12,r="A"):12===t?(t=t,r="P"):t>12?(t-=12,r="P"):(t=t,r="A"),i(t)+":"+i(e.getMinutes())+r}function r(e){return i(e.getHours())+":"+i(e.getMinutes())+":"+i(e.getSeconds())}function n(e){return i(e.getHours())+":"+i(e.getMinutes())}function i(e){return("00"+e).substr(-2)}return function(a,s){var o=void 0;o=a?s?t:e:s?n:r;var u={format:function(e){var t=e.time;return t?!e.lastPrice||e.flag||e.sessionT?u.formatDate(t):u.formatTime(t,e.timezone):""},formatTime:function(e,t){var r=void 0;return e?(r=o(e),t&&(r=r+" "+t)):r="",r},formatDate:function(e){return e?i(e.getMonth()+1)+"/"+i(e.getDate())+"/"+i(e.getFullYear()):""}};return u}}()},{}],39:[function(e,t,r){"use strict";t.exports=function(){return function(e){if(9!==e.length)return null;var t=100*e.charCodeAt(0)+e.charCodeAt(1)-64,r=e.charCodeAt(2)-64-1,n=e.charCodeAt(3)-64,i=e.charCodeAt(4)-64,a=e.charCodeAt(5)-64,s=e.charCodeAt(6)-64,o=(255&e.charCodeAt(7))+((255&e.charCodeAt(8))<<8);return new Date(t,r,n,i,a,s,o)}}()},{}],40:[function(e,t,r){function n(e,t,r){if(!o(t))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this),"[object Array]"===u.call(e)?i(e,t,r):"string"==typeof e?a(e,t,r):s(e,t,r)}function i(e,t,r){for(var n=0,i=e.length;n<i;n++)c.call(e,n)&&t.call(r,e[n],n,e)}function a(e,t,r){for(var n=0,i=e.length;n<i;n++)t.call(r,e.charAt(n),n,e)}function s(e,t,r){for(var n in e)c.call(e,n)&&t.call(r,e[n],n,e)}var o=e("is-function");t.exports=n;var u=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":42}],41:[function(e,t,r){(function(e){var r;r="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{},t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],42:[function(e,t,r){function n(e){var t=i.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)}t.exports=n;var i=Object.prototype.toString},{}],43:[function(e,t,r){function n(e){return!!e&&"object"==typeof e}function i(e){return a(e)&&e!=+e}function a(e){return"number"==typeof e||n(e)&&u.call(e)==s}var s="[object Number]",o=Object.prototype,u=o.toString;t.exports=i},{}],44:[function(e,t,r){var n=e("trim"),i=e("for-each"),a=function(e){return"[object Array]"===Object.prototype.toString.call(e)};t.exports=function(e){if(!e)return{};var t={};return i(n(e).split("\n"),function(e){var r=e.indexOf(":"),i=n(e.slice(0,r)).toLowerCase(),s=n(e.slice(r+1));"undefined"==typeof t[i]?t[i]=s:a(t[i])?t[i].push(s):t[i]=[t[i],s]}),t}},{"for-each":40,trim:45}],45:[function(e,t,r){function n(e){return e.replace(/^\s*|\s*$/g,"")}r=t.exports=n,r.left=function(e){return e.replace(/^\s*/,"")},r.right=function(e){return e.replace(/\s*$/,"")}},{}],46:[function(e,t,r){"use strict";function n(e,t){for(var r=0;r<e.length;r++)t(e[r])}function i(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function a(e,t,r){var n=e;return f(t)?(r=t,"string"==typeof e&&(n={uri:e})):n=d(t,{uri:e}),n.callback=r,n}function s(e,t,r){return t=a(e,t,r),o(t)}function o(e){function t(){4===l.readyState&&a()}function r(){var e=void 0;if(e=l.response?l.response:l.responseText||u(l),P)try{e=JSON.parse(e)}catch(t){}return e}function n(e){return clearTimeout(p),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,c(e,k)}function a(){if(!d){var t;clearTimeout(p),t=e.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var n=k,i=null;return 0!==t?(n={body:r(),statusCode:t,method:v,headers:{},url:h,rawRequest:l},l.getAllResponseHeaders&&(n.headers=m(l.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),c(i,n,n.body)}}if("undefined"==typeof e.callback)throw new Error("callback argument missing");var o=!1,c=function(t,r,n){o||(o=!0,e.callback(t,r,n))},l=e.xhr||null;l||(l=e.cors||e.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,d,p,h=l.url=e.uri||e.url,v=l.method=e.method||"GET",b=e.body||e.data||null,y=l.headers=e.headers||{},g=!!e.sync,P=!1,k={body:void 0,headers:{},statusCode:0,method:v,url:h,rawRequest:l};if("json"in e&&e.json!==!1&&(P=!0,y.accept||y.Accept||(y.Accept="application/json"),"GET"!==v&&"HEAD"!==v&&(y["content-type"]||y["Content-Type"]||(y["Content-Type"]="application/json"),b=JSON.stringify(e.json===!0?b:e.json))),l.onreadystatechange=t,l.onload=a,l.onerror=n,l.onprogress=function(){},l.onabort=function(){d=!0},l.ontimeout=n,l.open(v,h,!g,e.username,e.password),g||(l.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(p=setTimeout(function(){if(!d){d=!0,l.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",n(e)}},e.timeout)),l.setRequestHeader)for(f in y)y.hasOwnProperty(f)&&l.setRequestHeader(f,y[f]);else if(e.headers&&!i(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(l.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(l),l.send(b),l}function u(e){if("document"===e.responseType)return e.responseXML;var t=204===e.status&&e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;return""!==e.responseType||t?null:e.responseXML}function c(){}var l=e("global/window"),f=e("is-function"),m=e("parse-headers"),d=e("xtend");t.exports=s,s.XMLHttpRequest=l.XMLHttpRequest||c,s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:l.XDomainRequest,n(["get","put","post","patch","head","delete"],function(e){s["delete"===e?"del":e]=function(t,r,n){return r=a(t,r,n),r.method=e.toUpperCase(),o(r)}})},{"global/window":41,"is-function":42,"parse-headers":44,xtend:47}],47:[function(e,t,r){function n(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)i.call(r,n)&&(e[n]=r[n])}return e}t.exports=n;var i=Object.prototype.hasOwnProperty},{}]},{},[6])(6)}); |
@@ -20,4 +20,4 @@ const connection = require('./connection/index'), | ||
version: '3.1.1' | ||
version: '3.1.2' | ||
}; | ||
})(); |
{ | ||
"name": "@barchart/marketdata-api-js", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Barchart client library for streaming market data from JERQ servers using JavaScript", | ||
@@ -44,3 +44,3 @@ "author": { | ||
"dependencies": { | ||
"@barchart/marketdata-utilities-js": "3.0.3", | ||
"@barchart/marketdata-utilities-js": "3.0.4", | ||
"xhr": "2.3.2" | ||
@@ -47,0 +47,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
624036