├── .gitignore ├── README.md ├── chartConfig.js ├── charting_library ├── charting_library.min.d.ts ├── charting_library.min.js ├── datafeed-api.d.ts └── static │ ├── bundles │ ├── 13.416855bb3e77f54b85bc.js │ ├── crosshair.6c091f7d5427d0c5e6d9dc3a90eb2b20.cur │ ├── dot.ed68e83c16f77203e73dbc4c3a7c7fa1.cur │ ├── ds-property-pages.1d6127a623f51513ea4f.js │ ├── editobjectdialog.25fa62e6b4f8125e697e.js │ ├── eraser.0579d40b812fa2c3ffe72e5803a6e14c.cur │ ├── go-to-date-dialog-impl.62cf944ccbbc265f35d6.js │ ├── grab.bc156522a6b55a60be9fae15c14b66c5.cur │ ├── grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur │ ├── ie-fallback-logos.1e0142e3b30300ec0153.js │ ├── lazy-jquery-ui.8a95a81e0b032b2d76df.js │ ├── lazy-velocity.97588d47c84409f2bc4b.js │ ├── library.3a1dac88649135c71a7d.js │ ├── library.a8de6f8cf4dda6895071c6ec45f900d9.css │ ├── lt-pane-views.58e294a05422f60f49f9.js │ ├── objecttreedialog.e036091976a3fed3c8c9.js │ ├── propertypagesfactory.54b21a18753b2d8c83c2.js │ ├── symbol-info-dialog-impl.a3697f845094a08295ab.js │ ├── take-chart-image-dialog-impl.53880c50752269d86d3a.js │ ├── vendors.a94ef44ed5c201cefcf6ad7460788c1a.css │ ├── vendors.e76774664d65ba2c90ff.js │ └── zoom.e21f24dd632c7069139bc47ae89c54b5.cur │ ├── chart.css │ ├── fonts │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ └── fontawesome-webfont.woff │ ├── images │ ├── balloon.png │ ├── bar-loader.gif │ ├── button-bg.png │ ├── charting_library │ │ ├── logo-widget-copyright-faded.png │ │ └── logo-widget-copyright.png │ ├── controlll.png │ ├── delayed.png │ ├── dialogs │ │ ├── checkbox.png │ │ ├── close-flat.png │ │ ├── large-slider-handle.png │ │ ├── linewidth-slider.png │ │ └── opacity-slider.png │ ├── icons.png │ ├── prediction-clock-black.png │ ├── prediction-clock-white.png │ ├── prediction-failure-white.png │ ├── prediction-success-white.png │ ├── select-bg.png │ ├── sidetoolbar │ │ ├── instruments.png │ │ └── toolgroup.png │ ├── svg │ │ ├── chart │ │ │ ├── bucket2.svg │ │ │ ├── font.svg │ │ │ ├── large-slider-handle.svg │ │ │ └── pencil2.svg │ │ └── question-mark-rounded.svg │ ├── tvcolorpicker-bg-gradient.png │ ├── tvcolorpicker-bg.png │ ├── tvcolorpicker-check.png │ ├── tvcolorpicker-sprite.png │ └── warning-icon.png │ ├── js │ └── external │ │ └── spin.min.js │ ├── localization │ └── translations │ │ ├── ar.json │ │ ├── cs.json │ │ ├── da_DK.json │ │ ├── de.json │ │ ├── el.json │ │ ├── en.json │ │ ├── es.json │ │ ├── et_EE.json │ │ ├── fa.json │ │ ├── fr.json │ │ ├── he_IL.json │ │ ├── hu_HU.json │ │ ├── id_ID.json │ │ ├── it.json │ │ ├── ja.json │ │ ├── ko.json │ │ ├── ms_MY.json │ │ ├── nl_NL.json │ │ ├── no.json │ │ ├── pl.json │ │ ├── pt.json │ │ ├── ro.json │ │ ├── ru.json │ │ ├── sk_SK.json │ │ ├── sv.json │ │ ├── th.json │ │ ├── tr.json │ │ ├── vi.json │ │ ├── widgets-copyrights.json │ │ ├── widgets-copyrights.json.example │ │ ├── zh.json │ │ └── zh_TW.json │ └── tv-chart.e816a7a6edc9de3ed709.html ├── datafeed.js ├── event.js ├── index.html ├── index.js ├── websocket.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 项目 需要在服务器下面运行,不可以直接点击 index.html 2 | 3 | node npm 下载http-server 后 用http-server -p 8888启动一个服务器。或者别的方法启动一个服务器 4 | 5 | 项目 各个js文件作用均在index.html引入的时候 有注释。 6 | 7 | 8 | charting_library文件夹为图表库官方给的文件,不应该经过任何打包工具打包。 9 | 换到你们项目里面以后,charting_library文件 更换了路径 需要修改chartConfig.js里面的library_path字段 。 10 | 11 | 覆盖k线图默认样式 在charting_library/static/chart.css 12 | 13 | charting_library文件夹只可以修改charting_library/static/chart.css文件 别的文件禁止修改。 14 | 15 | 16 | 17 | 18 | 19 | /******************************************************/ 20 | 后端websocket接口订阅规范 21 | /******************************************************/ 22 | 23 | // 取历史数据详解 24 | {args: ["candle.M1.btcusdt", 1441, 1541425959] 25 | cmd: "req" 26 | id: "0a0493f7-80d4-4d1a-9d98-6da9ae9d399e"} 27 | 28 | args为参数 29 | M1代表一分钟 30 | btcusdt代表产品名 31 | 1441代表多少条历史数据 32 | 1541425959 代表 时间搓 请求的时候 就是从这个时间搓,向前要1441条数据 33 | 34 | cmd 行为 值为req 代表取历史数据 35 | id 一个随机数 可要可无 36 | 37 | /******************************************************/ 38 | 39 | // 取实时数据详解 40 | args: ["candle.M1.btcusdt"] 41 | cmd: "sub" 42 | id: "fd0823a5-e16b-4f46-8b68-3fd723beb321" 43 | 44 | args为参数 45 | M1代表一分钟 46 | btcusdt代表产品名 47 | cmd 行为 值为 sub 代表订阅实时数据 48 | id 一个随机数 可要可无 49 | 50 | /******************************************************/ 51 | 52 | // 取消订阅实时数据 详情 53 | args: ["candle.M1.btcusdt"] 54 | cmd: "unsub" 55 | 56 | args为参数 57 | M1代表一分钟 58 | btcusdt代表产品名 59 | cmd 行为 值为 unsub 代表取消订阅实时数据 60 | 61 | /******************************************************/ 62 | 63 | 修改 websocket请求地址 目录 /websocket.js 64 | -------------------------------------------------------------------------------- /chartConfig.js: -------------------------------------------------------------------------------- 1 | var chartConfig = { 2 | fullscreen: true, 3 | timezone: "Asia/Shanghai", 4 | container_id: "tv_chart_container", 5 | datafeed: new FeedBase(), 6 | library_path: "charting_library/", 7 | locale: "zh", 8 | disabled_features: ["control_bar", "timeframes_toolbar", "main_series_scale_menu", "symbol_search_hot_key", "header_symbol_search", "header_resolutions", "header_settings","save_chart_properties_to_local_storage", "header_chart_type", "header_compare", "header_undo_redo", "header_screenshot", "use_localstorage_for_settings", "volume_force_overlay"], 9 | enabled_features: ["keep_left_toolbar_visible_on_small_screens", "side_toolbar_in_fullscreen_mode", "hide_left_toolbar_by_default", "left_toolbar", "keep_left_toolbar_visible_on_small_screens", "hide_last_na_study_output", "move_logo_to_main_pane", "dont_show_boolean_study_arguments"], 10 | custom_css_url: "chart.css", 11 | studies_overrides: { 12 | "volume.precision": 0 13 | }, 14 | overrides: { 15 | "paneProperties.background": "#ffffff", 16 | "paneProperties.vertGridProperties.color": "rgba(0,0,0,0)", 17 | "paneProperties.horzGridProperties.color": "rgba(0,0,0,0)", 18 | "scalesProperties.textColor": "#333", 19 | volumePaneSize: "medium", 20 | "paneProperties.legendProperties.showStudyArguments": !0, 21 | "paneProperties.legendProperties.showStudyTitles": !0, 22 | "paneProperties.legendProperties.showStudyValues": !0 23 | } 24 | } -------------------------------------------------------------------------------- /charting_library/charting_library.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.TradingView=t.TradingView||{})}(this,function(t){"use strict";function e(t,o){var i=n({},t);for(var s in o)"object"!=typeof t[s]||null===t[s]||Array.isArray(t[s])?void 0!==o[s]&&(i[s]=o[s]):i[s]=e(t[s],o[s]);return i}function o(){return"1.12 (internal id e816a7a6 @ 2018-03-26 08:21:11.837530)"}function i(t){window.addEventListener("DOMContentLoaded",t,!1)}var n=Object.assign||function(t){for(var e,o=arguments,i=1,n=arguments.length;i'},t}(),d=a;window.TradingView=window.TradingView||{},window.TradingView.version=o,t.version=o,t.onready=i,t.widget=d,Object.defineProperty(t,"__esModule",{value:!0})}); 2 | -------------------------------------------------------------------------------- /charting_library/datafeed-api.d.ts: -------------------------------------------------------------------------------- 1 | export declare type ResolutionString = string; 2 | export interface Exchange { 3 | value: string; 4 | name: string; 5 | desc: string; 6 | } 7 | export interface DatafeedSymbolType { 8 | name: string; 9 | value: string; 10 | } 11 | export interface DatafeedConfiguration { 12 | exchanges?: Exchange[]; 13 | supported_resolutions?: ResolutionString[]; 14 | supports_marks?: boolean; 15 | supports_time?: boolean; 16 | supports_timescale_marks?: boolean; 17 | symbols_types?: DatafeedSymbolType[]; 18 | } 19 | export declare type OnReadyCallback = (configuration: DatafeedConfiguration) => void; 20 | export interface IExternalDatafeed { 21 | onReady(callback: OnReadyCallback): void; 22 | } 23 | export interface DatafeedQuoteValues { 24 | ch?: number; 25 | chp?: number; 26 | short_name?: string; 27 | exchange?: string; 28 | description?: string; 29 | lp?: number; 30 | ask?: number; 31 | bid?: number; 32 | spread?: number; 33 | open_price?: number; 34 | high_price?: number; 35 | low_price?: number; 36 | prev_close_price?: number; 37 | volume?: number; 38 | original_name?: string; 39 | [valueName: string]: string | number | undefined; 40 | } 41 | export interface QuoteOkData { 42 | s: 'ok'; 43 | n: string; 44 | v: DatafeedQuoteValues; 45 | } 46 | export interface QuoteErrorData { 47 | s: 'error'; 48 | n: string; 49 | v: object; 50 | } 51 | export declare type QuoteData = QuoteOkData | QuoteErrorData; 52 | export declare type QuotesCallback = (data: QuoteData[]) => void; 53 | export interface IDatafeedQuotesApi { 54 | getQuotes(symbols: string[], onDataCallback: QuotesCallback, onErrorCallback: (msg: string) => void): void; 55 | subscribeQuotes(symbols: string[], fastSymbols: string[], onRealtimeCallback: QuotesCallback, listenerGUID: string): void; 56 | unsubscribeQuotes(listenerGUID: string): void; 57 | } 58 | export declare type CustomTimezones = 'America/New_York' | 'America/Los_Angeles' | 'America/Chicago' | 'America/Phoenix' | 'America/Toronto' | 'America/Vancouver' | 'America/Argentina/Buenos_Aires' | 'America/El_Salvador' | 'America/Sao_Paulo' | 'America/Bogota' | 'America/Caracas' | 'Europe/Moscow' | 'Europe/Athens' | 'Europe/Berlin' | 'Europe/London' | 'Europe/Madrid' | 'Europe/Paris' | 'Europe/Rome' | 'Europe/Warsaw' | 'Europe/Istanbul' | 'Europe/Zurich' | 'Australia/Sydney' | 'Australia/Brisbane' | 'Australia/Adelaide' | 'Australia/ACT' | 'Asia/Almaty' | 'Asia/Ashkhabad' | 'Asia/Tokyo' | 'Asia/Taipei' | 'Asia/Singapore' | 'Asia/Shanghai' | 'Asia/Seoul' | 'Asia/Tehran' | 'Asia/Dubai' | 'Asia/Kolkata' | 'Asia/Hong_Kong' | 'Asia/Bangkok' | 'Pacific/Auckland' | 'Pacific/Chatham' | 'Pacific/Fakaofo' | 'Pacific/Honolulu' | 'America/Mexico_City' | 'Africa/Johannesburg' | 'Asia/Kathmandu' | 'US/Mountain'; 59 | export declare type Timezone = 'UTC' | CustomTimezones; 60 | export interface LibrarySymbolInfo { 61 | /** 62 | * Symbol Name 63 | */ 64 | name: string; 65 | full_name: string; 66 | base_name?: [string]; 67 | /** 68 | * Unique symbol id 69 | */ 70 | ticker?: string; 71 | description: string; 72 | type: string; 73 | /** 74 | * @example "1700-0200" 75 | */ 76 | session: string; 77 | /** 78 | * Traded exchange 79 | * @example "NYSE" 80 | */ 81 | exchange: string; 82 | listed_exchange: string; 83 | timezone: Timezone; 84 | /** 85 | * Code (Tick) 86 | * @example 8/16/.../256 (1/8/100 1/16/100 ... 1/256/100) or 1/10/.../10000000 (1 0.1 ... 0.0000001) 87 | */ 88 | pricescale: number; 89 | /** 90 | * The number of units that make up one tick. 91 | * @example For example, U.S. equities are quotes in decimals, and tick in decimals, and can go up +/- .01. So the tick increment is 1. But the e-mini S&P futures contract, though quoted in decimals, goes up in .25 increments, so the tick increment is 25. (see also Tick Size) 92 | */ 93 | minmov: number; 94 | fractional?: boolean; 95 | /** 96 | * @example Quarters of 1/32: pricescale=128, minmovement=1, minmovement2=4 97 | */ 98 | minmove2?: number; 99 | /** 100 | * false if DWM only 101 | */ 102 | has_intraday?: boolean; 103 | /** 104 | * An array of resolutions which should be enabled in resolutions picker for this symbol. 105 | */ 106 | supported_resolutions: ResolutionString[]; 107 | /** 108 | * @example (for ex.: "1,5,60") - only these resolutions will be requested, all others will be built using them if possible 109 | */ 110 | intraday_multipliers?: string[]; 111 | has_seconds?: boolean; 112 | /** 113 | * It is an array containing seconds resolutions (in seconds without a postfix) the datafeed builds by itself. 114 | */ 115 | seconds_multipliers?: string[]; 116 | has_daily?: boolean; 117 | has_weekly_and_monthly?: boolean; 118 | has_empty_bars?: boolean; 119 | force_session_rebuild?: boolean; 120 | has_no_volume?: boolean; 121 | /** 122 | * Integer showing typical volume value decimal places for this symbol 123 | */ 124 | volume_precision?: number; 125 | data_status?: 'streaming' | 'endofday' | 'pulsed' | 'delayed_streaming'; 126 | /** 127 | * Boolean showing whether this symbol is expired futures contract or not. 128 | */ 129 | expired?: boolean; 130 | /** 131 | * Unix timestamp of expiration date. 132 | */ 133 | expiration_date?: number; 134 | sector?: string; 135 | industry?: string; 136 | currency_code?: string; 137 | } 138 | export interface DOMLevel { 139 | price: number; 140 | volume: number; 141 | } 142 | export interface DOMData { 143 | snapshot: boolean; 144 | asks: DOMLevel[]; 145 | bids: DOMLevel[]; 146 | } 147 | export interface Bar { 148 | time: number; 149 | open: number; 150 | high: number; 151 | low: number; 152 | close: number; 153 | volume?: number; 154 | } 155 | export interface SearchSymbolResultItem { 156 | symbol: string; 157 | full_name: string; 158 | description: string; 159 | exchange: string; 160 | ticker: string; 161 | type: string; 162 | } 163 | export interface HistoryMetadata { 164 | noData: boolean; 165 | nextTime?: number | null; 166 | } 167 | export interface MarkCustomColor { 168 | color: string; 169 | background: string; 170 | } 171 | export declare type MarkConstColors = 'red' | 'green' | 'blue' | 'yellow'; 172 | export interface Mark { 173 | id: string | number; 174 | time: number; 175 | color: MarkConstColors | MarkCustomColor; 176 | text: string; 177 | label: string; 178 | labelFontColor: string; 179 | minSize: number; 180 | } 181 | export interface TimescaleMark { 182 | id: string | number; 183 | time: number; 184 | color: MarkConstColors | string; 185 | label: string; 186 | tooltip: string[]; 187 | } 188 | export declare type ResolutionBackValues = 'D' | 'M'; 189 | export interface HistoryDepth { 190 | resolutionBack: ResolutionBackValues; 191 | intervalBack: number; 192 | } 193 | export declare type SearchSymbolsCallback = (items: SearchSymbolResultItem[]) => void; 194 | export declare type ResolveCallback = (symbolInfo: LibrarySymbolInfo) => void; 195 | export declare type HistoryCallback = (bars: Bar[], meta: HistoryMetadata) => void; 196 | export declare type SubscribeBarsCallback = (bar: Bar) => void; 197 | export declare type GetMarksCallback = (marks: T[]) => void; 198 | export declare type ServerTimeCallback = (serverTime: number) => void; 199 | export declare type DomeCallback = (data: DOMData) => void; 200 | export declare type ErrorCallback = (reason: string) => void; 201 | export interface IDatafeedChartApi { 202 | calculateHistoryDepth?(resolution: ResolutionString, resolutionBack: ResolutionBackValues, intervalBack: number): HistoryDepth | undefined; 203 | getMarks?(symbolInfo: LibrarySymbolInfo, startDate: number, endDate: number, onDataCallback: GetMarksCallback, resolution: ResolutionString): void; 204 | getTimescaleMarks?(symbolInfo: LibrarySymbolInfo, startDate: number, endDate: number, onDataCallback: GetMarksCallback, resolution: ResolutionString): void; 205 | /** 206 | * This function is called if configuration flag supports_time is set to true when chart needs to know the server time. 207 | * The charting library expects callback to be called once. 208 | * The time is provided without milliseconds. Example: 1445324591. It is used to display Countdown on the price scale. 209 | */ 210 | getServerTime?(callback: ServerTimeCallback): void; 211 | searchSymbols(userInput: string, exchange: string, symbolType: string, onResult: SearchSymbolsCallback): void; 212 | resolveSymbol(symbolName: string, onResolve: ResolveCallback, onError: ErrorCallback): void; 213 | getBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, rangeStartDate: number, rangeEndDate: number, onResult: HistoryCallback, onError: ErrorCallback, isFirstCall: boolean): void; 214 | subscribeBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, onTick: SubscribeBarsCallback, listenerGuid: string, onResetCacheNeededCallback: () => void): void; 215 | unsubscribeBars(listenerGuid: string): void; 216 | subscribeDepth?(symbolInfo: LibrarySymbolInfo, callback: DomeCallback): string; 217 | unsubscribeDepth?(subscriberUID: string): void; 218 | } 219 | 220 | export as namespace TradingView; 221 | -------------------------------------------------------------------------------- /charting_library/static/bundles/13.416855bb3e77f54b85bc.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([13],{334:function(t,e,n){var o,i,r;!function(a,c){i=[t,n(516),n(1091),n(687)],o=c,void 0!==(r="function"==typeof o?o.apply(e,i):o)&&(t.exports=r)}(0,function(t,e,n,o){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}var l=i(e),s=i(n),f=i(o),h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d=function(){function t(t,e){var n,o;for(n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof t.action?t.action:this.defaultAction,this.target="function"==typeof t.target?t.target:this.defaultTarget,this.text="function"==typeof t.text?t.text:this.defaultText,this.container="object"===h(t.container)?t.container:document.body}},{key:"listenClick",value:function(t){var e=this;this.listener=(0,f.default)(t,"click",function(t){return e.onClick(t)})}},{key:"onClick",value:function(t){var e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new l.default({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}},{key:"defaultAction",value:function(t){return u("action",t)}},{key:"defaultTarget",value:function(t){var e=u("target",t);if(e)return document.querySelector(e)}},{key:"defaultText",value:function(t){return u("text",t)}},{key:"destroy",value:function(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],e="string"==typeof t?[t]:t,n=!!document.queryCommandSupported;return e.forEach(function(t){n=n&&!!document.queryCommandSupported(t)}),n}}]),e}(s.default);t.exports=p})},516:function(t,e,n){var o,i,r;!function(a,c){i=[t,n(1090)],o=c, 2 | void 0!==(r="function"==typeof o?o.apply(e,i):o)&&(t.exports=r)}(0,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=function(){function t(t,e){var n,o;for(n=0;n0&&void 0!==arguments[0]?arguments[0]:{};this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function(){var t,e=this,n="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[n?"right":"left"]="-9999px",t=window.pageYOffset||document.documentElement.scrollTop,this.fakeElem.style.top=t+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,i.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=(0,i.default)(this.target),this.copyText()}},{key:"copyText",value:function(){var t=void 0;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}},{key:"handleResult",value:function(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target", 3 | set:function(t){if(void 0!==t){if(!t||"object"!==(void 0===t?"undefined":r(t))||1!==t.nodeType)throw Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}},get:function(){return this._target}}]),t}();t.exports=c})},613:function(t,e){function n(t,e){for(;t&&t.nodeType!==i;){if("function"==typeof t.matches&&t.matches(e))return t;t=t.parentNode}}var o,i=9;"undefined"==typeof Element||Element.prototype.matches||(o=Element.prototype,o.matches=o.matchesSelector||o.mozMatchesSelector||o.msMatchesSelector||o.oMatchesSelector||o.webkitMatchesSelector),t.exports=n},614:function(t,e,n){function o(t,e,n,o,i){var a=r.apply(this,arguments);return t.addEventListener(n,a,i),{destroy:function(){t.removeEventListener(n,a,i)}}}function i(t,e,n,i,r){return"function"==typeof t.addEventListener?o.apply(null,arguments):"function"==typeof n?o.bind(null,document).apply(null,arguments):("string"==typeof t&&(t=document.querySelectorAll(t)),Array.prototype.map.call(t,function(t){return o(t,e,n,i,r)}))}function r(t,e,n,o){return function(n){n.delegateTarget=a(n.target,e),n.delegateTarget&&o.call(t,n)}}var a=n(613);t.exports=i},686:function(t,e){e.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType},e.nodeList=function(t){var n=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in t&&(0===t.length||e.node(t[0]))},e.string=function(t){return"string"==typeof t||t instanceof String},e.fn=function(t){return"[object Function]"===Object.prototype.toString.call(t)}},687:function(t,e,n){function o(t,e,n){if(!t&&!e&&!n)throw Error("Missing required arguments");if(!c.string(e))throw new TypeError("Second argument must be a String");if(!c.fn(n))throw new TypeError("Third argument must be a Function");if(c.node(t))return i(t,e,n);if(c.nodeList(t))return r(t,e,n);if(c.string(t))return a(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function i(t,e,n){return t.addEventListener(e,n),{destroy:function(){t.removeEventListener(e,n)}}}function r(t,e,n){return Array.prototype.forEach.call(t,function(t){t.addEventListener(e,n)}),{destroy:function(){Array.prototype.forEach.call(t,function(t){t.removeEventListener(e,n)})}}}function a(t,e,n){return u(document.body,t,e,n)}var c=n(686),u=n(614);t.exports=o},1090:function(t,e){function n(t){var e,n,o,i;return"SELECT"===t.nodeName?(t.focus(),e=t.value):"INPUT"===t.nodeName||"TEXTAREA"===t.nodeName?(n=t.hasAttribute("readonly"),n||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),n||t.removeAttribute("readonly"),e=t.value):(t.hasAttribute("contenteditable")&&t.focus(),o=window.getSelection(), 4 | i=document.createRange(),i.selectNodeContents(t),o.removeAllRanges(),o.addRange(i),e=""+o),e}t.exports=n},1091:function(t,e){function n(){}n.prototype={on:function(t,e,n){var o=this.e||(this.e={});return(o[t]||(o[t]=[])).push({fn:e,ctx:n}),this},once:function(t,e,n){function o(){i.off(t,o),e.apply(n,arguments)}var i=this;return o._=e,this.on(t,o,n)},emit:function(t){var e=[].slice.call(arguments,1),n=((this.e||(this.e={}))[t]||[]).slice(),o=0,i=n.length;for(o;o");return this.bindControl(new s(l(e),this._linetool.properties().collectibleColors,!0,this.model(),"Change All Lines Color",0)),{label:$(""+$.t("Use one color")+""),editor:e}},o.prototype.addOneColorPropertyWidget=function(e){var t=this.createOneColorForAllLinesWidget(),i=$("");i.append($("")).append(t.label).append(t.editor),i.appendTo(e)},o=a(o),o.createTemplatesPropertyPage=a,e.exports=o},81:function(e,t,i){"use strict";function a(e,t,i){r.call(this,e,t),this._linetool=i,this.prepareLayout()}var o=i(10),r=o.PropertyPage,n=o.GreateTransformer,s=o.LessTransformer,l=o.ToIntTransformer,p=o.SimpleStringBinder;i(142),inherit(a,r),a.BarIndexPastLimit=-5e4,a.BarIndexFutureLimit=15e3,a.prototype.bindBarIndex=function(e,t,i,o){var r=[l(e.value()),n(a.BarIndexPastLimit),s(a.BarIndexFutureLimit)];this.bindControl(new p(t,e,r,!1,i,o))},a.prototype.createPriceEditor=function(e){var t,i=this._linetool.ownerSource().formatter(),a=function(e){return i.format(e)},o=function(e){var t=i.parse(e);if(t.res)return t.price?t.price:t.value},r=$("");return r.TVTicker({step:i._minMove/i._priceScale||1,formatter:a,parser:o}),e&&(t=[function(t){var i=o(t);return void 0===i?e.value():i}],this.bindControl(new p(r,e,t,!1,this.model(),"Change "+this._linetool+" point price")).addFormatter(function(e){return i.format(e)})),r},a.prototype._createPointRow=function(e,t,i){var a,o,r,n,s,l=$(""),p=$("");return p.html($.t("Price")+i),p.appendTo(l),a=$(""),a.appendTo(l),o=this.createPriceEditor(t.price),o.appendTo(a),r=$(""),r.html($.t("Bar #")),r.appendTo(l),n=$(""),n.appendTo(l),s=$(""),s.appendTo(n),s.addClass("ticker"),this.bindBarIndex(t.bar,s,this.model(),"Change "+this._linetool+" point bar index"),l},a.prototype.prepareLayoutForTable=function(e){var t,i,a,o,r,n=this._linetool.points(),s=n.length;for(t=0;t1?" "+(t+1):"",r=this._createPointRow(i,a,o),r.appendTo(e))},a.prototype.prepareLayout=function(){this._table=$(document.createElement("table")),this._table.addClass("property-page"),this._table.attr("cellspacing","0"),this._table.attr("cellpadding","2"),this.prepareLayoutForTable(this._table),this.loadData()}, 2 | a.prototype.widget=function(){return this._table},e.exports=a},121:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Coordinates=100]="Coordinates",e[e.Display=100]="Display",e[e.Style=200]="Style",e[e.Inputs=300]="Inputs",e[e.Properties=250]="Properties"}(t.TabPriority||(t.TabPriority={})),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.eventsAndAlerts="Events & Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.sourceCode="Source Code",e.style="Style",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility"}(t.TabNames||(t.TabNames={})),function(e){e[e.Default=100]="Default",e[e.UserSave=200]="UserSave",e[e.Override=300]="Override"}(t.TabOpenFrom||(t.TabOpenFrom={}))},162:function(e,t){"use strict";t.createInputsPropertyPage=function(e,t){var i=e.getInputsPropertyPage();return null==i?null:new i(e.properties(),t,e)},t.createStudyStrategyPropertyPage=function(e,t){var i=e.getStrategyPropertyPage();return null==i?null:new i(e.properties(),t,e)},t.createStylesPropertyPage=function(e,t){var i=e.getStylesPropertyPage();return null==i?null:new i(e.properties(),t,e)},t.createDisplayPropertyPage=function(e,t){var i=e.getDisplayPropertyPage();return null==i?null:new i(e.properties(),t,e)},t.createVisibilitiesPropertyPage=function(e,t){var i=e.getVisibilitiesPropertyPage();return null==i?null:new i(e.properties(),t,e)},t.hasInputsPropertyPage=function(e){return null!==e.getInputsPropertyPage()},t.hasStylesPropertyPage=function(e){return null!==e.getStylesPropertyPage()}},396:function(e,t,i){(function(t){"use strict";function a(e,t,i){this._source=e,this._model=t,this._undoCheckpoint=i}var o=i(3).LineDataSource,r=i(61).Study,n=i(85),s=i(62).DataSource,l=i(43),p=i(103).bindPopupMenu,c=i(121),d=i(48).trackEvent;i(142),a.prototype.hide=function(e){TVDialogs.destroy(this._dialogTitle,{undoChanges:!!e})},a.prototype._onDestroy=function(e,t){var i,a=(t||{}).undoChanges;$(window).unbind("keyup.hidePropertyDialog"),a?(i=this._undoCheckpoint?this._undoCheckpoint:this._undoCheckpointOnShow)&&this._model.undoToCheckpoint(i):this._source.hasAlert.value()&&this._source.localAndServerAlersMismatch&&this._source.synchronizeAlert(!0),this._undoCheckpointOnShow&&delete this._undoCheckpointOnShow,window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.refresh()},a.prototype.isVisible=function(){return this._dialog&&this._dialog.is(":visible")},a.prototype.focusOnText=function(){this._dialog.find('input[type="text"]').focus().select()},a.prototype.switchTab=function(e,t){var i,a;if(this._tabs)return i=null,e?e=e.valueOf():null===e&&(e=void 0),"string"==typeof e&&$.each(this._tabs,function(t,a){if(a.name===e)return i=a,!1}),"object"==typeof e&&$.each(this._tabs,function(t,a){if(e===a||$(a.labelObject).is(e)||$(a.wrapperObject).is(e))return i=a,!1}),i||(i=this._tabs[~~e]),!!i&&($.each(this._tabs,function(e,t){var a=t===i;$(t.wrapperObject)[a?"show":"hide"](), 3 | $(t.labelObject)[a?"addClass":"removeClass"]("active")}),t&&(a=this.activeTabSettingsName())&&TVSettings.setValue(a,i.name),this._dialog.height()+100>$(window).height()&&!i.isScrollable&&this.makeScrollable(i),$(":focus").blur(),!0)},a.prototype.makeScrollable=function(e){var t=e.wrapperObject,i=$(e.objects[0]),a=i.width();t.css({height:$(window).height()/1.4,overflow:"auto"}),i.css("width",a+20),e.isScrollable=!0},a.prototype.appendToTab=function(e,t,i,a,o,r){var n,s;$(e).is("table")&&!$(e).find("tr").size()||(this._tabs||(this._tabs=[]),$.each(this._tabs,function(e,i){if(i.name===t)return n=e,!1}),void 0===n&&(this._tabs.push({name:t,localizedName:$.t(t),objects:$(),displayPriority:0,defaultOpen:0,isButton:!!o,callback:o?r||function(){}:null}),n=this._tabs.length-1),s=this._tabs[n],s.objects=s.objects.add(e),s.displayPriority=Math.max(s.displayPriority||0,i||0),s.defaultOpen=Math.max(s.defaultOpen||0,a||0))},a.prototype.insertTabs=function(){function e(e){r&&r===e.name&&(e.defaultOpen=Math.max(~~e.defaultOpen,c.TabOpenFrom.UserSave)),(!a||~~a.defaultOpen<~~e.defaultOpen)&&(a=e),e.labelObject=$('').text(e.localizedName).appendTo(i._tabContainer),e.labelObject.bind("click",function(e){e.preventDefault(),i.switchTab(this,!0)});var t=$('
');e.wrapperObject=$().add(t),e.objects.each(function(i,a){var o=$(a);o.is("table")?(o.data("layout-separated")&&(e.wrapperObject=e.wrapperObject.add('
').add(t=$('
')),o.removeData("layout-separated")),t.append(o),o.children("tbody").each(function(i,o){if(0!==i&&$(o).data("layout-separated")){e.wrapperObject=e.wrapperObject.add('
').add(t=$('
'));var r=$(a).clone(!0,!1).appendTo(t);r.children().remove(),r.append(o),$(o).removeData("layout-separated")}})):t.append(o)}),e.wrapperObject.appendTo(i._container)}function t(e){e.labelObject=$('').text(e.localizedName).appendTo(i._tabContainer),e.labelObject.bind("click",e.callback)}var i,a,o,r;this._tabs&&(this._tabs.sort(function(e,t){return(t.displayPriority||0)-(e.displayPriority||0)}),i=this,a=null,o=this.activeTabSettingsName(),o&&(r=TVSettings.getValue(o)),$.each(this._tabs,function(i,a){a.isButton?t(a):e(a)}),this.switchTab(a))},a.prototype.activeTabSettingsName=function(){var e=this._source;if(e)return e instanceof n?"properties_dialog.active_tab.chart":e instanceof o?"properties_dialog.active_tab.drawing":e instanceof r?"properties_dialog.active_tab.study":void 0},a.prototype.show=function(e){function a(){v.hide(!0)}var u,h,b,f,y,_,g,v,T,m,P,w,S,C,O,D,k,I,x,j,N,V,L,B,z;if(t.enabled("property_pages")&&(u=i(162),e=e||{},h=e.onWidget||!1,TradingView.isInherited(this._source.constructor,n)&&d("GUI","Series Properties"),TradingView.isInherited(this._source.constructor,r)&&d("GUI","Study Properties"), 4 | TradingView.isInherited(this._source.constructor,s)&&this._model.setSelectedSource(this._source),b=u.createStudyStrategyPropertyPage(this._source,this._model),f=u.createInputsPropertyPage(this._source,this._model),y=u.createStylesPropertyPage(this._source,this._model),_=u.createVisibilitiesPropertyPage(this._source,this._model),g=u.createDisplayPropertyPage(this._source,this._model),f&&!f.widget().is(":empty")||y||b))return v=this,T=null!==f,m=this._source.title(),P=TVDialogs.createDialog(m,{hideTitle:!0,dragHandle:".properties-tabs"}),w=P.find("._tv-dialog-content"),S=$('
').appendTo(w),O=[],D=400,this._tabs=O,this._dialog=P,this._dialogTitle=m,this._container=w,this._tabContainer=S,this._undoCheckpointOnShow=this._model.createUndoCheckpoint(),P.on("destroy",function(e,t){var t=t||{};v._onDestroy(e,t),C&&(t.undoChanges?C.restore():C.applyTheme()),f&&f.destroy(),b&&b.destroy(),y&&y.destroy(),g&&g.destroy(),_&&_.destroy(),$("select",w).each(function(){$(this).selectbox("detach")})}),e.selectScales&&y.setScalesOpenTab&&y.setScalesOpenTab(),e.selectTmz&&y.setTmzOpenTab&&y.setTmzOpenTab(),!this._model.readOnly()&&b&&b.widget().each(function(e,t){var i,a,o=+$(t).data("layout-tab-priority");isNaN(o)&&(o=c.TabPriority.Properties),i=~~$(t).data("layout-tab-open"),a=$(t).data("layout-tab"),void 0===a&&(a=c.TabNames.properties),v.appendToTab(t,a,o,i)}),this._model.readOnly()||!T||f.widget().is(":empty")||f.widget().each(function(e,t){var a,o,r=i(81),n=f instanceof r,s=+$(t).data("layout-tab-priority");TradingView.isNaN(s)&&(s=n?c.TabPriority.Coordinates:c.TabPriority.Inputs),a=~~$(t).data("layout-tab-open"),o=$(t).data("layout-tab"),void 0===o&&(o=n?c.TabNames.coordinates:c.TabNames.inputs),v.appendToTab(t,o,s,a)}),y&&y.widget().each(function(e,t){var a,o,r,n=+$(t).data("layout-tab-priority");TradingView.isNaN(n)&&(n=c.TabPriority.Style),a=~~$(t).data("layout-tab-open"),o=i(14),!a&&y instanceof o&&(a=c.TabOpenFrom.Default),r=$(t).data("layout-tab"),void 0===r&&(r=c.TabNames.style),v.appendToTab(t,r,n,a)}),g&&g.widget().each(function(e,t){var i,a,o=+$(t).data("layout-tab-priority");TradingView.isNaN(o)&&(o=c.TabPriority.Display),i=~~$(t).data("layout-tab-open"),a=$(t).data("layout-tab"),void 0===a&&(a=c.TabNames.properties),v.appendToTab(t,a,o,i)}),_&&_.widget().each(function(e,t){v.appendToTab(t,c.TabNames.visibility,c.TabPriority.Display,!1)}),x=this._source instanceof r&&!!this._source.metaInfo().pine,x&&this._source.metaInfo(),this.insertTabs(),this._helpItemRequired()&&this._createHelp(),j=110,$(".js-dialog").each(function(){var e=parseInt($(this).css("z-index"),10);e>j&&(j=e)}),P.css("z-index",j),k=$('
').appendTo(w),I=$('
').appendTo(k),N=function(){function e(t){t._childs&&t._childs.length&&$.each(t._childs,function(i,a){"percentage"===a?t.percentage.listeners().fire(t.percentage):e(t[a])})}var t=[];y&&"function"==typeof y.defaultProperties&&(t=t.concat(y.defaultProperties())), 5 | f&&"function"==typeof f.defaultProperties&&(t=t.concat(f.defaultProperties())),0===t.length&&v._source.properties?t=[v._source.properties()]:v._source._sessionsStudy&&(t=t.concat(v._source._sessionsStudy.properties())),t.length&&($.each(t,function(t,i){"chartproperties"===i._defaultName||v._model.restoreFactoryDefaults(i),v._source.calcIsActualSymbol&&v._source.calcIsActualSymbol(),e(i)}),v._source.properties().minTick&&v._source.properties().minTick.listeners().fire(v._source.properties().minTick),v._source.properties().precision&&v._source.properties().precision.listeners().fire(v._source.properties().precision),f&&f.loadData(),b&&b.loadData(),y.onResoreDefaults&&y.onResoreDefaults(),y&&y.loadData(),_&&_.loadData())},V=function(){_&&_.loadData(),f&&f.loadData()},(!h||window.is_authenticated)&&y&&"function"==typeof y.createTemplateButton&&t.enabled("linetoolpropertieswidget_template_button")?(C&&I[0].appendChild(C.domNode),y.createTemplateButton({popupZIndex:j,defaultsCallback:N,loadTemplateCallback:V}).addClass("tv-left").appendTo(I)):TradingView.isInherited(this._source.constructor,r)?(L=[{title:$.t("Reset Settings"),action:N},{title:$.t("Save As Default"),action:function(){v._source.properties().saveDefaults()}}],B=$(''+$.t("Defaults")+''),B.on("click",function(e){e.preventDefault();var t=$(this);t.is(".active")||t.trigger("button-popup",[L,!0])}).appendTo(I),p(B,null,{direction:"down",event:"button-popup",notCloseOnButtons:!0,zIndex:j})):$(''+$.t("Defaults")+"").appendTo(I).click(N),$(''+$.t("OK")+"").appendTo(I).click(function(){v.hide(),window.saver.saveChartSilently()}),$(''+$.t("Cancel")+"").appendTo(I).on("click",a),P.find("._tv-dialog-title a").on("click",a),$(window).bind("keyup.hidePropertyDialog",function(e){13===e.keyCode&&"textarea"!==e.target.tagName.toLowerCase()&&v.hide()}),$("select",w).each(function(){var e=$(this),t="tv-select-container dialog";e.hasClass("tv-select-container-fontsize")&&(t+=" tv-select-container-fontsize"),e.selectbox({speed:100,classHolder:t})}),$('input[type="text"]',w).addClass("tv-text-input inset dialog"),$("input.ticker",w).TVTicker(),P.css("min-width",D+"px"),TVDialogs.applyHandlers(P,e),z={top:($(window).height()-P.height())/2,left:($(window).width()-P.width())/2},y&&"function"==typeof y.dialogPosition&&(z=y.dialogPosition(z,P)||z),TVDialogs.positionDialog(P,z),window.lineToolPropertiesToolbar&&window.lineToolPropertiesToolbar.hide(),l.emit("edit_object_dialog",{objectType:this._source===this._model.mainSeries()?"mainSeries":this._source instanceof o?"drawing":this._source instanceof r?"study":"other",scriptTitle:this._source.title()}),P},a.prototype._helpItemRequired=function(){return this._source._metaInfo&&!!this._source._metaInfo.helpURL},a.prototype._createHelp=function(){var e=$('') 6 | ;e.attr("href",this._source._metaInfo.helpURL),this._tabContainer.prepend(e)},e.exports=a}).call(t,i(7))}}); -------------------------------------------------------------------------------- /charting_library/static/bundles/eraser.0579d40b812fa2c3ffe72e5803a6e14c.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/bundles/eraser.0579d40b812fa2c3ffe72e5803a6e14c.cur -------------------------------------------------------------------------------- /charting_library/static/bundles/grab.bc156522a6b55a60be9fae15c14b66c5.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/bundles/grab.bc156522a6b55a60be9fae15c14b66c5.cur -------------------------------------------------------------------------------- /charting_library/static/bundles/grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/bundles/grabbing.1c0862a8a8c0fb02885557bc97fdafe7.cur -------------------------------------------------------------------------------- /charting_library/static/bundles/ie-fallback-logos.1e0142e3b30300ec0153.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([10],{695:function(A,h,i){"use strict";Object.defineProperty(h,"__esModule",{value:!0}),h.fallbackImages={tvLogoBlack:i(1348),tvLogoWhite:i(1349)},h.logoSizes={benzingapro:{width:135,height:25},bovespa:{width:135,height:50},cme:{width:175,height:26},currencywiki:{width:135,height:25},dailyfx:{width:135,height:25},fxstreet:{width:137,height:33},investopedia:{width:135,height:23},smartlab:{width:135,height:37},lse:{width:135,height:31},arabictrader:{width:135,height:40},goldprice:{width:135,height:27},silverprice:{width:135,height:27},inbestia:{width:195,height:50},immfx:{width:122,height:26},kitco:{width:130,height:35},enbourse:{width:135,height:40},rankia:{width:65,height:17},stockwatch:{width:135,height:19},tradecapitan:{width:121,height:45}}},1348:function(A,h){A.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAAmCAMAAACmhKjHAAAAXVBMVEUAAAAAAAAAAAAFEhgrg6g4rNsznskLIy0AAAAQMkAdWXIAAAAxlb4UQFEAAAAAAAAAAAAkcI8ujbQgZYEZTWMAAAAAAAAAAAA2pNIAAAAAAAAAAAAoe50AAAA7s+Q2ucaKAAAAHnRSTlMAmU2f2fnspiWswAnms3xCE8zfxrmPhjfybV9W0hyxWOJtAAABrElEQVRIx8WVbbOCIBCFrwmKCpnvlsb//5mXXcrlxcpm7sw9nwx4hrPLgX7+XBchxPdQfU2srlP1BXZLXC1H0WlIfI3HLC+4OC+ZlG1TWnQ6wN0QY/ohzlIYqC+fuBMsa7Qj3lu/71kBa5j2VSZWpzfgmbgd8ly9bKiZ7XUsLrscyVd24dhnva8VujRU+3kxU6V+pbkw07cYE+cE1MKaVql2x7CxO4ZY9YwZcvARkwy81gFnt0sVtkbBt4o5lN8f5MqMLBFInNU1zGcKGHLQBPztKksxi8as286Iy3MzwkMulStsWXnHJ50VKUNnBQ+4TEs/QANURCvy7JEzRQeBHJwlkk6yGXHqsVEPaSD3xUw9miihdlQartNOsStx3OnuSHfQjtnyNjK1Tnrinqd830BuuTwLj4Dh81EShw0SW40SOeXMb9kLkz/DU4LgHV+LbiuPBIPxFUUQNcKrBuVFahBs/AyhVRTcQyovDqiMXDzvxpDYzscqyCl1jG6lIEOhWMN8rtic0jO8Sv1BWQehXbwH/JjiV7IejlHxv1e1jIe2o/pI9+n0XjVQ/6ZfnFlWaxVUZmcAAAAASUVORK5CYII="},1349:function(A,h){A.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADgAAAAmCAMAAACmhKjHAAAAYFBMVEUAAAD////////q9/1ux+tSvOfZ8fr////I6vid2fL///9bwOm45Pb///////////+E0O9jw+mQ1fCq3vT///////9KuOb///////////94y+3///////////////87s+R/+BgSAAAAH3RSTlMAmU2f2eymJazACeazfEITzN/GuY+G8l9WOdJyaRwwr8L7/gAAAaRJREFUSMfFld2SgyAMhZeCP4i11qpV2y7v/5ZLwrgBYls7szN7rhT5hpOQxK8/16kois+h5ia8bnP1AXYVoaa96NyLWMM+y5MA5VoZc261R+cd3BUxZVcpCQvN6R13gG2tDXXxfl+zBexRNpYWXocX4JG4DfJYPU2o+3qxGzJdjuQzu3Dto93WAlnqq+16cZ+0faaxdJ+vHCuOAnSGPee6Pm+gzu6QYtVaZsjBAycVeG0Szh8na0xNDc8151BxfpDTGVkiMOHEPa1PCRgKkoDvoTKJtejMhulkXJ67FcZJs8CRdCV392qCHVKhszLlMmviAuohItqR4+E6DDNHDu4SyaCyFXE1dYUO3Jcj5WimCvWrxnGdDYJdiAuzO1AP+jUMjyS9kwtx6y0/IlBBeGkqVavjCsYEFb8xGuDYpWPtJZwdYZQg+MBp0VF4JLfIWxRB1ABTDcJjagWfQRlaRUEfUni8QA1zsfZGL3zmuUrmNJNBVxZkKJVqVcyV4DQZw4uxb5R1ULRTNMD3iU/Jpt9H8b9XNQ27jqP4SI/vw2s1QP2bfgDhqloD84hV5AAAAABJRU5ErkJggg=="}}); -------------------------------------------------------------------------------- /charting_library/static/bundles/propertypagesfactory.54b21a18753b2d8c83c2.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([11],{162:function(e,r){"use strict";r.createInputsPropertyPage=function(e,r){var t=e.getInputsPropertyPage();return null==t?null:new t(e.properties(),r,e)},r.createStudyStrategyPropertyPage=function(e,r){var t=e.getStrategyPropertyPage();return null==t?null:new t(e.properties(),r,e)},r.createStylesPropertyPage=function(e,r){var t=e.getStylesPropertyPage();return null==t?null:new t(e.properties(),r,e)},r.createDisplayPropertyPage=function(e,r){var t=e.getDisplayPropertyPage();return null==t?null:new t(e.properties(),r,e)},r.createVisibilitiesPropertyPage=function(e,r){var t=e.getVisibilitiesPropertyPage();return null==t?null:new t(e.properties(),r,e)},r.hasInputsPropertyPage=function(e){return null!==e.getInputsPropertyPage()},r.hasStylesPropertyPage=function(e){return null!==e.getStylesPropertyPage()}}}); -------------------------------------------------------------------------------- /charting_library/static/bundles/symbol-info-dialog-impl.a3697f845094a08295ab.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([7],{108:function(e,t,n){"use strict";function o(e){return t=function(t){function n(e,n){var o=t.call(this,e,n)||this;return o._getWrappedComponent=function(e){o._instance=e},o}return i.__extends(n,t),n.prototype.componentDidMount=function(){this._instance.componentWillEnter&&this.context.lifecycleProvider.registerWillEnterCb(this._instance.componentWillEnter.bind(this._instance)),this._instance.componentDidEnter&&this.context.lifecycleProvider.registerDidEnterCb(this._instance.componentDidEnter.bind(this._instance)),this._instance.componentWillLeave&&this.context.lifecycleProvider.registerWillLeaveCb(this._instance.componentWillLeave.bind(this._instance)),this._instance.componentDidLeave&&this.context.lifecycleProvider.registerDidLeaveCb(this._instance.componentDidLeave.bind(this._instance))},n.prototype.render=function(){return r.createElement(e,i.__assign({},this.props,{ref:this._getWrappedComponent}),this.props.children)},n}(r.PureComponent),t.displayName="Lifecycle Consumer",t.contextTypes={lifecycleProvider:s.object},t;var t}var i,r,s,a;Object.defineProperty(t,"__esModule",{value:!0}),i=n(5),r=n(2),s=n(86),a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t}(r.PureComponent),t.LifecycleConsumer=a,t.makeTransitionGroupLifecycleConsumer=o},153:function(e,t){e.exports={body:"body-1yAIljnK-"}},154:function(e,t){e.exports={footer:"footer-AwxgkLHY-"}},155:function(e,t){e.exports={header:"header-2Hz0Lxou-",close:"close-3H_MMLbw-"}},156:function(e,t){e.exports={message:"message-1CYdTy_T-",error:"error-1u_m-Ehm-"}},157:function(e,t){e.exports={dialog:"dialog-13-QRYuG-",rounded:"rounded-1GLivxii-",shadowed:"shadowed-30OTTAts-"}},182:function(e,t,n){"use strict";function o(e){return i.createElement("div",{className:r.body,ref:e.reference},e.children)}var i,r;Object.defineProperty(t,"__esModule",{value:!0}),i=n(2),r=n(153),t.Body=o},183:function(e,t,n){"use strict";var o,i,r,s;Object.defineProperty(t,"__esModule",{value:!0}),o=n(185),t.Header=o.Header,i=n(184),t.Footer=i.Footer,r=n(182),t.Body=r.Body,s=n(186),t.Message=s.Message},184:function(e,t,n){"use strict";function o(e){return i.createElement("div",{className:r.footer,ref:e.reference},e.children)}var i,r;Object.defineProperty(t,"__esModule",{value:!0}),i=n(2),r=n(154),t.Footer=o},185:function(e,t,n){"use strict";function o(e){return i.createElement("div",{className:r.header,"data-dragg-area":!0,ref:e.reference},e.children,i.createElement(a.Icon,{className:r.close,icon:s,onClick:e.onClose}))}var i,r,s,a;Object.defineProperty(t,"__esModule",{value:!0}),i=n(2),r=n(155),s=n(109),a=n(77),t.Header=o},186:function(e,t,n){"use strict";function o(e){var t,n;return e.text?t=i.createElement("span",null,e.text):e.html&&(t=i.createElement("span",{dangerouslySetInnerHTML:{__html:e.html}})),n=r.message,e.isError&&(n+=" "+r.error),i.createElement(s.CSSTransitionGroup,{transitionName:"message",transitionEnterTimeout:u.dur,transitionLeaveTimeout:u.dur},t?i.createElement("div",{className:n,key:"0" 2 | },i.createElement(a.OutsideEvent,{mouseDown:!0,touchStart:!0,handler:e.onClickOutside},t)):null)}var i,r,s,a,u;Object.defineProperty(t,"__esModule",{value:!0}),i=n(2),r=n(156),s=n(46),a=n(107),u=n(28),t.Message=o},187:function(e,t,n){"use strict";function o(e){var t,n=e.rounded,o=void 0===n||n,a=e.shadowed,u=void 0===a||a,l=e.className,c=void 0===l?"":l,d=s(r.dialog,(t={},t[c]=!!c,t[r.rounded]=o,t[r.shadowed]=u,t[r.animated]=r.animated,t)),p={bottom:e.bottom,left:e.left,maxWidth:e.width,right:e.right,top:e.top,zIndex:e.zIndex};return i.createElement("div",{className:d,ref:e.reference,style:p,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onClick:e.onClick},e.children)}var i,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i=n(2),r=n(157),s=n(26),t.Dialog=o},188:function(e,t,n){"use strict";function o(){d=document.createElement("div"),document.body.appendChild(d),r()}function i(e,t){p.getItems().forEach(function(n){n!==t&&f.emitEvent(e+":"+n)})}function r(e){a.render(s.createElement(u.TransitionGroup,{component:"div"},Array.from(m.values())),d,e)}var s,a,u,l,c,d,p,h,f,m;Object.defineProperty(t,"__esModule",{value:!0}),s=n(2),a=n(55),u=n(46),l=n(110),c=function(){function e(){this._storage=[]}return e.prototype.add=function(e){this._storage.push(e)},e.prototype.remove=function(e){this._storage=this._storage.filter(function(t){return e!==t})},e.prototype.getIndex=function(e){return this._storage.findIndex(function(t){return e===t})},e.prototype.toTop=function(e){this.remove(e),this.add(e)},e.prototype.has=function(e){return this._storage.includes(e)},e.prototype.getItems=function(){return this._storage},e}(),t.EVENTS={ZindexUpdate:"ZindexUpdate"},p=new c,h=150,f=new l,m=new Map,function(e){function n(e){p.has(e)||(p.add(e),i(t.EVENTS.ZindexUpdate,e))}function o(e){p.remove(e),m.delete(e)}function s(e){return p.getIndex(e)+h}function a(e,t,n){m.set(e,t),r(n)}function u(e,t){o(e),r(t)}function l(){return f}e.registerWindow=n,e.unregisterWindow=o,e.getZindex=s,e.renderWindow=a,e.removeWindow=u,e.getStream=l}(t.OverlapManager||(t.OverlapManager={})),o()},189:function(e,t,n){"use strict";function o(e){return t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return r.__extends(n,t),n.prototype.componentWillEnter=function(e){this.props.beforeOpen?this.props.beforeOpen(e):e()},n.prototype.componentDidEnter=function(){this.props.afterOpen&&this.props.afterOpen()},n.prototype.componentWillLeave=function(e){this.props.beforeClose?this.props.beforeClose(e):e()},n.prototype.componentDidLeave=function(){this.props.afterClose&&this.props.afterClose()},n.prototype.render=function(){return s.createElement(e,r.__assign({},this.props))},n}(s.PureComponent),t.displayName="OverlapLifecycle("+(e.displayName||"Component")+")",t;var t}function i(e){var t,n=l.makeTransitionGroupLifecycleProvider(c.makeTransitionGroupLifecycleConsumer(o(e)));return t=function(e){function t(t){var n=e.call(this,t)||this;return n._onZIndexUpdate=function(){ 3 | n.props.isOpened&&("parent"===n.props.root?n.forceUpdate():n._renderWindow(n.props))},n._uuid=d.guid(),n._zIndexUpdateEvent=u.EVENTS.ZindexUpdate+":"+n._uuid,n}return r.__extends(t,e),t.prototype.componentDidMount=function(){this._subscribe()},t.prototype.componentWillUnmount=function(){this._unsubscribe(),u.OverlapManager.removeWindow(this._uuid)},t.prototype.componentWillReceiveProps=function(e){"parent"!==this.props.root&&this._renderWindow(e)},t.prototype.render=function(){return"parent"===this.props.root?s.createElement(a.TransitionGroup,{component:"div"},this._createContent(this.props)):null},t.prototype._renderWindow=function(e){u.OverlapManager.renderWindow(this._uuid,this._createContent(e))},t.prototype._createContent=function(e){return e.isOpened?(u.OverlapManager.registerWindow(this._uuid),s.createElement(n,r.__assign({},e,{key:this._uuid,zIndex:u.OverlapManager.getZindex(this._uuid)}),e.children)):(u.OverlapManager.unregisterWindow(this._uuid),null)},t.prototype._subscribe=function(){u.OverlapManager.getStream().on(this._zIndexUpdateEvent,this._onZIndexUpdate)},t.prototype._unsubscribe=function(){u.OverlapManager.getStream().off(this._zIndexUpdateEvent,this._onZIndexUpdate)},t}(s.PureComponent),t.displayName="Overlapable("+(e.displayName||"Component")+")",t}var r,s,a,u,l,c,d;Object.defineProperty(t,"__esModule",{value:!0}),r=n(5),s=n(2),a=n(46),u=n(188),l=n(191),c=n(108),d=n(64),t.makeOverlapable=i},191:function(e,t,n){"use strict";function o(e){return t=function(t){function n(e){var n=t.call(this,e)||this;return n._registerWillEnterCb=function(e){n._willEnter.push(e)},n._registerDidEnterCb=function(e){n._didEnter.push(e)},n._registerWillLeaveCb=function(e){n._willLeave.push(e)},n._registerDidLeaveCb=function(e){n._didLeave.push(e)},n._willEnter=[],n._didEnter=[],n._willLeave=[],n._didLeave=[],n}return i.__extends(n,t),n.prototype.getChildContext=function(){return{lifecycleProvider:{registerWillEnterCb:this._registerWillEnterCb,registerDidEnterCb:this._registerDidEnterCb,registerWillLeaveCb:this._registerWillLeaveCb,registerDidLeaveCb:this._registerDidLeaveCb}}},n.prototype.componentWillEnter=function(e){var t=this._willEnter.map(function(e){return new Promise(function(t){e(t)})});Promise.all(t).then(e)},n.prototype.componentDidEnter=function(){this._didEnter.forEach(function(e){e()})},n.prototype.componentWillLeave=function(e){var t=this._willLeave.map(function(e){return new Promise(function(t){e(t)})});Promise.all(t).then(e)},n.prototype.componentDidLeave=function(){this._didLeave.forEach(function(e){e()})},n.prototype.render=function(){return r.createElement(e,i.__assign({},this.props),this.props.children)},n}(r.PureComponent),t.displayName="Lifecycle Provider",t.childContextTypes={lifecycleProvider:s.object},t;var t}var i,r,s;Object.defineProperty(t,"__esModule",{value:!0}),i=n(5),r=n(2),s=n(86),t.makeTransitionGroupLifecycleProvider=o},256:function(e,t){e.exports={dialog:"dialog-2MaUXXMw-",dragging:"dragging-3oeGgbIQ-"}},323:function(e,t){"use strict";function n(e,t,n){return e+t>n&&(e=n-t), 4 | e<0&&(e=0),e}function o(e){return{x:e.pageX,y:e.pageY}}function i(e){return{x:e.touches[0].pageX,y:e.touches[0].pageY}}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){var n=this;this._drag=null,this._onMouseDragStart=function(e){e.preventDefault(),n._dragStart(o(e))},this._onTouchDragStart=function(e){n._dragStart(i(e))},this._onMouseDragMove=function(e){n._dragMove(o(e))},this._onTouchDragMove=function(e){e.preventDefault(),n._dragMove(i(e))},this._onDragStop=function(){n._drag=null,n._header.classList.remove("dragging")},this._dialog=e,this._header=t,t.addEventListener("mousedown",this._onMouseDragStart),t.addEventListener("touchstart",this._onTouchDragStart),document.addEventListener("mousemove",this._onMouseDragMove),document.addEventListener("touchmove",this._onTouchDragMove),document.addEventListener("mouseup",this._onDragStop),document.addEventListener("touchend",this._onDragStop)}return e.prototype.destroy=function(){this._header.removeEventListener("mousedown",this._onMouseDragStart),this._header.removeEventListener("touchstart",this._onTouchDragStart),document.removeEventListener("mousemove",this._onMouseDragMove),document.removeEventListener("touchmove",this._onTouchDragMove),document.removeEventListener("mouseup",this._onDragStop),document.removeEventListener("touchend",this._onDragStop)},e.prototype._dragStart=function(e){var t=this._dialog.getBoundingClientRect();this._drag={startX:e.x,startY:e.y,dialogX:t.left,dialogY:t.top},this._dialog.style.left=t.left+"px",this._dialog.style.top=t.top+"px",this._header.classList.add("dragging")},e.prototype._dragMove=function(e){var t,n;this._drag&&(t=e.x-this._drag.startX,n=e.y-this._drag.startY,this._moveDialog(this._drag.dialogX+t,this._drag.dialogY+n))},e.prototype._moveDialog=function(e,t){var o=this._dialog.getBoundingClientRect();this._dialog.style.left=n(e,o.width,window.innerWidth)+"px",this._dialog.style.top=n(t,o.height,window.innerHeight)+"px"},e}();t.DragHandler=r},324:function(e,t,n){"use strict";var o,i,r,s,a,u,l,c,d,p,h;Object.defineProperty(t,"__esModule",{value:!0}),o=n(5),i=n(2),r=n(187),s=n(189),a=n(108),u=n(107),l=n(256),c=n(323),d=n(325),p=n(26),h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._setDialog=function(e){e&&(t._dialog=e)},t}return o.__extends(t,e),t.prototype.render=function(){return i.createElement("span",{style:{zIndex:this.props.zIndex}},i.createElement(u.OutsideEvent,{mouseDown:!0,touchStart:!0,handler:this.props.onClickOutside},i.createElement(r.Dialog,o.__assign({},this.props,{reference:this._setDialog,className:p(l.dialog,this.props.className)}),this.props.children)))},t.prototype.componentDidMount=function(){if(this._dialog){var e=this._dialog.querySelector("[data-dragg-area]");e&&(this._drag=new c.DragHandler(this._dialog,e)),this._resize=new d.ResizeHandler(this._dialog)}},t.prototype.componentWillEnter=function(e){this._resize&&this._resize.position(),e()},t.prototype.componentWillUnmount=function(){this._drag&&this._drag.destroy(), 5 | this._resize&&this._resize.destroy()},t}(i.PureComponent),t.PopupDialog=s.makeOverlapable(a.makeTransitionGroupLifecycleConsumer(h))},325:function(e,t){"use strict";function n(e,t,n){return e+t>n&&(e=n-t),e<0&&(e=0),e}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e){this._onResizeThrottled=requestAnimationFrame.bind(null,this._onResize.bind(this)),this._dialog=e,this._initialHeight=e.style.height,window.addEventListener("resize",this._onResizeThrottled)}return e.prototype.position=function(){var e,t=this._dialog.getBoundingClientRect(),n=window.innerWidth/2-t.width/2;this._dialog.style.left=n+"px",e=window.innerHeight/2-t.height/2,this._dialog.style.top=e+"px"},e.prototype.destroy=function(){window.removeEventListener("resize",this._onResizeThrottled)},e.prototype._onResize=function(){var e,t=this._dialog.getBoundingClientRect(),o=n(t.left,t.width,window.innerWidth);o!==t.left&&(this._dialog.style.left=o+"px"),e=n(t.top,t.height,window.innerHeight),e!==t.top&&(this._dialog.style.top=e+"px"),this._dialog.style.height=window.innerHeight")}function u(e){return e||"-"}function l(e,t){var n,o,i,r,s=0;for(n=0;n0&&!e.fractional&&e.pricescale?(t[n].value=new x(e.pricescale/i).format(i/e.pricescale),t[n].title=$.t("Pip Size")):t[n].value=(t[n].formatter||u)(i),s++) 6 | ;return r=e.type&&"economic"===e.type||e.listed_exchange&&["QUANDL","BSE_EOD","NSE_EOD","LSE_EOD"].indexOf(e.listed_exchange)>=0,r&&c(t),s}function c(e){for(var t=0;tO.minutesPerDay&&(e-=O.minutesPerDay),t=e%60,n=(e-t)/60,P(n,2)+":"+P(t,2)}function p(e){return e.reduce(function(e,t){var n=d(t.alignedStart())+"-"+d(t.alignedStart()+t.length()),o=t.dayOfWeek();return e.hasOwnProperty(n)?e[n].push(o):e[n]=[o],e},{})}function h(e){return e.match(W)[0]}function f(e,t){var n=h(e),o=h(t);return T[n]>T[o]}function m(t,n,o){return void 0===o?e.weekdaysMin(n-1)+" "+t:e.weekdaysMin(n-1)+"-"+e.weekdaysMin(o-1)+" "+t}function _(e){return 1===e?7:e-1}function g(e,t,n){return n?m(e,_(t),t):m(e,t)}function v(e,t){if(t){var n=e[0];e.unshift(_(n))}}function y(e){var t=p(e);return Object.keys(t).reduce(function(e,n){var o,i=t[n].sort(),r=n.split("-"),s=O.get_minutes_from_hhmm(r[0]),a=O.get_minutes_from_hhmm(r[1]),u=s>=a;return 1===i.length?(v(i,u),e.push(m(n,i[0]))):(o=[],i.forEach(function(t,r){var s=i[r+1];s&&t===s-1?o.push(t):t!==o[o.length-1]+1?e.push(g(n,t,u)):(o.push(t),v(o,u),e.push(m(n,o[0],o[o.length-1])),o.splice(0,o.length))})),e},[]).sort(f)}var E,b=n(97),w=n(226).availableTimezones,x=n(41).PriceFormatter,M=n(64),D=n(2),C=n(55),L=n(1104).SymbolInfoDialog,S=n(480).ExchangeSession,O=n(67),P=n(41).numberToStringWithLeadingZero,N=[2,3,4,5,6,7,1].map(function(t){return e.weekdaysMin(t-1)}),W=RegExp(N.join("|")),T=N.reduce(function(e,t,n){return e[t]=n+1,e},{});t.showSymbolInfoDialog=i}).call(t,n(36),n(7))},659:function(e,t){e.exports={content:"content-2c3hRn22-",row:"row-2r-bcyH5-",column:"column-2wM_iSMS-",title:"title-2kFlsSZg-",value:"value-lS6fGKoI-",columnTitle:"columnTitle-3tZ4a3rW-",columnValue:"columnValue-2hg99RGl-"}},1104:function(e,t,n){"use strict";function o(e){var t=e.value||e.defValue||"-";return e.setHtml?r.createElement("span",{dangerouslySetInnerHTML:{__html:t}}):t}var i,r,s,a,u,l,c,d;Object.defineProperty(t,"__esModule",{value:!0}),i=n(5),n(23),r=n(2),s=n(324),a=n(183),u=n(659),l=n(26),c=n(234),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.render=function(){return r.createElement(s.PopupDialog,{isOpened:this.props.isOpened,onClickOutside:this.props.onClose},r.createElement(a.Header,{onClose:this.props.onClose},window.t("Symbol Info")),r.createElement(a.Body,null,r.createElement(c.KeyboardDocumentListener,{keyCode:27,handler:this.props.onClose}),r.createElement("div",{className:u.content},this._renderFields())))},t.prototype._renderFields=function(){return this.props.fields?this.props.fields.map(function(e){return r.createElement("div",{key:e.propName,className:u.row},r.createElement("div",{className:l(u.column,u.columnTitle)},r.createElement("span",{className:u.title},e.title)),r.createElement("div",{className:l(u.column,u.columnValue)},r.createElement("span",{className:u.value},o(e))))}):[]},t}(r.PureComponent),t.SymbolInfoDialog=d}}); -------------------------------------------------------------------------------- /charting_library/static/bundles/vendors.a94ef44ed5c201cefcf6ad7460788c1a.css: -------------------------------------------------------------------------------- 1 | @keyframes highlight-animation{0%{background:transparent}to{background:#fff2cf}}@keyframes highlight-animation-theme-dark{0%{background:transparent}to{background:#194453}} -------------------------------------------------------------------------------- /charting_library/static/bundles/zoom.e21f24dd632c7069139bc47ae89c54b5.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/bundles/zoom.e21f24dd632c7069139bc47ae89c54b5.cur -------------------------------------------------------------------------------- /charting_library/static/chart.css: -------------------------------------------------------------------------------- 1 | .chart-page .chart-container { 2 | border: none !important; 3 | } 4 | 5 | .chart-page { 6 | background-color: #fff !important; 7 | } 8 | -------------------------------------------------------------------------------- /charting_library/static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /charting_library/static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /charting_library/static/images/balloon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/balloon.png -------------------------------------------------------------------------------- /charting_library/static/images/bar-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/bar-loader.gif -------------------------------------------------------------------------------- /charting_library/static/images/button-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/button-bg.png -------------------------------------------------------------------------------- /charting_library/static/images/charting_library/logo-widget-copyright-faded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/charting_library/logo-widget-copyright-faded.png -------------------------------------------------------------------------------- /charting_library/static/images/charting_library/logo-widget-copyright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/charting_library/logo-widget-copyright.png -------------------------------------------------------------------------------- /charting_library/static/images/controlll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/controlll.png -------------------------------------------------------------------------------- /charting_library/static/images/delayed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/delayed.png -------------------------------------------------------------------------------- /charting_library/static/images/dialogs/checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/dialogs/checkbox.png -------------------------------------------------------------------------------- /charting_library/static/images/dialogs/close-flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/dialogs/close-flat.png -------------------------------------------------------------------------------- /charting_library/static/images/dialogs/large-slider-handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/dialogs/large-slider-handle.png -------------------------------------------------------------------------------- /charting_library/static/images/dialogs/linewidth-slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/dialogs/linewidth-slider.png -------------------------------------------------------------------------------- /charting_library/static/images/dialogs/opacity-slider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/dialogs/opacity-slider.png -------------------------------------------------------------------------------- /charting_library/static/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/icons.png -------------------------------------------------------------------------------- /charting_library/static/images/prediction-clock-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/prediction-clock-black.png -------------------------------------------------------------------------------- /charting_library/static/images/prediction-clock-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/prediction-clock-white.png -------------------------------------------------------------------------------- /charting_library/static/images/prediction-failure-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/prediction-failure-white.png -------------------------------------------------------------------------------- /charting_library/static/images/prediction-success-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/prediction-success-white.png -------------------------------------------------------------------------------- /charting_library/static/images/select-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/select-bg.png -------------------------------------------------------------------------------- /charting_library/static/images/sidetoolbar/instruments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/sidetoolbar/instruments.png -------------------------------------------------------------------------------- /charting_library/static/images/sidetoolbar/toolgroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/sidetoolbar/toolgroup.png -------------------------------------------------------------------------------- /charting_library/static/images/svg/chart/bucket2.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /charting_library/static/images/svg/chart/font.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /charting_library/static/images/svg/chart/large-slider-handle.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /charting_library/static/images/svg/chart/pencil2.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /charting_library/static/images/svg/question-mark-rounded.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /charting_library/static/images/tvcolorpicker-bg-gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/tvcolorpicker-bg-gradient.png -------------------------------------------------------------------------------- /charting_library/static/images/tvcolorpicker-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/tvcolorpicker-bg.png -------------------------------------------------------------------------------- /charting_library/static/images/tvcolorpicker-check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/tvcolorpicker-check.png -------------------------------------------------------------------------------- /charting_library/static/images/tvcolorpicker-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/tvcolorpicker-sprite.png -------------------------------------------------------------------------------- /charting_library/static/images/warning-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/webkonglong/TV/9adcf18dd77ab58a602423d2868c007404f6ea45/charting_library/static/images/warning-icon.png -------------------------------------------------------------------------------- /charting_library/static/js/external/spin.min.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | //fgnass.github.com/spin.js#v2.0.1 3 | !function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return l[e]||(m.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",m.cssRules.length),l[e]=1),e}function d(a,b){var c,d,e=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d',c)}m.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:k+" "+k,coordorigin:-j+" "+-j}),{width:k,height:k})}function h(a,h,i){b(m,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~h}),b(e(c("roundrect",{arcsize:d.corners}),{width:j,height:d.width,left:d.radius,top:-d.width>>1,filter:i}),c("fill",{color:g(d.color,a),opacity:d.opacity}),c("stroke",{opacity:0}))))}var i,j=d.length+d.width,k=2*j,l=2*-(d.width+d.length)+"px",m=e(f(),{position:"absolute",top:l,left:l});if(d.shadow)for(i=1;i<=d.lines;i++)h(i,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(i=1;i<=d.lines;i++)h(i);return b(a,m)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d>1)+"px"})}for(var i,k=0,l=(f.lines-1)*(1-f.direction)/2;k
-------------------------------------------------------------------------------- /datafeed.js: -------------------------------------------------------------------------------- 1 | // import socket from './socket.js'; 2 | // import Event from './event.js' 3 | 4 | /*********************************************/ 5 | 6 | // 次文件只需要关注 getBars 和 subscribeBars 函数即可 7 | 8 | /******************************************/ 9 | 10 | // 历史数据 第一条数据的 时间撮 因为k线图一次性历史数据只拿一部分,用户吧图往前滑动,就会用这个时间撮去请求更早的 历史数据 11 | var detafeed_historyTime = 0 12 | // 上一次的 K线周期 切换产品的时候 需要从websock 取消订阅这个 13 | var detafeed_lastResolution = null 14 | // 上一次的产品 切换产品的时候 需要从websock 取消订阅这个 15 | var detafeed_lastSymbol = null 16 | 17 | 18 | function FeedBase () {} 19 | 20 | FeedBase.prototype.onReady = function (callback) { 21 | callback(this._configuration) 22 | } 23 | 24 | FeedBase.prototype.getSendSymbolName = function (symbolName) { 25 | var name = symbolName.split('/') 26 | return (name[0] + name[1]).toLocaleLowerCase() 27 | } 28 | 29 | FeedBase.prototype.resolveSymbol = function (symbolName, onResolve, onError) { 30 | onResolve({ 31 | "name": symbolName, 32 | "timezone": "Asia/Shanghai", 33 | "pricescale": 100, 34 | "minmov": 1, 35 | "minmov2": 0, 36 | "ticker": symbolName, 37 | "description": "", 38 | "session": "24x7", 39 | "type": "bitcoin", 40 | "volume_precision": 10, 41 | "has_intraday": true, 42 | "intraday_multipliers": ['1', '3', '5', '15', '30', '60', '240', '360', '1D'], 43 | "has_weekly_and_monthly": false, 44 | "has_no_volume": false, 45 | "regular_session": "24x7" 46 | }) 47 | } 48 | 49 | FeedBase.prototype.getApiTime = function (resolution) { 50 | switch (resolution) { 51 | case '1': 52 | return 'M1' 53 | case '3': 54 | return 'M3' 55 | case '5': 56 | return 'M5' 57 | case '15': 58 | return 'M15' 59 | case '30': 60 | return 'M30' 61 | case '60': 62 | return 'H1' 63 | case '240': 64 | return 'H4' 65 | case '360': 66 | return 'H6' 67 | case '1D': 68 | return 'D1' 69 | default: 70 | return 'M1' 71 | } 72 | } 73 | 74 | FeedBase.prototype.getBars = function (symbolInfo, resolution, rangeStartDate, rangeEndDate, onResult, onError) { 75 | // 切换产品周期 或者 切换产品 会执行这个函数 76 | 77 | // 是历史数据 78 | var history = true 79 | 80 | /* 81 | !detafeed_historyTime 如果没请请求过这个产品或者这个周期的历史数据 82 | resolution !== detafeed_lastResolution 是否更换了产品周期 83 | detafeed_lastSymbol !== symbolInfo.name 是否切换了产品 84 | */ 85 | 86 | if (!detafeed_historyTime || (resolution !== detafeed_lastResolution) || detafeed_lastSymbol !== symbolInfo.name) { 87 | // 那就不是历史数据 88 | history = false 89 | // 储存请求过的产品 90 | detafeed_lastSymbol = symbolInfo.name 91 | // 记录目前时间搓,就用目前的目前时间搓往前请求历史数据 92 | detafeed_historyTime = window.parseInt((Date.now() / 1000)) 93 | } 94 | 95 | 96 | /* 97 | @socket.sendData 98 | 第一个参数订阅历史数据 99 | 第二个参数订阅实时数据 100 | 第三个参数 是 是否是历史数据 101 | */ 102 | socket.sendData({ 103 | args: [`candle.${this.getApiTime(resolution)}.${this.getSendSymbolName(symbolInfo.name)}`, 1441, detafeed_historyTime], 104 | cmd: 'req', 105 | id: '0a0493f7-80d4-4d1a-9d98-6da9ae9d399e' 106 | }, `candle.${this.getApiTime(resolution)}.${this.getSendSymbolName(symbolInfo.name)}`, history) 107 | Event.off('data') 108 | 109 | Event.on('data', data => { 110 | if (data.data && Array.isArray(data.data)) { 111 | // 记录这次请求的时间周期 112 | detafeed_lastResolution = resolution 113 | var meta = {noData: false} 114 | var bars = [] 115 | if (data.data.length) { 116 | detafeed_historyTime = data.data[0].id - 1 117 | for (var i = 0; i < data.data.length; i += 1) { 118 | bars.push({ 119 | time: data.data[i].id * 1000, 120 | close: data.data[i].close, 121 | open: data.data[i].open, 122 | high: data.data[i].high, 123 | low: data.data[i].low, 124 | volume: data.data[i].base_vol 125 | }) 126 | } 127 | } else { 128 | meta = {noData: true} 129 | } 130 | onResult(bars, meta) 131 | } 132 | }) 133 | } 134 | 135 | 136 | FeedBase.prototype.subscribeBars = function (symbolInfo, resolution, onTick, listenerGuid, onResetCacheNeededCallback) { 137 | Event.off('realTime') 138 | 139 | // 拿到实时数据 在这里画 140 | Event.on('realTime', data => { 141 | if (Object.prototype.toString.call(data) === '[object Object]' && data.hasOwnProperty('open')) { 142 | onTick({ 143 | time: data.id * 1000, 144 | close: data.close, 145 | open: data.open, 146 | high: data.high, 147 | low: data.low, 148 | volume: data.base_vol 149 | }) 150 | } 151 | }) 152 | } 153 | 154 | FeedBase.prototype.unsubscribeBars = function (listenerGuid) { 155 | // 取消订阅产品的callback 156 | } 157 | -------------------------------------------------------------------------------- /event.js: -------------------------------------------------------------------------------- 1 | var Event = { 2 | EVENT: {}, 3 | emit (eventName, resp) { 4 | if (this.EVENT[eventName] && Object.prototype.toString.call(this.EVENT[eventName]) === "[object Array]") { 5 | for (let i = 0, fn; fn = this.EVENT[eventName][i++];) { 6 | fn(resp) 7 | } 8 | } 9 | }, 10 | on (name, fn) { 11 | if (this.EVENT[name] && Object.prototype.toString.call(this.EVENT[name]) === "[object Array]") { 12 | this.EVENT[name].push(fn) 13 | } else { 14 | this.EVENT[name] = [fn] 15 | } 16 | }, 17 | off (name) { 18 | this.EVENT[name] = null 19 | } 20 | } -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | kyubey 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 117 | 118 |
119 |
120 | BTC/USDT 121 | ETH/USDT 122 | BCH/USDT 123 | EOS/USDT 124 | ETC/USDT 125 |
126 |
127 |
128 | M1 129 | M3 130 | M5 131 | M15 132 | M30 133 | H1 134 | H4 135 | H6 136 | D1 137 |
138 |
139 |
140 |
141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | // 图表库实例化后储存的函数 2 | var widget = null 3 | // 进入页面 默认展示的产品 4 | var index_market = 'BTC/USDT' 5 | // 进入页面 默认展示的产品周期 6 | var index_activeCycle = '1' 7 | 8 | 9 | // window.TradingView.onready 确保在html的dom加载完成后在调用 10 | window.TradingView.onready(function () { 11 | // chartConfig 在chartConfig.js里面 12 | // 给chartConfig添加展示周期 13 | chartConfig.interval = index_activeCycle 14 | // 给chartConfig添加展示产品 15 | chartConfig.symbol = index_market 16 | 17 | // 初始化 TradingView 18 | widget = new window.TradingView.widget(chartConfig) 19 | 20 | widget && widget.onChartReady && widget.onChartReady(function () { 21 | // 这是k线图 展示的 7日均线和30日均线。 22 | widget.chart().createStudy('Moving Average', false, false, [7], null, {'Plot.linewidth': 2, 'Plot.color': '#2ba7d6'}) 23 | widget.chart().createStudy('Moving Average', false, false, [30], null, {'Plot.linewidth': 2, 'Plot.color': '#de9f66'}) 24 | }) 25 | }) 26 | 27 | 28 | var marketDom = document.getElementById('market') 29 | var intervalDom = document.getElementById('interval') 30 | 31 | // 切换产品 32 | marketDom.addEventListener('click', function (e) { 33 | // e.target.innerHTML 就是我们拿到的产品 34 | // 1是 1分钟数据 35 | widget.setSymbol(e.target.innerHTML, 1) 36 | 37 | // 这个函数不用看,我为了样式好看 写一个添加删除class 38 | addClass(marketDom, e.target) 39 | }, false) 40 | 41 | // 切换产品周期 42 | intervalDom.addEventListener('click', function (e) { 43 | // e.target.dataset.value 这个就是获取的产品的周期 44 | widget.chart().setResolution(e.target.dataset.value) 45 | 46 | 47 | // 这个函数不用看,我为了样式好看 写一个添加删除class 48 | addClass(intervalDom, e.target) 49 | }, false) 50 | 51 | 52 | 53 | 54 | // 单纯的写一个添加class的函数,这个不用看 没用 55 | function addClass (fatherDom, dom) { 56 | [...fatherDom.getElementsByTagName('span')].forEach(function(item){ 57 | item.className = '' 58 | }) 59 | dom.className = 'active' 60 | } -------------------------------------------------------------------------------- /websocket.js: -------------------------------------------------------------------------------- 1 | // import Event from './event.js' 2 | 3 | var socket = { 4 | socket: null, // socket name 5 | realTimeData: null, // 请求实时数据的参数 6 | intervalObj: null, // 定时器的名字 7 | lastRealTimeData: null, // 上一次请求的产品 8 | 9 | sendData(historyData, realTimeDatas, history) { 10 | // 储存历史数据 11 | this.historyData = historyData 12 | this.realTimeData = realTimeDatas 13 | 14 | // 如果上一次订阅过产品 15 | if (this.lastRealTimeData) { 16 | // 如果不是订阅历史产品 那么肯定就是切换周期咯 或者切换产品咯 17 | // 那么就取消订阅上一次的产品实时数据 18 | !history && this.sendWsRequest({ 19 | args: [this.lastRealTimeData], 20 | cmd: 'unsub' 21 | }) 22 | 23 | // 请求这一次的历史 24 | this.sendWsRequest(this.historyData) 25 | 26 | // 如果不是订阅历史产品 那么肯定就是切换周期咯 或者切换产品咯 27 | // 那么就订阅一下 这次产品的或者周期的 实时数据 28 | !history && this.sendWsRequest({ 29 | args: [this.realTimeData], 30 | cmd: 'sub', 31 | id : 'fd0823a5-e16b-4f46-8b68-3fd723beb321' 32 | }) 33 | } else { 34 | 35 | // 如果是第一次订阅,就是说刚进入交易所, 36 | // 先存起来这一次请求的产品 作为历史产品 37 | this.lastRealTimeData = this.realTimeData 38 | // 然后 初始化一下websocket 39 | this.initWs(historyData) 40 | } 41 | }, 42 | initWs () { 43 | this.socket = new WebSocket('wss://api.ifukang.com/v2/ws') 44 | this.socket.onopen = () => { 45 | this.sendWsRequest(this.historyData) 46 | this.sendWsRequest({ 47 | args: [this.realTimeData], 48 | cmd: 'sub', 49 | id : 'fd0823a5-e16b-4f46-8b68-3fd723beb321' 50 | }) 51 | } 52 | this.socket.onmessage = resp => { 53 | this.message(resp) 54 | } 55 | this.socket.onclose = () => { 56 | this.close() 57 | } 58 | this.socket.onerror = err => { 59 | this.error(err) 60 | } 61 | }, 62 | error (err) { 63 | console.log(err, 'depth-socket::error') 64 | }, 65 | close () { 66 | // 如果websocket关闭的话,就从新打开一下。 67 | this.initWs() 68 | console.log('depth-socket::close') 69 | }, 70 | message (resp) { 71 | // 拿到数据。 72 | // 吧这次请求的产品 储存成历史产品 73 | this.lastRealTimeData = this.realTimeData 74 | var data = JSON.parse(resp.data.replace(/\r/g, '').replace(/\n/g, '')) 75 | Event.emit('realTime', data) 76 | Event.emit('data', data) 77 | }, 78 | checkSendMessage(options) { 79 | // 这里处理websocket 连接不上的问题 80 | var checkTimes = 10 81 | var i = 0 82 | this.intervalObj = setInterval(() => { 83 | i += 1 84 | if (this.socket.readyState === 1) { 85 | // ... 86 | this.socket.send(options) 87 | clearInterval(this.intervalObj) 88 | return 89 | } 90 | if (i >= checkTimes) { 91 | clearInterval(this.intervalObj) 92 | console.log('send post_data_str timeout.') 93 | } 94 | }, 500) 95 | }, 96 | sendWsRequest (options) { 97 | switch (this.socket.readyState) { 98 | case 0: 99 | this.checkSendMessage(JSON.stringify(options)) 100 | break 101 | case 1: 102 | this.socket.send(JSON.stringify(options)) 103 | break 104 | case 2: 105 | console.log('ws关闭状态') 106 | break 107 | case 3: 108 | this.initWs() 109 | break 110 | default: 111 | console.log('ws未知错误') 112 | } 113 | } 114 | } 115 | 116 | // export default socket 117 | --------------------------------------------------------------------------------