New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@barchart/marketdata-api-js

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@barchart/marketdata-api-js - npm Package Compare versions

Comparing version 3.1.15 to 3.1.16

lib/common/lang/array.js

2

bower.json
{
"name": "barchart-marketdata-api",
"version": "3.1.14",
"version": "3.1.15",
"homepage": "https://github.com/barchart/marketdata-api-js",

@@ -5,0 +5,0 @@ "description": "Barchart Market Data API for JavaScript",

!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=new TextDecoder,r=t.decode(e.data);H.push(r)}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};return 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.0.7"}}()},{"./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)});

@@ -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"),f=self||window;t.exports=function(){function e(e){function n(e,t){var r=X.length-1;r>0&&X[r].id===e?X[r].symbols.push(t):X.push({id:e,symbols:[t]})}function i(e,t){var r=void 0;switch(e){case"events":r=W.events;break;case"marketDepth":r=W.marketDepth[t.symbol];break;case"marketUpdate":r=W.marketUpdate[t.symbol];break;case"timestamp":r=W.timestamp}r&&r.forEach(function(e){return e(t)})}function a(){u.keys(q).forEach(function(e){n("MU_GO",e)}),u.keys(H).forEach(function(e){n("MU_GO",e)}),u.keys(B).forEach(function(e){n("MD_GO",e)})}function s(){u.keys(q).forEach(function(e){n("MU_STOP",e)}),u.keys(H).forEach(function(e){n("MU_STOP",e)}),u.keys(B).forEach(function(e){n("MU_STOP",e)})}function c(){X=[]}function h(e,t,n){R||F||(Y.username=t,Y.password=n,Y.server=e,f.WebSocket?(j=r.disconnected,R=new WebSocket("wss://"+Y.server+"/jerq"),R.binaryType="arraybuffer",z||(z=f.setInterval(function(){if(!L&&R){console.log(new Date+" bouncing, heartbeat timeout");try{R.readyState===WebSocket.OPEN&&R.send("LOGOUT\r\n"),R.close()}catch(e){console.warn("failed to send LOGOUT",e)}}L=null},p)),R.onclose=function(e){return console.warn(new Date+" connection closed. pending messages",Q),R.onclose=null,R.onopen=null,R.onmessage=null,R=null,L=null,1===Q.length&&0===Q[0].indexOf("-")?(console.warn("not triggering reconnect: bad credentails"),void v()):(j=r.disconnected,i("events",{event:"disconnect"}),F?void console.warn("not triggering reconnect: user has logged out."):void setTimeout(function(){h(Y.server,Y.username,Y.password),c(),a()},d+Math.floor(Math.random()*p)))},R.onmessage=function(e){if(L=1,e.data instanceof ArrayBuffer){var t=J.decode(e.data);t&&Q.push(t)}else Q.push(e.data)},R.onopen=function(e){console.log(new Date+" connection open.")}):console.warn("Websockets are not supported by this browser."))}function v(){console.warn("shutting down."),j=r.disconnected,null!=z&&f.clearInterval(z),null!==R&&(R.send("LOGOUT\r\n"),R.close()),z=null,L=null,X=[],Z=[],$=[],B={},q={},H={}}function b(e){if(j===r.disconnected&&(j=r.connecting),j===r.connecting){var n=e.split("\n");n.forEach(function(e){"+++"==e&&(j=r.authenticating,Z.splice(0,0,"LOGIN "+Y.username+":"+Y.password+" VERSION="+t+"\r\n"))})}else if(j===r.authenticating){var a=e.charAt(0);"+"===a?(j=r.authenticated,i("events",{event:"login success"})):"-"===a&&(v(),i("events",{event:"login fail"}))}j===r.authenticated&&$.push(e)}function y(){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=V[f]||[];a(l,c)||(p=!0),p&&(v=v.filter(function(e){var t=e!==l;return!t&&a(e,[s])&&(h=!1),t}),V[f]=v),h&&(delete e[f],u.forEach(function(e){e.hasOwnProperty(f)&&(h=!1)}),h&&n(t,f))}};switch(e){case"events":W.events=i(W.events);break;case"marketDepth":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('marketDepth', handler, symbol)");s(B,"MD_STOP",W.marketDepth,[],[]);break;case"marketUpdate":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('marketUpdate', handler, symbol)");s(q,"MU_STOP",W.marketUpdate,[H],[W.cumulativeVolume]);break;case"cumulativeVolume":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('cumulativeVolume', handler, symbol)");s(H,"MU_STOP",W.cumulativeVolume,[q],[W.marketUpdate]),A.getCumulativeVolume(r,function(e){e.off("events",t)});break;case"timestamp":W.timestamp=i(W.timestamp)}}function g(){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=V[c]||[],f=!l.some(function(e){return e===u});if(f&&(l=l.slice(0),l.push(u),V[c]=l),!e[c]){e[c]=!0;var m=!s.some(function(e){return e[c]});m&&n(t,c)}};switch(e){case"events":W.events=i(W.events);break;case"marketDepth":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: on('marketDepth', handler, symbol)");a(B,"MD_GO",W.marketDepth,[]),A.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(q,"MU_GO",W.marketUpdate,[H]),A.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(H,"MU_GO",W.cumulativeVolume,[q]),A.getCumulativeVolume(r,function(e){e.on("events",t)});break;case"timestamp":W.timestamp=i(W.timestamp)}}function P(e){switch(A.processMessage(e),e.type){case"BOOK":i("marketDepth",e);break;case"TIMESTAMP":i("timestamp",A.getTimestamp());break;default:i("marketUpdate",e)}}function k(e){var t=void 0;try{if(t=l(e),t.type)if(t.symbol){var r=V[t.symbol]||[];G.hasOwnProperty(t.symbol)&&(r=r.concat(G[t.symbol]).filter(function(e,t,r){return r.indexOf(e)===t}),delete G[t.symbol]),r.forEach(function(e){var r=void 0;e===t.symbol?r=t:(r=Object.assign({},t),r.symbol=e),P(r)})}else P(t);else console.log(e)}catch(n){console.error(n),console.log(t)}}function w(){if((j===r.authenticating||j===r.authenticated)&&R){var e=Z.shift();if(j===r.authenticating&&e&&0===e.indexOf("GO"))console.log("pushing back GO command until fully authenticated."),Z.push(e);else for(;e;)console.log(e),R.send(e),e=Z.shift()}setTimeout(w,200)}function I(){for(var e=9,t=!1;!t;){var r=$.shift();if(r){var n=!1,i=1,a=-1,s=r.indexOf(m.etx),o=r.indexOf(m.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?($.length>0?$[0]=r+$[0]:($.unshift(r),t=!0),n=!0):r.substr(a+1,1)==m.dc4&&(u+=e+1)),!n){var c=r.substring(0,u);2==i?c=c.trim():(a=c.indexOf(m.soh),a>0&&(c=c.substring(a))),c.length>0&&k(c),r=r.substring(u),r.length>0&&($.length>0?$[0]=r+$[0]:$.unshift(r))}}else r.length>0&&($.length>0?$[0]=r+$[0]:($.unshift(r),t=!0))}else t=!0;0===$.length&&(t=!0)}setTimeout(I,125)}function _(){for(var e=Q.shift();e;)b(e),e=Q.shift();setTimeout(_,125)}function T(e){if(j===r.authenticated)for(;X.length>0;){var t=X.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);Z.push(n+" "+o.join(",")+"="+i)}}}e||x(!1)}function O(){if(j===r.authenticated&&0===Z.length){X=[];var e=function(e){for(var t=[];0!==e.length;)t.push(e.splice(0,250));return t},t=e(C([q,H]));t.forEach(function(e){Z.push("GO "+e.join(",")+"=sc")});e(u.keys(B));t.forEach(function(e){Z.push("GO "+e.join(",")+"=b")});var n=e(u.keys(G)).filter(function(e){return!t.some(function(t){return t===e})});n.forEach(function(e){Z.push("GO "+e.join(",")+"=s")})}x(!0)}function S(e){U!==e&&(U=e)}function C(e){return u.keys(e.reduce(function(e,t){for(var r in t)t[r]===!0&&(e[r]=!0);return e},{}))}function E(){return C([q,B,H]).length}function x(e){var t=void 0,r=void 0;U?(e||(s(),T(!0)),t=O,r=U):(e&&a(),t=T,r=250),setTimeout(t,r)}function M(e,t,r){F=!1,h(e,t,r)}function N(){F=!0,Y.username=null,Y.password=null,Y.server=null,v()}function D(e){var t=o.symbolParser.getProducerSymbol(e);G[t]=[e,t],n("P_SNAPSHOT",t)}var A=e,j=r.disconnected,F=!1,U=null,R=null,z=null,L=null,V={},B={},q={},H={},G={},X=[],Z=[],$=[],Q=[],W={events:[],marketDepth:{},marketUpdate:{},cumulativeVolume:{},timestamp:[]},Y={username:null,password:null,server:null},J=void 0;return J=f.TextDecoder?new TextDecoder:{decode:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},setTimeout(w,200),setTimeout(_,125),setTimeout(I,125),setTimeout(x,250),{connect:M,disconnect:N,off:y,on:g,getActiveSymbolCount:E,setPollingFrequency:S,handleProfileRequest:D}}var t=4,r={connecting:"CONNECTING",authenticating:"LOGGING_IN",authenticated:"LOGGED_IN",disconnected:"DISCONNECTED"},m={soh:"",etx:"",lf:"\n",dc4:""},d=5e3,p=1e4,h=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 h}()},{"./../../../common/lang/object":1,"./../../../messageParser/parseMessage":13,"./../../ConnectionBase":3,"@barchart/marketdata-utilities-js":38}],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.15"}}()},{"./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":38}],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":38}],14:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.timestampParser}()},{"@barchart/marketdata-utilities-js":38}],15:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.priceParser}()},{"@barchart/marketdata-utilities-js":38}],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:32}],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":38}],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":38}],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":38}],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":38}],21:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.decimalFormatter}()},{"@barchart/marketdata-utilities-js":38}],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":38}],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":38}],25:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.priceFormatter}()},{"@barchart/marketdata-utilities-js":38}],26:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.timeFormatter}()},{"@barchart/marketdata-utilities-js":38}],27:[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":29}],28:[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:{})},{}],29:[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},{}],30:[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":27,trim:31}],31:[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*$/,"")}},{}],32:[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":28,"is-function":29,"parse-headers":30,xtend:33}],33:[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},{}],34:[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}()},{}],35:[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":34}],36:[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}}}()},{}],37:[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":47}],38:[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":36,"./decimalFormatter":37,"./messageParser":39,"./monthCodes":40,"./priceFormatter":41,"./priceParser":42,"./symbolFormatter":43,"./symbolParser":44,"./timeFormatter":45,"./timestampParser":46}],39:[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 M=new Date(C.getFullYear(),C.getMonth(),C.getDate(),12,0,0,0);x=C.getTime()>M.getTime()}else x=!1;t.sessionT=x;var N=k||x;N&&(t.lastPriceT=S),(k||w)&&(t.session="T",N&&(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 A=D.value||"",j=A.split(":"),F=0;F<j.length;F++){var U=j[F],R=U.split(",");j[F]={price:n(R[0],t.unitCode),volume:parseInt(R[1])}}j.sort(function(e,t){return e.price-t.price}),t.priceLevels=j}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"C":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(","),Z=0;Z<X.length;Z++){var $=X[Z].split(/[A-Z]/),Q=X[Z].substr($[0].length,1);Q<="J"?t.asks.push({price:n($[0],t.unitcode),size:parseInt($[1])}):t.bids.push({price:n($[0],t.unitcode),size:parseInt($[1])})}t.type="BOOK"}break;default:t.type="UNKNOWN"}}return t}}()},{"./common/xml/XmlDomParser":35,"./priceParser":42,"./timestampParser":46}],40:[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}}}()},{}],41:[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":37,"lodash.isnan":47}],42:[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)}}}}()},{}],43:[function(e,t,r){"use strict";t.exports=function(){return{format:function(e){return null!==e&&"string"==typeof e?e.toUpperCase():e}}}()},{}],44:[function(e,t,r){"use strict";t.exports=function(){function e(e,t){var r=v.parseInstrumentType(e);return null!==r&&r.type===t}function t(e){var t=new Date,r=t.getFullYear(),n=parseInt(e);if(n<10){var i=n<r%10?1:0;n=10*Math.floor(r/10)+n+10*i}else if(n<100&&(n=100*Math.floor(r/100)+n,n<r)){var a=n+100;r-n>a-r&&(n=a)}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=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,a=/^([A-Z][A-Z0-9\$\-!\.]{0,2})(\*{1})([0-9]{1})$/i,s=/^_S_/i,o=/^([A-Z][A-Z0-9\$\-!\.]?)([A-Z])([0-9]{1,4})([A-Z])$/i,u=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,c=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,l=/^\^([A-Z]{3})([A-Z]{3})$/i,f=/^\-(.*)$/i,m=/^\$(.*)$/i,d=/^(.*)\.BZ$/i,p=/(\.RT)$/,h={A:"F",B:"G",C:"H",D:"J",E:"K",I:"M",L:"N",O:"Q",P:"U",R:"V",S:"X",T:"Z"},v={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 d=e.match(i);if(null!==d)return{symbol:e,type:"future",root:d[1],dynamic:!1,month:d[2],year:t(d[3])};var p=e.match(a);if(null!==p)return{symbol:e,type:"future",root:p[1],dynamic:!0,dynamicCode:p[3]};var v=e.match(l);if(null!==v)return{symbol:e,type:"forex"};var b=e.match(m);if(null!==b)return{symbol:e,type:"index"};var y=e.match(f);if(null!==y)return{symbol:e,type:"sector"};var g=e.match(o);if(null!==g){var P=new Date,k=P.getFullYear(),w=void 0,I=void 0;return g[4]>="P"?(I=k+(g[4].charCodeAt(0)-"P".charCodeAt(0)),w="put"):(I=k+(g[4].charCodeAt(0)-"C".charCodeAt(0)),w="call"),{symbol:e,type:"future_option",root:g[1],month:g[2],year:I,strike:parseInt(g[3]),option_type:w}}var _=e.match(u),T=null!==_?_:e.match(c);if(null!==T){var O=T[2];return{symbol:e,type:"future_option",root:T[1],month:h.hasOwnProperty(O)?h[O]:O,year:t(T[3]),strike:parseInt(T[4]),option_type:"C"===T[5]?"call":"put"}}return null},getIsConcrete:function(e){return!v.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 d.test(e)},getProducerSymbol:function(e){if("string"==typeof e){var t=v.parseInstrumentType(e);if(null!==t&&"future_option"===t.type){var r=new Date,i=r.getFullYear(),a="call"===t.option_type?"C":"P",s=String.fromCharCode(a.charCodeAt(0)+(t.year-i));if(t.root.length<3)return t.root+t.month+t.strike+s;var o=t.year.toString().substr(-1);return t.root+t.month+o+"|"+t.strike+a}return e.replace(n,"$1$2$4")}return null},displayUsingPercent:function(e){return p.test(e)}};return v}()},{}],45:[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}}()},{}],46:[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)}}()},{}],47:[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},{}]},{},[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(o,s){if(!r[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[o]={exports:{}};t[o][0].call(l.exports,function(e){var r=t[o][1][e];return i(r?r:e)},l,l.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,r){"use strict";t.exports=function(){var e={unique:function(e){var t=e||[];return t.filter(function(e,r){return t.indexOf(e)===r})}};return e}()},{}],2:[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}()},{}],3:[function(e,t,r){"use strict";var n=e("./websocket/Connection");t.exports=function(){return n}()},{"./websocket/Connection":6}],4:[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":9}],5:[function(e,t,r){"use strict";var n=e("./Connection");t.exports=function(){return n}()},{"./Connection":3}],6:[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 o=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}}(),s=e("@barchart/marketdata-utilities-js"),u=e("./../../../common/lang/array"),c=e("./../../../common/lang/object"),l=e("./../../ConnectionBase"),f=e("./../../../messageParser/parseMessage"),m=self||window;t.exports=function(){function e(e){function n(e,t){var r=W.length-1;r>0&&W[r].id===e?W[r].symbols.push(t):W.push({id:e,symbols:[t]})}function i(e,t){var r=void 0;switch(e){case"events":r=Q.events;break;case"marketDepth":r=Q.marketDepth[t.symbol];break;case"marketUpdate":r=Q.marketUpdate[t.symbol];break;case"timestamp":r=Q.timestamp}r&&r.forEach(function(e){return e(t)})}function a(){g([Q.marketUpdate,Q.cumulativeVolume]).forEach(function(e){n("MU_GO",e)}),g([Q.marketDepth]).forEach(function(e){n("MD_GO",e)})}function o(){g([Q.marketUpdate,Q.cumulativeVolume]).forEach(function(e){n("MU_STOP",e)}),g([Q.marketDepth]).forEach(function(e){n("MU_STOP",e)})}function l(){W=[]}function v(e,t,n){B||L||(ee.username=t,ee.password=n,ee.server=e,m.WebSocket?(V=r.disconnected,B=new WebSocket("wss://"+ee.server+"/jerq"),B.binaryType="arraybuffer",H||(H=m.setInterval(function(){if(!G&&B){console.log(new Date+" bouncing, heartbeat timeout");try{B.readyState===WebSocket.OPEN&&B.send("LOGOUT\r\n"),B.close()}catch(e){console.warn("failed to send LOGOUT",e)}}G=null},h)),B.onclose=function(e){return console.warn(new Date+" connection closed. pending messages",K),B.onclose=null,B.onopen=null,B.onmessage=null,B=null,G=null,1===K.length&&0===K[0].indexOf("-")?(console.warn("not triggering reconnect: bad credentails"),void b()):(V=r.disconnected,i("events",{event:"disconnect"}),L?void console.warn("not triggering reconnect: user has logged out."):void setTimeout(function(){v(ee.server,ee.username,ee.password),l(),a()},p+Math.floor(Math.random()*h)))},B.onmessage=function(e){if(G=1,e.data instanceof ArrayBuffer){var t=te.decode(e.data);t&&K.push(t)}else K.push(e.data)},B.onopen=function(e){console.log(new Date+" connection open.")}):console.warn("Websockets are not supported by this browser."))}function b(){console.warn("shutting down."),V=r.disconnected,null!==H&&m.clearInterval(H),null!==B&&(B.send("LOGOUT\r\n"),B.close()),H=null,G=null,W=[],Y=[],J=[]}function y(e){if(V===r.disconnected&&(V=r.connecting),V===r.connecting){var n=e.split("\n");n.forEach(function(e){"+++"==e&&(V=r.authenticating,Y.splice(0,0,"LOGIN "+ee.username+":"+ee.password+" VERSION="+t+"\r\n"))})}else if(V===r.authenticating){var a=e.charAt(0);"+"===a?(V=r.authenticated,i("events",{event:"login success"})):"-"===a&&(b(),i("events",{event:"login fail"}))}V===r.authenticated&&J.push(e)}function g(e){var t=e.reduce(function(e,t){return e.concat(c.keys(t))},[]);return u.unique(t)}function P(e,t){var r=Z[e]||[];return r.some(function(e){return k(e,t)})}function k(e,t){return t.some(function(t){return t.hasOwnProperty(e)&&0!==t[e].length})}function w(e,t){Z.hasOwnProperty(t)||(Z[t]=[]);var r=Z[t];r.some(function(t){return t===e})||r.push(e)}function I(e){var t=Z[e]||[],r=t.filter(function(e){return k(e,[Q.marketDepth,Q.marketUpdate,Q.cumulativeVolume])});return r}function _(){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,a){var o=r,u=s.symbolParser.getProducerSymbol(o),c=a.concat(t),l=P(u,c),f=void 0;t[o]=i(t[o]||[]),f=P(u,c),l&&!f&&n(e,u),X[u]=I(u)};switch(e){case"events":Q.events=i(Q.events);break;case"marketDepth":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('marketDepth', handler, symbol)");a("MD_STOP",Q.marketDepth,[]);break;case"marketUpdate":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('marketUpdate', handler, symbol)");a("MU_STOP",Q.marketUpdate,[Q.cumulativeVolume]);break;case"cumulativeVolume":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: off('cumulativeVolume', handler, symbol)");a("MU_STOP",Q.cumulativeVolume,[Q.marketUpdate]),z.getCumulativeVolume(r,function(e){e.off("events",t)});break;case"timestamp":Q.timestamp=i(Q.timestamp)}}function T(){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,o){var u=r,c=s.symbolParser.getProducerSymbol(u);w(u,c);var l=P(c,o.concat(a));a[u]=i(a[u]),l?n(t,c):n(e,c),X[c]=I(c)};switch(e){case"events":Q.events=i(Q.events);break;case"marketDepth":if(arguments.length<3)throw new Error("Invalid arguments. Invoke as follows: on('marketDepth', handler, symbol)");a("MD_GO","MD_REFRESH",Q.marketDepth),z.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("MU_GO","MU_REFRESH",Q.marketUpdate,[Q.cumulativeVolume]),z.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("MU_GO","MU_REFRESH",Q.cumulativeVolume,[Q.marketUpdate]),z.getCumulativeVolume(r,function(e){e.on("events",t)});break;case"timestamp":Q.timestamp=i(Q.timestamp)}}function O(e){switch(z.processMessage(e),e.type){case"BOOK":i("marketDepth",e);break;case"TIMESTAMP":i("timestamp",z.getTimestamp());break;default:i("marketUpdate",e)}}function S(e){var t=void 0;try{if(t=f(e),t.type)if(t.symbol){var r=X[t.symbol]||[];$.hasOwnProperty(t.symbol)&&(r=u.unique(r.concat($[t.symbol])),delete $[t.symbol]),r.forEach(function(e){var r=void 0;e===t.symbol?r=t:(r=Object.assign({},t),r.symbol=e),O(r)})}else O(t);else console.log(e)}catch(n){console.error(n),console.log(t)}}function C(){if((V===r.authenticating||V===r.authenticated)&&B){var e=Y.shift();if(V===r.authenticating&&e&&0===e.indexOf("GO"))console.log("pushing back GO command until fully authenticated."),Y.push(e);else for(;e;)console.log(e),B.send(e),e=Y.shift()}setTimeout(C,200)}function E(){for(var e=9,t=!1;!t;){var r=J.shift();if(r){var n=!1,i=1,a=-1,o=r.indexOf(d.etx),s=r.indexOf(d.lf);if(s>-1&&(o<0||s<o)?(a=s,i=2):o>-1&&(a=o),a>-1){var u=a+1;if(1==i&&(r.length<a+e+1?(J.length>0?J[0]=r+J[0]:(J.unshift(r),t=!0),n=!0):r.substr(a+1,1)==d.dc4&&(u+=e+1)),!n){var c=r.substring(0,u);2==i?c=c.trim():(a=c.indexOf(d.soh),a>0&&(c=c.substring(a))),c.length>0&&S(c),r=r.substring(u),r.length>0&&(J.length>0?J[0]=r+J[0]:J.unshift(r))}}else r.length>0&&(J.length>0?J[0]=r+J[0]:(J.unshift(r),t=!0))}else t=!0;0===J.length&&(t=!0)}setTimeout(E,125)}function x(){for(var e=K.shift();e;)y(e),e=K.shift();setTimeout(x,125)}function D(e){if(V===r.authenticated)for(;W.length>0;){var t=W.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_REFRESH":n="GO",i="b";break;case"MU_REFRESH":n="GO",i="sc";break;case"P_SNAPSHOT":n="GO",i="s";break;case"MD_STOP":n="STOP",i="Bb";break;case"MU_STOP":n="STOP",i="Ssc"}var a=u.unique(t.symbols),o=void 0;for(o="MD_GO"===t.id||"MD_STOP"===t.id?1:250;a.length>0;){var s=a.splice(0,o);Y.push(n+" "+s.join(",")+"="+i)}}}e||j(!1)}function M(){if(V===r.authenticated&&0===Y.length){W=[];var e=function(e){for(var t=[];0!==e.length;)t.push(e.splice(0,250));return t},t=e(g([Q.marketUpdate,Q.cumulativeVolume]));t.forEach(function(e){Y.push("GO "+e.join(",")+"=sc")});e(g([Q.marketDepth]));t.forEach(function(e){Y.push("GO "+e.join(",")+"=b")});var n=e(u.unique(c.keys($)).filter(function(e){return!t.some(function(t){return t===e})}));n.forEach(function(e){Y.push("GO "+e.join(",")+"=s")})}j(!0)}function N(e){q!==e&&(q=e)}function A(){return g([Q.marketDepth,Q.marketUpdate,Q.cumulativeVolume]).length}function j(e){var t=void 0,r=void 0;q?(e||(o(),D(!0)),t=M,r=q):(e&&a(),t=D,r=250),setTimeout(t,r)}function U(e,t,r){L=!1,v(e,t,r)}function F(){L=!0,ee.username=null,ee.password=null,ee.server=null,b()}function R(e){var t=s.symbolParser.getProducerSymbol(e),r=$[t]||[];r.some(function(t){return t===e})||r.push(e),r.some(function(e){return e===t})||r.push(t),$[t]=r,n("P_SNAPSHOT",t)}var z=e,V=r.disconnected,L=!1,q=null,B=null,H=null,G=null,X={},Z={},$={},Q={marketDepth:{},marketUpdate:{},cumulativeVolume:{},events:[],timestamp:[]},W=[],Y=[],J=[],K=[],ee={username:null,password:null,server:null},te=void 0;return te=m.TextDecoder?new TextDecoder:{decode:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},setTimeout(C,200),setTimeout(x,125),setTimeout(E,125),setTimeout(j,250),{connect:U,disconnect:F,off:_,on:T,getActiveSymbolCount:A,setPollingFrequency:N,handleProfileRequest:R}}var t=4,r={connecting:"CONNECTING",authenticating:"LOGGING_IN",authenticated:"LOGGED_IN",disconnected:"DISCONNECTED"},d={soh:"",etx:"",lf:"\n",dc4:""},p=5e3,h=1e4,v=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),o(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}(l);return v}()},{"./../../../common/lang/array":1,"./../../../common/lang/object":2,"./../../../messageParser/parseMessage":14,"./../../ConnectionBase":4,"@barchart/marketdata-utilities-js":32}],7:[function(e,t,r){"use strict";var n=e("./connection/index"),i=e("./marketState/index"),a=e("./messageParser/index"),o=e("./util/index");t.exports=function(){return{Connection:n,MarketState:i,MessageParser:a,messageParser:a,Util:o,util:o,version:"3.1.16"}}()},{"./connection/index":5,"./marketState/index":12,"./messageParser/index":13,"./util/index":23}],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("./../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)o(this,this._handlers,s(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)o(this,this._handlers,s(this._priceLevels,n.toString(),n));this._lowPrice=e}}else this._lowPrice=this._highPrice=e;var i=e.toString(),a=this._priceLevels[i];a||(a=s(this._priceLevels,i,e)),a.volume+=t,o(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)}},o=function(e,t,n){t.forEach(function(t){r(e,t,n)})},s=function(e,t,r){var n={price:r,volume:0};return e[t]=n,n};return t}()},{"./../common/lang/object":2}],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("@barchart/marketdata-utilities-js"),o=e("./CumulativeVolume"),s=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=o.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=s.Profiles[e];if(!t){var r=a.symbolParser.getProducerSymbol(e),n=s.Profiles[r];n&&(t=new s(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 o(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 s(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 o}},{key:"Profile",get:function(){return s}},{key:"Quote",get:function(){return u}}]),t}();return t}()},{"./../util/convertDayCodeToNumber":20,"./CumulativeVolume":8,"./Profile":10,"./Quote":11,"@barchart/marketdata-utilities-js":32}],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}}(),a=e("./../util/parseSymbolType"),o=e("./../util/priceFormatter");t.exports=function(){var e={},t=o("-",!0,",").format,r=function(){function r(t,i,o,s,u,c){n(this,r),this.symbol=t,this.name=i,this.exchange=o,this.unitCode=s,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=o(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":25,"./../util/priceFormatter":26}],11:[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}()},{}],12:[function(e,t,r){"use strict";var n=e("./MarketState");t.exports=function(){return n}()},{"./MarketState":9}],13:[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":14,"./parseTimestamp":15,"./parseValue":16}],14:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.messageParser}()},{"@barchart/marketdata-utilities-js":32}],15:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.timestampParser}()},{"@barchart/marketdata-utilities-js":32}],16:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.priceParser}()},{"@barchart/marketdata-utilities-js":32}],17:[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 o=JSON.parse(a);o&&o.instrument&&o.instrument.symbol?t(o.instrument.symbol):r("The server was unable to resolve symbol "+e+".")}})}catch(a){r(a)}})})}}()},{xhr:47}],18:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.baseCodeToUnitCode}()},{"@barchart/marketdata-utilities-js":32}],19:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.dateToDayCode}()},{"@barchart/marketdata-utilities-js":32}],20:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.dayCodeToNumber}()},{"@barchart/marketdata-utilities-js":32}],21:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.convert.unitCodeToBaseCode}()},{"@barchart/marketdata-utilities-js":32}],22:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.decimalFormatter}()},{"@barchart/marketdata-utilities-js":32}],23:[function(e,t,r){"use strict";var n=e("./convertBaseCodeToUnitCode"),i=e("./convertDateToDayCode"),a=e("./convertDayCodeToNumber"),o=e("./convertUnitCodeToBaseCode"),s=e("./decimalFormatter"),u=e("./monthCodes"),c=e("./parseSymbolType"),l=e("./priceFormatter"),f=e("./symbolResolver"),m=e("./timeFormatter");t.exports=function(){return{convertBaseCodeToUnitCode:n,convertUnitCodeToBaseCode:o,convertDateToDayCode:i,convertDayCodeToNumber:a,decimalFormatter:s,monthCodes:u,parseSymbolType:c,symbolResolver:f,BaseCode2UnitCode:n,DateToDayCode:i,DayCodeToNumber:a,MonthCodes:u,ParseSymbolType:c,PriceFormatter:l,TimeFormatter:m,UnitCode2BaseCode:o}}()},{"./convertBaseCodeToUnitCode":18,"./convertDateToDayCode":19,"./convertDayCodeToNumber":20,"./convertUnitCodeToBaseCode":21,"./decimalFormatter":22,"./monthCodes":24,"./parseSymbolType":25,"./priceFormatter":26,"./symbolResolver":17,"./timeFormatter":27}],24:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.monthCodes.getCodeToNameMap()}()},{"@barchart/marketdata-utilities-js":32}],25:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.symbolParser.parseInstrumentType}()},{"@barchart/marketdata-utilities-js":32}],26:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.priceFormatter}()},{"@barchart/marketdata-utilities-js":32}],27:[function(e,t,r){"use strict";var n=e("@barchart/marketdata-utilities-js");t.exports=function(){return n.timeFormatter}()},{"@barchart/marketdata-utilities-js":32}],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")}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}()},{}],29:[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 o=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}}(),s=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),o(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}(s);return e}()},{"./../XmlDomParserBase":28}],30:[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}}}()},{}],31:[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 o=e.toFixed(t);if(!r||e>-1e3&&e<1e3)a&&(o="("+o+")");else{for(var s=o.length,u=e<0,c=0===t,l=0,f=[],m=s-1;!(m<0);m--){3!==l||u&&0===m||(f.unshift(r),l=0);var d=o.charAt(m);f.unshift(d),c?l+=1:"."===d&&(c=!0)}a&&(f.unshift("("),f.push(")")),o=f.join("")}return o}}()},{"lodash.isnan":44}],32:[function(e,t,r){"use strict";var n=e("./convert"),i=e("./decimalFormatter"),a=e("./messageParser"),o=e("./monthCodes"),s=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:o,messageParser:a,priceFormatter:s,symbolParser:c,priceParser:l,symbolFormatter:u,timeFormatter:f,timestampParser:m}}()},{"./convert":30,"./decimalFormatter":31,"./messageParser":33,"./monthCodes":34,"./priceFormatter":35,"./priceParser":36,"./symbolFormatter":37,"./symbolParser":38,"./timeFormatter":39,"./timestampParser":40}],33:[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 o=new a;r=o.parse(e.substring(1))}catch(s){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 D=new Date(C.getFullYear(),C.getMonth(),C.getDate(),12,0,0,0);x=C.getTime()>D.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 N=u.attributes.getNamedItem("data");if(N){for(var A=N.value||"",j=A.split(":"),U=0;U<j.length;U++){var F=j[U],R=F.split(",");j[U]={price:n(R[0],t.unitCode),volume:parseInt(R[1])}}j.sort(function(e,t){return e.price-t.price}),t.priceLevels=j}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"C":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 V=e.indexOf(",",z+7);switch(t.value=n(e.substring(z+7,V),t.unitcode),t.element=e.substr(V+1,1),t.modifier=e.substr(V+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(V+3,1),t.session=e.substr(V+4,1),t.time=i(e.substr(e.indexOf("")+1,9));break;case"1":case"2":case"3":case"4":var L=e.substring(z+8).split(",");t.openPrice=n(L[0],t.unitcode),t.highPrice=n(L[1],t.unitcode),t.lowPrice=n(L[2],t.unitcode),t.lastPrice=n(L[3],t.unitcode),t.bidPrice=n(L[4],t.unitcode),t.askPrice=n(L[5],t.unitcode),t.previousPrice=n(L[7],t.unitcode),t.settlementPrice=n(L[10],t.unitcode),t.volume=L[13].length>0?parseInt(L[13]):void 0,t.openInterest=L[12].length>0?parseInt(L[12]):void 0,t.day=L[14].substr(0,1),t.session=L[14].substr(1,1),t.time=i(e.substr(e.indexOf("")+1,9)),t.type="REFRESH_DDF";break;case"7":var q=e.indexOf(",",z+7);t.tradePrice=n(e.substring(z+7,q),t.unitcode),z=q+1,q=e.indexOf(",",z),t.tradeSize=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="TRADE";break;case"8":var B=e.indexOf(",",z+7);t.bidPrice=n(e.substring(z+7,B),t.unitcode),z=B+1,B=e.indexOf(",",z),t.bidSize=parseInt(e.substring(z,B)),z=B+1,B=e.indexOf(",",z),t.askPrice=n(e.substring(z,B),t.unitcode),z=B+1,B=e.indexOf(",",z),t.askSize=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="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(","),Z=0;Z<X.length;Z++){var $=X[Z].split(/[A-Z]/),Q=X[Z].substr($[0].length,1);Q<="J"?t.asks.push({price:n($[0],t.unitcode),size:parseInt($[1])}):t.bids.push({price:n($[0],t.unitcode),size:parseInt($[1])})}t.type="BOOK"}break;default:t.type="UNKNOWN"}}return t}}()},{"./common/xml/XmlDomParser":29,"./priceParser":36,"./timestampParser":40}],34:[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}}}()},{}],35:[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,o){function s(e){var r=Math.floor(e);return 0===r&&""===t?"":r}function u(e,t){return i(e,t,a,o)}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?o===!0?(m="(",d=")"):(m="-",d=""):(m="",d=""),a){case"2":return[m,s(l),t,e(8*(l-Math.floor(l)),1),d].join("");case"3":return[m,s(l),t,e(16*(l-Math.floor(l)),2),d].join("");case"4":return[m,s(l),t,e(32*(l-Math.floor(l)),2),d].join("");case"5":return[m,s(l),t,e((l-Math.floor(l))*(r?320:64),r?3:2),d].join("");case"6":return[m,s(l),t,e((l-Math.floor(l))*(r?320:128),3),d].join("");case"7":return[m,s(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":31,"lodash.isnan":44}],36:[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)}}}}()},{}],37:[function(e,t,r){"use strict";t.exports=function(){return{format:function(e){return null!==e&&"string"==typeof e?e.toUpperCase():e}}}()},{}],38:[function(e,t,r){"use strict";t.exports=function(){function e(e,t){var r=v.parseInstrumentType(e);return null!==r&&r.type===t}function t(e){var t=new Date,r=t.getFullYear(),n=parseInt(e);if(n<10){var i=n<r%10?1:0;n=10*Math.floor(r/10)+n+10*i}else if(n<100&&(n=100*Math.floor(r/100)+n,n<r)){var a=n+100;r-n>a-r&&(n=a)}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=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z]{1})([0-9]{4}|[0-9]{1,2})$/i,a=/^([A-Z][A-Z0-9\$\-!\.]{0,2})(\*{1})([0-9]{1})$/i,o=/^_S_/i,s=/^([A-Z][A-Z0-9\$\-!\.]?)([A-Z])([0-9]{1,4})([A-Z])$/i,u=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{1,4})\|(\-?[0-9]{1,5})(C|P)$/i,c=/^([A-Z][A-Z0-9\$\-!\.]{0,2})([A-Z])([0-9]{2})([0-9]{1,5})(C|P)$/i,l=/^\^([A-Z]{3})([A-Z]{3})$/i,f=/^\-(.*)$/i,m=/^\$(.*)$/i,d=/^(.*)\.BZ$/i,p=/(\.RT)$/,h={A:"F",B:"G",C:"H",D:"J",E:"K",I:"M",L:"N",O:"Q",P:"U",R:"V",S:"X",T:"Z"},v={parseInstrumentType:function(e){if("string"!=typeof e)return null;var n=e.match(r);if(null!==n&&(e=n[1]),o.test(e))return{symbol:e,type:"future_spread"};var d=e.match(i);if(null!==d)return{symbol:e,type:"future",root:d[1],dynamic:!1,month:d[2],year:t(d[3])};var p=e.match(a);if(null!==p)return{symbol:e,type:"future",root:p[1],dynamic:!0,dynamicCode:p[3]};var v=e.match(l);if(null!==v)return{symbol:e,type:"forex"};var b=e.match(m);if(null!==b)return{symbol:e,type:"index"};var y=e.match(f);if(null!==y)return{symbol:e,type:"sector"};var g=e.match(s);if(null!==g){var P=new Date,k=P.getFullYear(),w=void 0,I=void 0;return g[4]>="P"?(I=k+(g[4].charCodeAt(0)-"P".charCodeAt(0)),w="put"):(I=k+(g[4].charCodeAt(0)-"C".charCodeAt(0)),w="call"),{symbol:e,type:"future_option",root:g[1],month:g[2],year:I,strike:parseInt(g[3]),option_type:w}}var _=e.match(u),T=null!==_?_:e.match(c);if(null!==T){var O=T[2];return{symbol:e,type:"future_option",root:T[1],month:h.hasOwnProperty(O)?h[O]:O,year:t(T[3]),strike:parseInt(T[4]),option_type:"C"===T[5]?"call":"put"}}return null},getIsConcrete:function(e){return!v.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 d.test(e)},getProducerSymbol:function(e){if("string"==typeof e){var t=v.parseInstrumentType(e);if(null!==t&&"future_option"===t.type){var r=new Date,i=r.getFullYear(),a="call"===t.option_type?"C":"P",o=String.fromCharCode(a.charCodeAt(0)+(t.year-i));if(t.root.length<3)return t.root+t.month+t.strike+o;var s=t.year.toString().substr(-1);return t.root+t.month+s+"|"+t.strike+a}return e.replace(n,"$1$2$4")}return null},displayUsingPercent:function(e){return p.test(e)}};return v}()},{}],39:[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,o){var s=void 0;s=a?o?t:e:o?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=s(e),t&&(r=r+" "+t)):r="",r},formatDate:function(e){return e?i(e.getMonth()+1)+"/"+i(e.getDate())+"/"+i(e.getFullYear()):""}};return u}}()},{}],40:[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,o=e.charCodeAt(6)-64,s=(255&e.charCodeAt(7))+((255&e.charCodeAt(8))<<8);return new Date(t,r,n,i,a,o,s)}}()},{}],41:[function(e,t,r){function n(e,t,r){if(!s(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):o(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 o(e,t,r){for(var n in e)c.call(e,n)&&t.call(r,e[n],n,e)}var s=e("is-function");t.exports=n;var u=Object.prototype.toString,c=Object.prototype.hasOwnProperty},{"is-function":43}],42:[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:{})},{}],43:[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},{}],44:[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)==o}var o="[object Number]",s=Object.prototype,u=s.toString;t.exports=i},{}],45:[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(),o=n(e.slice(r+1));"undefined"==typeof t[i]?t[i]=o:a(t[i])?t[i].push(o):t[i]=[t[i],o]}),t}},{"for-each":41,trim:46}],46:[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*$/,"")}},{}],47:[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 o(e,t,r){return t=a(e,t,r),s(t)}function s(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 s=!1,c=function(t,r,n){s||(s=!0,e.callback(t,r,n))},l=e.xhr||null;l||(l=e.cors||e.useXDR?new o.XDomainRequest:new o.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=o,o.XMLHttpRequest=l.XMLHttpRequest||c,o.XDomainRequest="withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:l.XDomainRequest,n(["get","put","post","patch","head","delete"],function(e){o["delete"===e?"del":e]=function(t,r,n){return r=a(t,r,n),r.method=e.toUpperCase(),s(r)}})},{"global/window":42,"is-function":43,"parse-headers":45,xtend:48}],48:[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},{}]},{},[7])(7)});

@@ -0,0 +0,0 @@ var gulp = require('gulp');

@@ -0,0 +0,0 @@ module.exports = (() => {

@@ -0,0 +0,0 @@ const Connection = require('./websocket/Connection');

@@ -0,0 +0,0 @@ const MarketState = require('./../marketState/MarketState');

@@ -0,0 +0,0 @@ const Connection = require('./Connection');

@@ -0,0 +0,0 @@ module.exports = (() => {

const utilities = require('@barchart/marketdata-utilities-js');
const object = require('./../../../common/lang/object');
const array = require('./../../../common/lang/array'),
object = require('./../../../common/lang/object');

@@ -44,20 +45,19 @@ const ConnectionBase = require('./../../ConnectionBase'),

let __producerSymbols = {};
let __marketDepthSymbols = {};
let __marketUpdateSymbols = {};
let __cumulativeVolumeSymbols = {};
let __profileLookupSymbols = {};
let __activeConsumerSymbols = {};
let __knownConsumerSymbols = {};
let __tasks = [];
let __commands = [];
let __feedMessages = [];
let __networkMessages = [];
let __pendingProfileLookups = {};
const __listeners = {
events: [],
marketDepth: {},
marketUpdate: {},
cumulativeVolume: {},
events: [],
timestamp: []
};
let __tasks = [];
let __commands = [];
let __feedMessages = [];
let __networkMessages = [];

@@ -70,6 +70,7 @@ const __loginInfo = {

var __decoder = undefined;
if (_window.TextDecoder)
let __decoder;
if (_window.TextDecoder) {
__decoder = new TextDecoder();
else {
} else {
__decoder = {

@@ -79,3 +80,3 @@ decode: function (arr) {

}
}
};
}

@@ -117,11 +118,7 @@

function enqueueGoTasks() {
object.keys(__marketUpdateSymbols).forEach((symbol) => {
getProducerSymbols([__listeners.marketUpdate, __listeners.cumulativeVolume]).forEach((symbol) => {
addTask('MU_GO', symbol);
});
object.keys(__cumulativeVolumeSymbols).forEach((symbol) => {
addTask('MU_GO', symbol);
});
object.keys(__marketDepthSymbols).forEach((symbol) => {
getProducerSymbols([__listeners.marketDepth]).forEach((symbol) => {
addTask('MD_GO', symbol);

@@ -132,13 +129,9 @@ });

function enqueueStopTasks() {
object.keys(__marketUpdateSymbols).forEach((symbol) => {
getProducerSymbols([__listeners.marketUpdate, __listeners.cumulativeVolume]).forEach((symbol) => {
addTask('MU_STOP', symbol);
});
object.keys(__cumulativeVolumeSymbols).forEach((symbol) => {
getProducerSymbols([__listeners.marketDepth]).forEach((symbol) => {
addTask('MU_STOP', symbol);
});
object.keys(__marketDepthSymbols).forEach((symbol) => {
addTask('MU_STOP', symbol);
});
}

@@ -217,3 +210,2 @@

setTimeout(() => {
connect(__loginInfo.server, __loginInfo.username, __loginInfo.password);

@@ -229,12 +221,13 @@

__connection.onmessage = (evt) => {
__lastMessageTime = 1;
if (evt.data instanceof ArrayBuffer) {
var msg = __decoder.decode(evt.data);
if (msg)
let msg = __decoder.decode(evt.data);
if (msg) {
__networkMessages.push(msg);
}
} else {
__networkMessages.push(evt.data);
}
else
__networkMessages.push(evt.data);
};

@@ -255,3 +248,3 @@

if (__watchdog != null) {
if (__watchdog !== null) {
_window.clearInterval(__watchdog);

@@ -271,6 +264,2 @@ }

__feedMessages = [];
__marketDepthSymbols = {};
__marketUpdateSymbols = {};
__cumulativeVolumeSymbols = {};
}

@@ -309,2 +298,42 @@

function getProducerSymbols(listenerMaps) {
const producerSymbols = listenerMaps.reduce((symbols, listenerMap) => {
return symbols.concat(object.keys(listenerMap));
}, [ ]);
return array.unique(producerSymbols);
}
function getProducerListenerExists(producerSymbol, listenerMaps) {
const consumerSymbols = __knownConsumerSymbols[producerSymbol] || [ ];
return consumerSymbols.some(consumerSymbol => getConsumerListenerExists(consumerSymbol, listenerMaps));
}
function getConsumerListenerExists(consumerSymbol, listenerMaps) {
return listenerMaps.some(listenerMap => listenerMap.hasOwnProperty(consumerSymbol) && listenerMap[consumerSymbol].length !== 0);
}
function addKnownConsumerSymbol(consumerSymbol, producerSymbol) {
if (!__knownConsumerSymbols.hasOwnProperty(producerSymbol)) {
__knownConsumerSymbols[producerSymbol] = [ ];
}
const consumerSymbols = __knownConsumerSymbols[producerSymbol];
if (!consumerSymbols.some(candidate => candidate === consumerSymbol)) {
consumerSymbols.push(consumerSymbol);
}
}
function getActiveConsumerSymbols(producerSymbol) {
const knownConsumerSymbols = __knownConsumerSymbols[producerSymbol] || [ ];
const activeConsumerSymbols = knownConsumerSymbols.filter((knownConsumerSymbol) => {
return getConsumerListenerExists(knownConsumerSymbol, [ __listeners.marketDepth, __listeners.marketUpdate, __listeners.cumulativeVolume ]);
});
return activeConsumerSymbols;
}
function off() {

@@ -327,3 +356,3 @@ if (arguments.length < 2) {

const removeHandler = (listeners) => {
const listenersToFilter = (listeners || []);
const listenersToFilter = listeners || [];

@@ -335,57 +364,20 @@ return listenersToFilter.filter((candidate) => {

const getConsumerIsActive = (consumerSymbol, listenerMaps) => {
return listenerMaps.reduce((active, listenerMap) => {
return active || listenerMap.hasOwnProperty(consumerSymbol);
}, false);
};
const unsubscribe = (trackingMap, taskName, listenerMap, additionalTrackingMaps, additionalListenerMaps) => {
const unsubscribe = (stopTaskName, listenerMap, sharedListenerMaps) => {
const consumerSymbol = symbol;
const producerSymbol = utilities.symbolParser.getProducerSymbol(consumerSymbol);
const previousListeners = listenerMap[consumerSymbol] || [];
const currentListeners = removeHandler(previousListeners);
const listenerMaps = sharedListenerMaps.concat(listenerMap);
listenerMap[consumerSymbol] = currentListeners;
let previousProducerListenerExists = getProducerListenerExists(producerSymbol, listenerMaps);
let currentProducerListenerExists;
if (previousListeners.length > 0 && currentListeners.length === 0) {
delete listenerMap[consumerSymbol];
listenerMap[consumerSymbol] = removeHandler(listenerMap[consumerSymbol] || []);
let stopConsumer = true;
let stopProducer = true;
currentProducerListenerExists = getProducerListenerExists(producerSymbol, listenerMaps);
let consumerSymbols = __producerSymbols[producerSymbol] || [];
if (previousProducerListenerExists && !currentProducerListenerExists) {
addTask(stopTaskName, producerSymbol);
}
if (!getConsumerIsActive(consumerSymbol, additionalListenerMaps)) {
stopConsumer = true;
}
if (stopConsumer) {
consumerSymbols = consumerSymbols.filter((candidate) => {
const returnVal = candidate !== consumerSymbol;
if (!returnVal && getConsumerIsActive(candidate, [listenerMap])) {
stopProducer = false;
}
return returnVal;
});
__producerSymbols[producerSymbol] = consumerSymbols;
}
if (stopProducer) {
delete trackingMap[producerSymbol];
additionalTrackingMaps.forEach((map) => {
if (map.hasOwnProperty(producerSymbol)) {
stopProducer = false;
}
});
if (stopProducer) {
addTask(taskName, producerSymbol);
}
}
}
__activeConsumerSymbols[producerSymbol] = getActiveConsumerSymbols(producerSymbol);
};

@@ -403,3 +395,3 @@

unsubscribe(__marketDepthSymbols, "MD_STOP", __listeners.marketDepth, [], []);
unsubscribe("MD_STOP", __listeners.marketDepth, []);

@@ -412,3 +404,3 @@ break;

unsubscribe(__marketUpdateSymbols, "MU_STOP", __listeners.marketUpdate, [__cumulativeVolumeSymbols], [__listeners.cumulativeVolume]);
unsubscribe("MU_STOP", __listeners.marketUpdate, [__listeners.cumulativeVolume]);

@@ -421,3 +413,3 @@ break;

unsubscribe(__cumulativeVolumeSymbols, "MU_STOP", __listeners.cumulativeVolume, [__marketUpdateSymbols], [__listeners.marketUpdate]);
unsubscribe("MU_STOP", __listeners.cumulativeVolume, [__listeners.marketUpdate]);

@@ -452,3 +444,3 @@ __marketState.getCumulativeVolume(symbol, (container) => {

const addHandler = (listeners) => {
const addListener = (listeners) => {
listeners = listeners || [];

@@ -472,32 +464,19 @@

const subscribe = (trackingMap, taskName, listenerMap, additionalTrackingMaps) => {
const subscribe = (streamingTaskName, snapshotTaskName, listenerMap, sharedListenerMaps) => {
const consumerSymbol = symbol;
const producerSymbol = utilities.symbolParser.getProducerSymbol(consumerSymbol);
listenerMap[consumerSymbol] = addHandler(listenerMap[consumerSymbol]);
addKnownConsumerSymbol(consumerSymbol, producerSymbol);
let consumerSymbols = __producerSymbols[producerSymbol] || [];
const producerListenerExists = getProducerListenerExists(producerSymbol, sharedListenerMaps.concat(listenerMap));
let startConsumer = !consumerSymbols.some((candidate) => {
return candidate === consumerSymbol;
});
listenerMap[consumerSymbol] = addListener(listenerMap[consumerSymbol]);
if (startConsumer) {
consumerSymbols = consumerSymbols.slice(0);
consumerSymbols.push(consumerSymbol);
__producerSymbols[producerSymbol] = consumerSymbols;
if (producerListenerExists) {
addTask(snapshotTaskName, producerSymbol);
} else {
addTask(streamingTaskName, producerSymbol);
}
if (!trackingMap[producerSymbol]) {
trackingMap[producerSymbol] = true;
let startProducer = !additionalTrackingMaps.some((additionalTrackingMap) => {
return additionalTrackingMap[producerSymbol];
});
if (startProducer) {
addTask(taskName, producerSymbol);
}
}
__activeConsumerSymbols[producerSymbol] = getActiveConsumerSymbols(producerSymbol);
};

@@ -507,3 +486,3 @@

case 'events':
__listeners.events = addHandler(__listeners.events);
__listeners.events = addListener(__listeners.events);
break;

@@ -515,3 +494,3 @@ case 'marketDepth':

subscribe(__marketDepthSymbols, "MD_GO", __listeners.marketDepth, []);
subscribe("MD_GO", "MD_REFRESH", __listeners.marketDepth);

@@ -528,3 +507,3 @@ if (__marketState.getBook(symbol)) {

subscribe(__marketUpdateSymbols, "MU_GO", __listeners.marketUpdate, [__cumulativeVolumeSymbols]);
subscribe("MU_GO", "MU_REFRESH", __listeners.marketUpdate, [__listeners.cumulativeVolume]);

@@ -541,3 +520,3 @@ if (__marketState.getQuote(symbol)) {

subscribe(__cumulativeVolumeSymbols, "MU_GO", __listeners.cumulativeVolume, [__marketUpdateSymbols]);
subscribe("MU_GO", "MU_REFRESH", __listeners.cumulativeVolume, [__listeners.marketUpdate]);

@@ -550,3 +529,3 @@ __marketState.getCumulativeVolume(symbol, (container) => {

case 'timestamp':
__listeners.timestamp = addHandler(__listeners.timestamp);
__listeners.timestamp = addListener(__listeners.timestamp);
break;

@@ -580,8 +559,8 @@ }

if (message.symbol) {
let consumerSymbols = __producerSymbols[message.symbol] || [];
let consumerSymbols = __activeConsumerSymbols[message.symbol] || [];
if (__profileLookupSymbols.hasOwnProperty(message.symbol)) {
consumerSymbols = consumerSymbols.concat(__profileLookupSymbols[message.symbol]).filter((item, index, array) => array.indexOf(item) === index);
if (__pendingProfileLookups.hasOwnProperty(message.symbol)) {
consumerSymbols = array.unique(consumerSymbols.concat(__pendingProfileLookups[message.symbol]));
delete __profileLookupSymbols[message.symbol];
delete __pendingProfileLookups[message.symbol];
}

@@ -615,3 +594,2 @@

if ((__state === state.authenticating || __state === state.authenticated) && __connection) {
let command = __commands.shift();

@@ -757,2 +735,14 @@

break;
case 'MD_REFRESH':
command = 'GO';
suffix = 'b';
break;
case 'MU_REFRESH':
command = 'GO';
suffix = 'sc';
break;
case 'P_SNAPSHOT':
command = 'GO';
suffix = 's';
break;
case 'MD_STOP':

@@ -766,9 +756,5 @@ command = 'STOP';

break;
case 'P_SNAPSHOT':
command = 'GO';
suffix = 's';
break;
}
const unique = task.symbols.filter((item, index, array) => array.indexOf(item) === index);
const uniqueSymbols = array.unique(task.symbols);

@@ -783,4 +769,4 @@ let batchSize;

while (unique.length > 0) {
const batch = unique.splice(0, batchSize);
while (uniqueSymbols.length > 0) {
const batch = uniqueSymbols.splice(0, batchSize);

@@ -814,18 +800,18 @@ __commands.push(`${command} ${batch.join(',')}=${suffix}`);

const quoteBatches = getBatches(getUniqueSymbols([__marketUpdateSymbols, __cumulativeVolumeSymbols]));
const quoteBatches = getBatches(getProducerSymbols([__listeners.marketUpdate, __listeners.cumulativeVolume]));
quoteBatches.forEach((batch) => {
__commands.push('GO' + ' ' + batch.join(',') + '=' + 'sc');
__commands.push(`GO ${batch.join(',')}=sc`);
});
const bookBatches = getBatches(object.keys(__marketDepthSymbols));
const bookBatches = getBatches(getProducerSymbols([__listeners.marketDepth]));
quoteBatches.forEach((batch) => {
__commands.push('GO' + ' ' + batch.join(',') + '=' + 'b');
__commands.push(`GO ${batch.join(',')}=b`);
});
const profileBatches = getBatches(object.keys(__profileLookupSymbols)).filter(s => !quoteBatches.some(q => q === s));
const profileBatches = getBatches(array.unique(object.keys(__pendingProfileLookups)).filter(s => !quoteBatches.some(q => q === s)));
profileBatches.forEach((batch) => {
__commands.push('GO' + ' ' + batch.join(',') + '=' + 's');
__commands.push(`GO ${batch.join(',')}=s`);
});

@@ -845,16 +831,4 @@ }

function getUniqueSymbols(maps) {
return object.keys(maps.reduce((aggregator, map) => {
for (let k in map) {
if (map[k] === true) {
aggregator[k] = true;
}
}
return aggregator;
}, {}));
}
function getActiveSymbolCount() {
return getUniqueSymbols([__marketUpdateSymbols, __marketDepthSymbols, __cumulativeVolumeSymbols]).length;
return getProducerSymbols([__listeners.marketDepth, __listeners.marketUpdate, __listeners.cumulativeVolume]).length;
}

@@ -907,7 +881,17 @@

function handleProfileRequest(symbol) {
const producerSymbol = utilities.symbolParser.getProducerSymbol(symbol);
function handleProfileRequest(consumerSymbol) {
const producerSymbol = utilities.symbolParser.getProducerSymbol(consumerSymbol);
__profileLookupSymbols[producerSymbol] = [symbol, producerSymbol];
const pendingConsumerSymbols = __pendingProfileLookups[producerSymbol] || [ ];
if (!pendingConsumerSymbols.some(candidate => candidate === consumerSymbol)) {
pendingConsumerSymbols.push(consumerSymbol);
}
if (!pendingConsumerSymbols.some(candidate => candidate === producerSymbol)) {
pendingConsumerSymbols.push(producerSymbol);
}
__pendingProfileLookups[producerSymbol] = pendingConsumerSymbols;
addTask('P_SNAPSHOT', producerSymbol);

@@ -914,0 +898,0 @@ }

@@ -0,0 +0,0 @@ const ConnectionBase = require('./../ConnectionBase');

@@ -20,4 +20,4 @@ const connection = require('./connection/index'),

version: '3.1.15'
version: '3.1.16'
};
})();

@@ -0,0 +0,0 @@ const object = require('./../common/lang/object');

@@ -0,0 +0,0 @@ const MarketState = require('./MarketState');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const parseSymbolType = require('./../util/parseSymbolType'),

@@ -0,0 +0,0 @@ module.exports = (() => {

@@ -0,0 +0,0 @@ const parseMessage = require('./parseMessage'),

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const xhr = require('xhr');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const convertBaseCodeToUnitCode = require('./convertBaseCodeToUnitCode'),

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ module.exports = (() => {

@@ -0,0 +0,0 @@ const utilities = require('@barchart/marketdata-utilities-js');

@@ -0,0 +0,0 @@ Copyright Barchart.com, Inc., http://www.barchart.com/

{
"name": "@barchart/marketdata-api-js",
"version": "3.1.15",
"version": "3.1.16",
"description": "Barchart client library for streaming market data from JERQ servers using JavaScript",

@@ -5,0 +5,0 @@ "author": {

@@ -0,0 +0,0 @@ const Express = require('express'),

@@ -0,0 +0,0 @@ {

@@ -0,0 +0,0 @@ ## Example Proxy Server For Historical Data

@@ -0,0 +0,0 @@ # @barchart/marketdata-api-js

@@ -0,0 +0,0 @@ var CumulativeVolume = require('../../../lib/marketState/CumulativeVolume');

@@ -0,0 +0,0 @@ var Profile = require('../../../lib/marketState/Profile');

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc