3 lines
7.0 KiB
JavaScript
3 lines
7.0 KiB
JavaScript
"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9498],{99992:(e,t,l)=>{l.r(t),l.d(t,{exportData:()=>m});var s=l(11542),i=l(50151),n=l(19466),o=l(72708),u=l(91988),d=l(8025),a=l(68805),r=l(94113),c=l(41991),f=l(9859),h=l(17730);const p={includeTime:!0,includeUserTime:!1,includeSeries:!0,includeDisplayedValues:!1,includedStudies:"all",includeOffsetStudyValues:!1};function m(e,t={}){const l=Object.assign({},p,t),s={schema:[],data:[],displayedData:[],indexes:[]},n=e.timeScale().points(),r=e.mainSeries(),m=r.style(),v=(0,a.isSingleValueBasedStyle)(m),N=(0,i.ensureNotNull)(r.symbolInfo()),P=(0,h.getChartWidgetApiTimeConverter)(r.interval(),N,e),I=(0,a.isCloseBasedSymbol)(N),b=function(e,t){const l=e.allStudies().filter((e=>e.showInObjectTree()&&e.isVisible()));if("all"===t)return l;return l.filter((e=>t.includes(e.id())))}(e,l.includedStudies),w=[];for(const e of b){const t=(0,o.isOverlayStudy)(e)?T(e):g(e);w.push(t)}const D=b.map((e=>e.data()));(l.includeSeries||0===D.length)&&D.push(r.bars());const O=function(e,t,l,s,n){const o=(0,i.ensureNotNull)(e.range().value(),"time scale points range"),a=function(e,t,l,s){var n,o;const a=s.from,r=s.to,c=e.range().value(),h=(0,i.ensureNotNull)(void 0!==a?e.indexOf(a,!0):(0,i.ensureNotNull)(c).firstIndex),p=(0,i.ensureNotNull)(void 0!==r?e.indexOf(r,!0):(0,i.ensureNotNull)(c).lastIndex);let m=p,y=h;for(let e=0;e<t.length;e++){const i=t[e],u=s.includeOffsetStudyValues?(0,f.max)(null!==(o=null===(n=l[e])||void 0===n?void 0:n.fieldPlotOffsets)&&void 0!==o?o:[0]):0,a=i.search(h,d.PlotRowSearchMode.NearestRight);null!==a&&a.index<m&&(m=a.index);const r=i.search(p,d.PlotRowSearchMode.NearestLeft);null!==r&&r.index+u>y&&(y=r.index+u)}return(0,i.assert)(m<=y,"Range must contain at least 1 time point"),new u.BarsRange(m,y)}(e,t,l,n),r=a.firstBar(),c=a.lastBar(),h=[];for(let e=r;e<=c;e++){const t={index:e,time:(0,i.ensureNotNull)(s.convertTimePointIndexToInternalTime(e)),publicTime:(0,i.ensureNotNull)(s.convertTimePointIndexToPublicTime(e))};if(!(void 0!==n.from&&t.time<n.from)){if(void 0!==n.to&&t.time>n.to)break;if(!n.includeOffsetStudyValues&&e>o.lastIndex)break;h.push(t)}}return h.length>0?new y(h):null}(n,D,w,P,l);if(null===O)return s;const V=O.firstBar(),_=O.lastBar();l.includeTime&&s.schema.push({type:"time"});const B=s.schema.length;l.includeUserTime&&s.schema.push({type:"userTime"});const F=s.schema.length;if(l.includeSeries){const e=r.statusProvider({hideResolution:!0}).getSplitTitle(),t=Object.values(e).filter((e=>""!==e)).join(", ");s.schema.push(...function(e,t,l,s,n){const o=[];l?o.push(S("close",e)):s?o.push(S((0,i.ensureNotNull)(n),e)):12===t?o.push(S("high",e),S("low",e)):16===t?o.push(S("high",e),S("low",e),S("close",e)):o.push(S("open",e),S("high",e),S("low",e),S("close",e));return o}(t,m,I,v,r.priceSource()))}let k=s.schema.length;for(const e of w)s.schema.push(...e.fields);const C=s.schema.length;if(0===C)return s;for(let e=V;e<=_;++e){const t=new Float64Array(C);t.fill(NaN),s.data.push(t),s.indexes.push(e),
|
|
l.includeDisplayedValues&&s.displayedData.push(new Array(C).fill(""))}if(l.includeTime||l.includeUserTime){const t=e.dateTimeFormatter();for(let e=V;e<=_;++e){const n=O.item(e),o=n.time,u=n.publicTime,d=new Date(1e3*(0,i.ensureNotNull)(u));if(l.includeTime&&(s.data[e-V][0]=(0,i.ensureNotNull)(o)),l.includeUserTime&&(s.data[e-V][B]=d.getTime()/1e3),l.includeDisplayedValues){const i=t.format(d);l.includeTime&&(s.displayedData[e-V][0]=i),l.includeUserTime&&(s.displayedData[e-V][B]=i)}}}if(l.includeSeries){const e=r.bars().range(V,_),t=(0,c.getPriceValueFormatterForSource)(r),i=e=>t(e,{ignoreLocaleNumberFormat:!0}),n=r.barFunction();e.each(((e,t)=>{const o=s.data[e-V],u=x(t[4]);if(I){if(o[F]=u,l.includeDisplayedValues){s.displayedData[e-V][F]=i(u)}}else if(v){const u=n(t);if(o[F]=u,l.includeDisplayedValues){s.displayedData[e-V][F]=i(u)}}else{const n=x(t[1]),d=x(t[2]),a=x(t[3]);if(12===m?(o[F]=d,o[F+1]=a):16===m?(o[F]=d,o[F+1]=a,o[F+2]=u):(o[F]=n,o[F+1]=d,o[F+2]=a,o[F+3]=u),l.includeDisplayedValues){const t=s.displayedData[e-V];12===m?(t[F]=i(d),t[F+1]=i(a)):16===m?(t[F]=i(d),t[F+1]=i(a),t[F+2]=i(u)):(t[F]=i(n),t[F+1]=i(d),t[F+2]=i(a),t[F+3]=i(u))}}return!1}))}for(let e=0;e<b.length;++e){const t=b[e],n=w[e];let u,d=!1,r=!1;(0,o.isOverlayStudy)(t)&&(u=t.barFunction(),d=(0,a.isCloseBasedSymbol)(t.symbolInfo()),r=(0,a.isSingleValueBasedStyle)(t.style()));for(let e=0;e<n.fields.length;++e){const o=(0,c.getPriceValueFormatterForStudy)(t,n.fields[e].plotId),a=e=>o(e,{ignoreLocaleNumberFormat:!0}),f=n.fieldPlotOffsets[e],h=n.fieldToPlotIndex[e],p=V-f,m=_-f,y=k+e;t.data().range(p,m).each(((e,t)=>{const n=s.data[e-p];let o;return o=d?x(t[4]):r?(0,i.ensureDefined)(u)(t):x(t[h]),n[y]=o,l.includeDisplayedValues&&(s.displayedData[e-p][y]=a(o)),!1}))}k+=n.fields.length}return s}class y{constructor(e){this._items=e,this._firstIndex=this._items[0].index,this._lastIndex=this._items[this._items.length-1].index}firstBar(){return this._firstIndex}lastBar(){return this._lastIndex}item(e){return this._items[e-this._firstIndex]}}function g(e){const t=e.metaInfo(),o={fieldToPlotIndex:[],fieldPlotOffsets:[],fields:[]},u=e.id(),d=e.properties().childs(),a=e.title(n.TitleDisplayTarget.StatusLine,!1,void 0,!1);for(let n=0;n<t.plots.length;++n){const c=t.plots[n];let f,h="";if((0,r.isPlotSupportDisplay)(c)){const e=d.styles.childs()[c.id];if(void 0!==e&&0===e.childs().display.value())continue;f=(0,i.ensureDefined)(t.styles)[c.id]}else if((0,r.isOhlcPlot)(c)){const e=d.ohlcPlots.childs()[c.target];if(void 0!==e&&0===e.childs().display.value())continue;switch(f=t.ohlcPlots&&t.ohlcPlots[c.target],c.type){case"ohlc_open":h=` (${s.t(null,void 0,l(16610))})`;break;case"ohlc_high":h=` (${s.t(null,void 0,l(78254))}`;break;case"ohlc_low":h=` (${s.t(null,void 0,l(65318))})`;break;case"ohlc_close":h=` (${s.t(null,void 0,l(62578))})`}}if(void 0===f||void 0===f.title)continue;const p=`${f.title}${h}`;o.fields.push(v(u,a,p,c.id)),o.fieldToPlotIndex.push(n+1),o.fieldPlotOffsets.push(e.offset(c.id))}return o}function T(e){const t={fieldToPlotIndex:[],
|
|
fieldPlotOffsets:[],fields:[]},l=e.id(),s=e.title(n.TitleDisplayTarget.StatusLine,!1,void 0,!1),o=e.style(),u=(0,a.isCloseBasedSymbol)(e.symbolInfo()),d=(0,a.isSingleValueBasedStyle)(o);if(u)t.fields.push(v(l,s,"close","close")),t.fieldToPlotIndex.push(4),t.fieldPlotOffsets.push(0);else if(d){const n=(0,i.ensureNotNull)(e.priceSource());t.fields.push(v(l,s,n,n)),t.fieldToPlotIndex.push(1),t.fieldPlotOffsets.push(0)}else 12===o?(t.fields.push(v(l,s,"high","high"),v(l,s,"low","low")),t.fieldToPlotIndex.push(3,2),t.fieldPlotOffsets.push(0,0)):16===o?(t.fields.push(v(l,s,"high","high"),v(l,s,"low","low"),v(l,s,"close","close")),t.fieldToPlotIndex.push(2,3,4),t.fieldPlotOffsets.push(0,0,0)):(t.fields.push(v(l,s,"open","open"),v(l,s,"high","high"),v(l,s,"low","low"),v(l,s,"close","close")),t.fieldToPlotIndex.push(1,2,3,4),t.fieldPlotOffsets.push(0,0,0,0));return t}function v(e,t,l,s){return{type:"value",sourceType:"study",sourceId:e,sourceTitle:t,plotTitle:l,plotId:s}}function S(e,t){return{type:"value",sourceType:"series",plotTitle:e,sourceTitle:t}}function x(e){return null!=e?e:NaN}}}]); |