Release v20.036 (from c941fd1a)
This commit is contained in:
@@ -223,7 +223,7 @@ r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].co
|
||||
;return!!this._endOfData[s]},P.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},P.prototype.serverTimeOffset=function(){return this._serverTimeOffset},P.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},P.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},e.exports=P},EX27:function(e,t,i){"use strict";var s=i("IiTo"),r=i("LxhU").Interval,n=i("EJcV"),o=i("MrEN"),a=i("XzZr"),l=a.ChartApiInterface,c=a.HandlerInfo,h=i("ogJP").requireFullInterfaceImplementation,u=i("txPx").getLogger("Chart.ChartApiLocal"),d=i("uDHo").TIMEFRAMETYPE,p=i("OLhd").createDwmAligner;function _(e,t,i){if(e[t])if(void 0!==i)e[t][i]&&(clearTimeout(e[t][i]),delete e[t][i]);else{for(var s in e[t])e[t].hasOwnProperty(s)&&_(e,t,s);delete e[t]}}function m(e,t,i,s){_(e,t,i),e[t]||(e[t]={}),e[t][i]=s}TradingView.STUDY_COUNT_LIMIT=210,JSServer.ChartApi=function(e){this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._seriesTimers={},this._studyTimers={},this._seriesTurnarounds={},this._connected=!1,this._enabled=!1,this._studyEngine=new n(e),this._callbacks={},this._symbolIdCache={},this._seriesIdCache={},this._enableLogging=!1,this._enabledMoreBarsRequest=!0,this._serverTimeOffset=0;var t=this;this._studyEngine.on("configuration_received",(function(){t._fireEvent("configuration_received")})),this._studyEngine.on("realtime_tick",(function(e){var i={time:e.value[0]/1e3,open:e.value[1],high:e.value[2],low:e.value[3],close:e.value[4],volume:e.value[5]};t._fireEvent("realtime_tick",i,!0)})),this._setVisibleRangeTimeout={}},JSServer.ChartApi.prototype._makeSymbolKey=function(e,t){if(!e||!t)throw Error("incorrect identifiers");return e+"_"+t},JSServer.ChartApi.prototype._makeSeriesKey=function(e,t){if(!e||!t)throw Error("incorrect identifiers");return e+"_"+t},JSServer.ChartApi.prototype.destroy=function(){this._studyEngine.destroy(),this._studyEngine=null},JSServer.ChartApi.prototype.purgeCache=function(e){this._studyEngine.purgeCache(),this._studyEngine.purgeDataCache(),this._symbolIdCache={},this._seriesIdCache={}},JSServer.ChartApi.prototype.setAdditionalBarsRequestEnabled=function(e){this._enabledMoreBarsRequest=e},JSServer.ChartApi.prototype.defaultWatchlistSymbols=function(){return this._watchlistSettings.default_symbols},JSServer.ChartApi.prototype.defaultResolutions=function(){return this._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]},JSServer.ChartApi.prototype.availableCurrencies=function(){var e=this._studyEngine.supportedCurrencies().map((function(e){return{id:e,code:e,convertible:!0}}));return Promise.resolve(e)},JSServer.ChartApi.prototype.availableUnits=function(){return Promise.resolve(this._studyEngine.supportedUnits())},JSServer.ChartApi.prototype.supportedSymbolsTypes=function(){return this._studyEngine.supportedSymbolsTypes()},
|
||||
JSServer.ChartApi.prototype.supportedExchangesList=function(){return this._studyEngine.supportedExchangesList()},JSServer.ChartApi.prototype.symbolsGrouping=function(){return this._studyEngine.symbolsGrouping()},JSServer.ChartApi.prototype.start=function(){this._enabled=!0,this._fireEvent("start_enabled")},JSServer.ChartApi.prototype._logMessage=function(e){this._enableLogging&&console.log(e)},JSServer.ChartApi.prototype.unsubscribe=function(e,t){var i=this._callbacks[e];i&&i.splice(i.indexOf(t),1)},JSServer.ChartApi.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},JSServer.ChartApi.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){var s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(var r=0;r<s.length;++r)s[r](t)}},JSServer.ChartApi.prototype.chartCreateSession=function(e,t){this._studyEngine.chartCreateSession(e),this._seriesTurnarounds[e]={}},JSServer.ChartApi.prototype.chartDeleteSession=function(e){this._studyEngine.chartDeleteSession(e)},JSServer.ChartApi.prototype.createSession=function(e,t){TradingView.ChartapiMessagerInstances[e]=new o(this,e),this._sessions[e]=t,this._notificationHandlers[e]={},this.connected()&&t.onMessage({method:"connected",params:[]})},JSServer.ChartApi.prototype.removeSession=function(e){delete this._sessions[e],delete this._notificationHandlers[e],this._studyEngine.stopSources(e),_(this._seriesTimers,e),_(this._studyTimers,e)},JSServer.ChartApi.prototype.connected=function(){return this._connected},JSServer.ChartApi.prototype.connect=function(){if(this._enabled)this.connected()||(this._connected=!0,this.sessionid="dummy session id",this._notifySessions({method:"connected",params:[]}));else{var e=this;this.on("start_enabled",(function(){e.connect()}))}},JSServer.ChartApi.prototype.disconnect=function(){this._connected=!1,this._notifySessions({method:"disconnected",params:[]}),this.purgeCache(),this.studyCounter=0},JSServer.ChartApi.prototype.switchTimezone=function(e,t){this._studyEngine.switchTimezone(e,t)},JSServer.ChartApi.prototype.receiveLocalResponse=function(e){this._logMessage("< "+e.method),this._dispathNotification(e),this._fireEvent("message_"+e.method,void 0,!0)},JSServer.ChartApi.prototype.getMarks=function(e,t,i,s,r){this._studyEngine.getMarks(e,t,i,s,r)},JSServer.ChartApi.prototype.getTimescaleMarks=function(e,t,i,s,r){this._studyEngine.getTimescaleMarks(e,t,i,s,r)},JSServer.ChartApi.prototype.resolveSymbol=function(e,t,i,s,r){this._notificationHandlers[e][t]=new c(s,t),this._symbolIdCache[this._makeSymbolKey(e,t)]=null;var n=this;function o(t,s){void 0!==Object.keys(n._seriesIdCache).find((function(e){return n._seriesIdCache[e].symbolId===t}))&&n._studyEngine.onMainSeriesError(e),TradingView.ChartapiMessagerInstances[e].onSymbolError(t,s),n._symbolIdCache[n._makeSymbolKey(e,t)]={requestedSymbol:i,status:"invalid_symbol"},n._fireEvent("resolve_fail",{session:e,symbolId:t},!0),n._fireEvent(n._makeSymbolKey(e,t)+"_resolve_fail")}
|
||||
this._studyEngine.resolveSymbol(i,(function(s){s.errmsg?o(t,s.errmsg):(n._symbolIdCache[n._makeSymbolKey(e,t)]={requestedSymbol:i,symbolInfo:s,status:"ok"},n._fireEvent("symbol_resolved",{symbolInfo:s,symbolId:t,session:e},!0),n._fireEvent(n._makeSymbolKey(e,t)+"_resolved",s),TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,s))}),(function(e){o(t,e)}))},JSServer.ChartApi.prototype._doWhenSymbolIdIsReady=function(e,t,i){var s=this,r=!0;function n(){r&&(i({requestedSymbol:s._symbolIdCache[s._makeSymbolKey(e,t)].requestedSymbol,symbolInfo:s._symbolIdCache[s._makeSymbolKey(e,t)].symbolInfo}),r=!1,s.unsubscribe(s._makeSymbolKey(e,t)+"_resolved",n),s.unsubscribe(s._makeSymbolKey(e,t)+"_resolve_fail",n))}this._symbolIdCache[this._makeSymbolKey(e,t)]?n():(this.on(this._makeSymbolKey(e,t)+"_resolved",n),this.on(this._makeSymbolKey(e,t)+"_resolve_fail",n))},JSServer.ChartApi.prototype._doWhenSeriesDataReceived=function(e,t){TradingView.ChartapiMessagerInstances[e].seriesCompleted.subscribe(null,t,!0)},JSServer.ChartApi.prototype._doWhenSeriesSymbolIdIsReady=function(e,t,i,s){var r=this,n=this._seriesIdCache[e+"_"+t].symbolId;function o(){var t;i({requestedSymbol:(t=r._symbolIdCache[r._makeSymbolKey(e,n)]).requestedSymbol,symbolInfo:t.symbolInfo})}function a(){r.unsubscribe("symbol_resolved",c),r.unsubscribe("resolve_fail",l)}function l(t){t.symbolId===n&&t.session===e&&(a(),s&&s())}function c(t){t.symbolId===n&&t.session===e&&(a(),o())}this._symbolIdCache[this._makeSymbolKey(e,n)]?o():(this.on("symbol_resolved",c),this.on("resolve_fail",l))},JSServer.ChartApi.prototype.createSeries=function(e,t,i,s,r,n,o,a){i=i||"";var l=this;this._notificationHandlers[e][t]=new c((function(r){"series_completed"===r.method&&null!==o&&(l._applyTimeFrame(e,s,t,i,o),o=null),a(r)}),t),this._seriesIdCache[e+"_"+t]={symbolId:s,resolution:r,timeframe:o,turnaround:i},this._seriesTurnarounds[e][t]=i,this._doWhenSeriesSymbolIdIsReady(e,t,(function(s){l._seriesTurnarounds[e][t]===i&&l._studyEngine.createSeries(s.requestedSymbol,r,e,t,i,{countBack:n||300})}))},JSServer.ChartApi.prototype.removeSeries=function(e,t,i){this._notificationHandlers[e][t]=new c(i,t),this._studyEngine.removeSeries(e,t),_(this._seriesTimers,e,t)},JSServer.ChartApi.prototype.setVisibleTimeRange=function(e,t,i,s,r,n){var o=i,a=!0!==(r=r||{}).applyDefaultRightMargin&&void 0===r.percentRightMargin&&void 0!==s?s:null,l=p(this._studyEngine.getSeriesInterval(e,t),this._studyEngine.getSeriesSymbolInfo(e,t));null!==l&&(o=l.timeToSessionStart(1e3*o)/1e3,null!==a&&(a=l.timeToSessionStart(1e3*a)/1e3));var c=this._seriesIdCache[e+"_"+t].turnaround,h=this;function u(){var i=h._studyEngine.sessionTimeScale(e);if(null!==i){var s,l=i.indexOfTime(1e3*o);if(null===a)s=i.lastSessionBarIndex();else{var u=i.indexOfTime(1e3*a);s=u&&u.index}if(null!==l&&null!==s){var d=l.index;l.timeMs<1e3*o&&(d+=1),d>s||(TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(t,c,d,s,r),n&&setTimeout(n,0))}}}if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*i))u();else{
|
||||
var d=TradingView.ChartapiMessagerInstances[e].seriesCompleted,_=TradingView.ChartapiMessagerInstances[e].seriesError;void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=setTimeout(function(){delete this._setVisibleRangeTimeout[e],d.subscribe(null,m,!0),_.subscribe(null,f,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*i)}.bind(this),0)}function m(e,i){e===t&&i===c&&(d.unsubscribe(null,m),_.unsubscribe(null,f),u())}function f(e,i){e===t&&i===c&&d.unsubscribe(null,m)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,n,o){var a,l;if(o.type===d.PeriodBack){var c=this._studyEngine.getSeriesLastBarTime(e,i);if(null===c)return;l=c/1e3;var h=r.parse(o.value),u=this._symbolIdCache[this._makeSymbolKey(e,t)].symbolInfo;a=s.alignPeriodsBackForVisibleRange(u.session,u.holidays,u.corrections,h.letter(),h.multiplier(),1,c)/1e3;var _=p(this._studyEngine.getSeriesInterval(e,i),u);null!==_&&(l=_.timeToExchangeTradingDay(1e3*l)/1e3,a=_.timeToExchangeTradingDay(1e3*a)/1e3)}else a=o.from,l=o.to;this.setVisibleTimeRange(e,i,a,l,{applyDefaultRightMargin:!0})},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o,a){i=i||"";var l=this;this._notificationHandlers[e][t]=new c((function(r){"series_completed"===r.method&&null!==n&&(l._applyTimeFrame(e,s,t,i,n),n=null),o(r)}),t),this._seriesTurnarounds[e][t]=i,a&&(this._seriesIdCache[this._makeSeriesKey(e,a)]=null),this._seriesIdCache[this._makeSymbolKey(e,t)]={symbolId:s,resolution:r,turnaround:i},this._doWhenSeriesSymbolIdIsReady(e,t,(function(s){l._studyEngine.modifySeries(e,t,s.requestedSymbol,r,i)}))},JSServer.ChartApi.prototype.requestMoreData=function(e,t){if(this._enabledMoreBarsRequest){var i=this,s=setTimeout((function(){i._studyEngine.extendSeriesRange(e,t)}),0);m(this._seriesTimers,e,"requestMoreData",s)}},JSServer.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},JSServer.ChartApi.prototype.setWatchlistSettings=function(e){this._watchlistSettings=e},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(e,t,i){this._notificationHandlers[e][t]=new c(i,t);var s=this.studiesAccessController.getEnabledTools();TradingView.ChartapiMessagerInstances[e].onRequestMetadata(t,s)},JSServer.ChartApi.prototype.isCanCreateStudy=function(){return this.studyCounter<TradingView.STUDY_COUNT_LIMIT},JSServer.ChartApi.prototype.createStudy=function(e,t,i,s,r,n,o){if(!this.isCanCreateStudy())throw Error("Exceeded the limit of studies");var a=this;i=i||"",this._notificationHandlers[e][t]=new c(o,t);var l=this._seriesIdCache[this._makeSeriesKey(e,s)].symbolId;this._doWhenSymbolIdIsReady(e,l,(function(o){a._studyEngine.createStudy(e,t,s,i,r,n),a.studyCounter++}))},JSServer.ChartApi.prototype.rebindStudy=function(e,t,i,s,r,n,o,a){throw new Error("Not implemented")},JSServer.ChartApi.prototype.removeStudy=function(e,t){this._notificationHandlers[e][t]=null,
|
||||
var d=TradingView.ChartapiMessagerInstances[e].seriesCompleted,_=TradingView.ChartapiMessagerInstances[e].seriesError;void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=setTimeout(function(){delete this._setVisibleRangeTimeout[e],d.subscribe(null,m,!0),_.subscribe(null,f,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*i)}.bind(this),0)}function m(e,i){e===t&&i===c&&(d.unsubscribe(null,m),_.unsubscribe(null,f),u())}function f(e,i){e===t&&i===c&&d.unsubscribe(null,m)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,n,o){var a,l,c={};if(o.type===d.PeriodBack){var h=this._studyEngine.getSeriesLastBarTime(e,i);if(null===h)return;l=h/1e3;var u=r.parse(o.value),_=this._symbolIdCache[this._makeSymbolKey(e,t)].symbolInfo;a=s.alignPeriodsBackForVisibleRange(_.session,_.holidays,_.corrections,u.letter(),u.multiplier(),1,h)/1e3;var m=p(this._studyEngine.getSeriesInterval(e,i),_);null!==m&&(l=m.timeToExchangeTradingDay(1e3*l)/1e3,a=m.timeToExchangeTradingDay(1e3*a)/1e3),c={applyDefaultRightMargin:!0}}else a=o.from,l=o.to;this.setVisibleTimeRange(e,i,a,l,c)},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o,a){i=i||"";var l=this;this._notificationHandlers[e][t]=new c((function(r){"series_completed"===r.method&&null!==n&&(l._applyTimeFrame(e,s,t,i,n),n=null),o(r)}),t),this._seriesTurnarounds[e][t]=i,a&&(this._seriesIdCache[this._makeSeriesKey(e,a)]=null),this._seriesIdCache[this._makeSymbolKey(e,t)]={symbolId:s,resolution:r,turnaround:i},this._doWhenSeriesSymbolIdIsReady(e,t,(function(s){l._studyEngine.modifySeries(e,t,s.requestedSymbol,r,i)}))},JSServer.ChartApi.prototype.requestMoreData=function(e,t){if(this._enabledMoreBarsRequest){var i=this,s=setTimeout((function(){i._studyEngine.extendSeriesRange(e,t)}),0);m(this._seriesTimers,e,"requestMoreData",s)}},JSServer.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},JSServer.ChartApi.prototype.setWatchlistSettings=function(e){this._watchlistSettings=e},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(e,t,i){this._notificationHandlers[e][t]=new c(i,t);var s=this.studiesAccessController.getEnabledTools();TradingView.ChartapiMessagerInstances[e].onRequestMetadata(t,s)},JSServer.ChartApi.prototype.isCanCreateStudy=function(){return this.studyCounter<TradingView.STUDY_COUNT_LIMIT},JSServer.ChartApi.prototype.createStudy=function(e,t,i,s,r,n,o){if(!this.isCanCreateStudy())throw Error("Exceeded the limit of studies");var a=this;i=i||"",this._notificationHandlers[e][t]=new c(o,t);var l=this._seriesIdCache[this._makeSeriesKey(e,s)].symbolId;this._doWhenSymbolIdIsReady(e,l,(function(o){a._studyEngine.createStudy(e,t,s,i,r,n),a.studyCounter++}))},JSServer.ChartApi.prototype.rebindStudy=function(e,t,i,s,r,n,o,a){throw new Error("Not implemented")},JSServer.ChartApi.prototype.removeStudy=function(e,t){this._notificationHandlers[e][t]=null,
|
||||
this._studyEngine.removeStudy(e,t),this.studyCounter--,_(this._studyTimers,e,t)},JSServer.ChartApi.prototype.modifyStudy=function(e,t,i,s,r){var n=this,o=setTimeout((function(){i=i||"",n._notificationHandlers[e][t]=new c(r,t),n._studyEngine.recomputeStudy(t,s,e,i)}),0);m(this._studyTimers,e,t,o)},JSServer.ChartApi.prototype.createPointset=function(e,t,i,s,r,n,o){i=i||"",this._notificationHandlers[e][t]=new c(o,t);var a=this;this._doWhenSymbolIdIsReady(e,s,(function(i){a._studyEngine.createPointset(e,t,i.symbolInfo,r,n)}))},JSServer.ChartApi.prototype.modifyPointset=function(e,t,i,s,r){throw Error("This call is not implemented")},JSServer.ChartApi.prototype.removePointset=function(e,t,i){this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t)},JSServer.ChartApi.prototype.requestMoreTickmarks=function(e,t){this._studyEngine.requestMoreTickmarks(e,t)},JSServer.ChartApi.prototype.requestFirstBarTime=function(e,t,i,s){this._notificationHandlers[e][t]=new c(s,t)},JSServer.ChartApi.prototype._invokeHandler=function(e,t){e&&e(t)},JSServer.ChartApi.prototype._sendRequest=function(e,t){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._onMessage=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._dispathNotification=function(e){var t=e.params.shift();if(this._notificationHandlers[t])switch(e.method){case"timescale_update":var i=e.params[0],s=e.params[1];for(var r in s.clear=0===s.changes.length&&0===s.marks.length,this._sessions[t].onMessage({method:"timescale_update",params:s}),i){var n={method:"data_update",params:{customId:r,plots:i[r].series,nonseries:i[r].nonseries,turnaround:i[r].turnaround}};this._invokeNotificationHandler(t,r,n)}break;case"tickmark_update":this._sessions[t].onMessage({method:"timescale_update",params:e.params[0]});break;case"data_update":for(var r in e.params[0]){var o=e.params[0][r];n={method:"data_update",params:{customId:r,plots:o.series?o.series:o.plots,nonseries:o.nonseries,turnaround:o.turnaround}};this._invokeNotificationHandler(t,r,n)}break;case"index_update":for(var r in e.params[0]){n={method:"index_update",params:e.params[0][r]};this._invokeNotificationHandler(t,r,n)}break;case"critical_error":u.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+e.params[0]),this._sessions[t].onMessage({method:"critical_error",params:e.params});break;case"timescale_completed":case"quote_symbol_data":case"quote_list_fields":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._sessions[t].onMessage({method:e.method,params:e.params});break;case"clear_data":for(var a in e.params[0])this._invokeNotificationHandler(t,a,{method:"clear_data",params:e.params[0][a]});break;default:var l=e.params[0];this._invokeNotificationHandler(t,l,e)}},JSServer.ChartApi.prototype._invokeNotificationHandler=function(e,t,i){if(void 0!==t){var s=this._notificationHandlers[e][t];void 0!==s&&s&&this._invokeHandler(s.handler,i),
|
||||
"series_deleted"!==i.method&&"study_deleted"!==i.method||delete this._notificationHandlers[e][t]}},JSServer.ChartApi.prototype.searchSymbols=function(e,t,i,s,r,n,o,a,l,c){this._studyEngine.searchSymbols(e,t,i,c)},JSServer.ChartApi.prototype._notifySessions=function(e){for(var t in this._sessions){if(!this._sessions.hasOwnProperty(t))return;var i=this._sessions[t];"function"==typeof i.onMessage&&i.onMessage(e)}},JSServer.ChartApi.prototype.unpack=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.quoteCreateSession=function(e){return this._studyEngine.quoteCreateSession(e)},JSServer.ChartApi.prototype.quoteDeleteSession=function(e){return this._studyEngine.quoteDeleteSession(e)},JSServer.ChartApi.prototype.quoteSetFields=function(e,t){return this._studyEngine.quoteSetFields(e,t)},JSServer.ChartApi.prototype.quoteAddSymbols=function(e,t){return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((function(e){return!!e}))),this._studyEngine.quoteAddSymbols(e,t)},JSServer.ChartApi.prototype.quoteRemoveSymbols=function(e,t){return this._studyEngine.quoteRemoveSymbols(e,t)},JSServer.ChartApi.prototype.quoteFastSymbols=function(e,t){return this._studyEngine.quoteFastSymbols(e,t)},JSServer.ChartApi.prototype.quoteHibernateAll=function(e){return this._studyEngine.quoteHibernateAll(e)},JSServer.ChartApi.prototype.depthCreateSession=function(e){return this._studyEngine.depthCreateSession(e)},JSServer.ChartApi.prototype.depthDeleteSession=function(e){return this._studyEngine.depthDeleteSession(e)},JSServer.ChartApi.prototype.depthSetSymbol=function(e,t){return this._studyEngine.depthSetSymbol(e,t)},JSServer.ChartApi.prototype.depthClearSymbol=function(e){},JSServer.ChartApi.prototype.depthSetScale=function(e,t){},JSServer.ChartApi.prototype.createStudiesAccessController=function(e,t,i){return new this.StudiesAccessController(this._studyEngine,e&&JSON.parse(e)||{type:"black",tools:[]})},JSServer.ChartApi.prototype.StudiesAccessController=function(e,t){this._studyEngine=e,this._studiesAccess=t},JSServer.ChartApi.prototype.StudiesAccessController.prototype._findTool=function(e){for(var t=null,i=0;i<this._studiesAccess.tools.length;++i){var s=this._studiesAccess.tools[i];if(s.name===e||s===e){t=s;break}}return t},JSServer.ChartApi.prototype.StudiesAccessController.prototype.getEnabledTools=function(){return this._studyEngine.studiesMetadata().filter((function(e){return this.isToolEnabled(e.description)||e.is_hidden_study}),this)},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolEnabled=function(e){var t=this._findTool(e);return"black"===this._studiesAccess.type?!t||t.grayed:!!t},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolGrayed=function(e){var t=this._findTool(e);return t&&t.grayed},JSServer.ChartApi.prototype.serverTimeOffset=function(){return this._studyEngine.serverTimeOffset()},JSServer.ChartApi.prototype.disconnectCount=function(){return 0},h(JSServer.ChartApi,"JSServer.ChartApi",l,"ChartApiInterface"),
|
||||
e.exports=JSServer.ChartApi},EYFt:function(e,t,i){"use strict";i.d(t,"a",(function(){return g}));var s=i("ivNn"),r=i("YFKU"),n=i("qFKp"),o=i("Tmoa"),a=i("Kxc7"),l=i("k9/m"),c=i("CW80"),h=i("mMWL"),u=i("23IT"),d=i("i6cO"),p=i("UAFa");const _=n.CheckMobile.any(),m=Object(r.t)("n/a"),f=a.enabled("hide_last_na_study_output");class g{constructor(e,t){this._emptyValues=[],this._colorProviders=new Map,this._study=e,this._model=t;const i=e.metaInfo().plots;i&&i.forEach((t,i)=>{if(Object(u.isPlotWithTechnicalValues)(t))return;const s=t.id;this._emptyValues.push({id:s,index:i,title:this._study.guiPlotName(s),value:"",visible:!1});const r=Object(u.isOhlcPlot)(t)?t.target:t.id;this._colorProviders.set(r,Object(p.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),r))})}getItems(){return this._emptyValues}getValues(e){const t=this._emptyValues.map(e=>Object.assign({},e));let i=null;const r=this._study.data().lastIndex();if(null!==r)for(const s of t){if(!this._study.properties().styles[s.id].visible.value())continue;const e=this._study.nearestIndex(r,l.PlotRowSearchMode.NearestLeft,s.index+1);if(void 0===e)continue;const t=e+this._study.offset(s.id);i=null!==i?Math.max(t,i):t}(null===e||null!==i&&e>i)&&(e=i);const n=this._hideValues(),a=this._study.isVisible()&&!n?m:"";for(const s of t)s.value=a;if(n)return t;f&&t.length&&(t[t.length-1].value="");const c=this._study.priceScale();if(!this._study.isVisible()||null===e||null===c||c.isEmpty()||this._model.timeScale().isEmpty())return t;const h=this._study.metaInfo().plots,p=this._study.formatter(),_={};for(const m of t){let t=m.id;const i=this._study.properties().styles[t].visible.value();if(m.visible=i,!i)continue;const n=m.index,a=e-this._study.offset(t),c=null!==r&&a>r?l.PlotRowSearchMode.NearestLeft:l.PlotRowSearchMode.Exact,f=this._study.nearestIndex(a,c);if(void 0===f)continue;let g=_[t];if(void 0===g&&(g=this._study.getMinFirstBarIndexForPlot(t),Number.isFinite(g)&&(_[t]=g)),g>f)continue;const v=this._study.data().last(),b=this._study.data().valueAt(f)||(null!==v?v.value:null);if(null===b)continue;const S=b[n+1];if(!Object(s.isNumber)(S))continue;const y=S>0;m.value=p.format(S);const w=this._study.properties().styles[t];let C=w.color.value();const P=h[n];Object(u.isOhlcPlot)(P)?(t=P.target||t,C=this._study.properties().ohlcPlots[t].color.value()):Object(u.isArrowsPlot)(P)&&(C=y?w.colorup.value():w.colordown.value());let x=C;const T=this._colorProviders.get(t),M=T&&T.getPlotPointStyle(b);M&&(Object(u.isArrowsPlot)(P)?(y&&void 0!==M.colors[d.ColorerType.Up]&&(x=M.colors[d.ColorerType.Up]),y||void 0===M.colors[d.ColorerType.Down]||(x=M.colors[d.ColorerType.Down])):void 0!==M.colors[d.ColorerType.Main]&&(x=M.colors[d.ColorerType.Main])),"transparent"===x&&(x=C),x=Object(o.resetTransparency)(x),m.color=x}return t}_hideValues(){return _&&(null===this._model.crossHairSource().pane||Object(c.isLineToolName)(h.tool.value())||null!==this._model.lineBeingEdited())}}},Ecpn:function(e,t,i){"use strict";i.d(t,"a",(function(){return r}));const s={PivotPointsStandard:!0,VbPVisible:!0}
|
||||
Reference in New Issue
Block a user