From b0b62021c18838df399a54c8077e9385fc69194e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=9F=E6=B5=B7=E6=AC=A3?= Date: Thu, 7 Nov 2019 18:00:29 +0800 Subject: [PATCH] =?UTF-8?q?k=E7=BA=BF=E6=95=B0=E6=8D=AE=E5=B9=B4=E9=99=90?= =?UTF-8?q?=E6=94=B9=E4=B8=BA10=E5=B9=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/JsApi/Datafeed.js | 4 ++-- src/components/trade/TradingView.vue | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/public/JsApi/Datafeed.js b/public/JsApi/Datafeed.js index 4939515..6c8898e 100644 --- a/public/JsApi/Datafeed.js +++ b/public/JsApi/Datafeed.js @@ -18,7 +18,7 @@ Datafeed.prototype.onReady = function(callback) { // ], supports_search: false, supports_group_request: true, - supported_resolutions: [1, 5, 15, 30, 60, 240, 720, 'D', '2D', 'W', 'M'], + supported_resolutions: [1, 5, 15, 30, 60, 240, 720, 'D', 'W'], supports_marks: true, supports_timescale_marks: true, supports_time: true, @@ -94,7 +94,7 @@ Datafeed.prototype.calculateHistoryDepth = function( localStorage.setItem('resolution', resolution); return { resolutionBack: 'M', - intervalBack: 24, + intervalBack: 120, }; }; diff --git a/src/components/trade/TradingView.vue b/src/components/trade/TradingView.vue index 8dfc3be..2a22597 100644 --- a/src/components/trade/TradingView.vue +++ b/src/components/trade/TradingView.vue @@ -93,16 +93,24 @@ export default { '240', '720', 'D', - '2D', 'W', - 'M', ], has_seconds: false, // 是否有秒的历史数据 has_intraday: true, // 是否有分钟的历史数据 has_daily: true, // 是否有日的历史数据 has_weekly_and_monthly: true, // 是否有周和月的历史数据 seconds_multipliers: [], // 分辨率为秒单位的数组 - intraday_multipliers: ['1', '5', '15', '30', '60', '240', '720'], // 分辨率为分钟单位的数组 + intraday_multipliers: [ + '1', + '5', + '15', + '30', + '60', + '240', + '720', + 'D', + 'W', + ], // 分辨率为分钟单位的数组 has_empty_bars: true, force_session_rebuild: false, has_no_volume: false, // 表示商品是否拥有成交量数据 @@ -489,6 +497,12 @@ export default { res.data.length ) { // from(K线左边的时间) 和 to(K线右边的时间),接口返回的数据必须在这个时间返回内 + // console.log(from, to); + // console.log( + // res.data[0].timestamp, + // res.data[res.data.length - 1].timestamp + // ); + if (from && to) { if ( res.data[0].timestamp >= from * 1000 &&