function Datafeed(vue) { this.vue = vue; } Datafeed.prototype.onReady = function(callback) { setTimeout(() => { callback({ // exchanges: [ // // 交易所数组 // {value: '火币网', name: '火币网', desc: ''}, // {value: '博客卫得', name: '博客卫得', desc: ''}, // ], // symbols_types: [ // // 商品类型过滤器数组 // {name: 'USDT', value: 'USDT'}, // {name: 'BTC', value: 'BTC'}, // {name: 'ETH', value: 'ETH'}, // ], supports_search: false, supports_group_request: true, supported_resolutions: [1, 5, 15, 30, 60, 240, 720, 'D', '2D', 'W', 'M'], supports_marks: true, supports_timescale_marks: true, supports_time: true, }); }, 500); }; Datafeed.prototype.searchSymbols = function( userInput, exchange, symbolType, onResultReadyCallback ) {}; Datafeed.prototype.resolveSymbol = function( symbolName, onSymbolResolvedCallback, onResolveErrorCallback ) { new Promise(() => { setTimeout(() => { onSymbolResolvedCallback(this.vue.billinfo()); }, 500); }); }; Datafeed.prototype.getBars = function( symbolInfo, resolution, from, to, onHistoryCallback, onErrorCallback, firstDataRequest ) { this.vue.interval = resolution; const onDataCallback = data => { if (data && data.length) { onHistoryCallback(data, {noData: false}); } else { onHistoryCallback([], {noData: true}); } }; this.vue.getBars( symbolInfo, resolution, from, to, onHistoryCallback, onDataCallback ); }; Datafeed.prototype.subscribeBars = function( symbolInfo, resolution, onRealtimeCallback, subscriberUID, onResetCacheNeededCallback ) { this.vue.subscribeBars(onRealtimeCallback); }; Datafeed.prototype.unsubscribeBars = function(subscriberUID) { // clearInterval(this.vue.subInterval); }; Datafeed.prototype.calculateHistoryDepth = function( resolution, resolutionBack, intervalBack ) { localStorage.setItem('resolution', resolution); return { resolutionBack: 'M', intervalBack: 24, }; }; Datafeed.prototype.getMarks = function( symbolInfo, startDate, endDate, onDataCallback, resolution ) {}; Datafeed.prototype.getTimescaleMarks = function( symbolInfo, startDate, endDate, onDataCallback, resolution ) {}; Datafeed.prototype.getServerTime = function(callback) {}; // export default Datafeed;