From c4b4f867414af90490e27429611f1c4f70f6dbbc Mon Sep 17 00:00:00 2001 From: ding Date: Tue, 23 Nov 2021 11:25:44 +0800 Subject: [PATCH] feat: kline data --- src/views/components/kline/index.vue | 131 ++++++++++++--------------- 1 file changed, 60 insertions(+), 71 deletions(-) diff --git a/src/views/components/kline/index.vue b/src/views/components/kline/index.vue index 856db4c3..aa3fff93 100644 --- a/src/views/components/kline/index.vue +++ b/src/views/components/kline/index.vue @@ -95,88 +95,78 @@ export default { theme: 'Dark', favorites: { intervals: ['30', '240', '1D'], - }, - customFormatters: { - timeFormatter: { - format: date => { - const _format_str = '%h:%m' - return _format_str.replace('%h', toDouble(date.getUTCHours()), 2).replace('%m', toDouble(date.getUTCMinutes()), 2).replace('%s', date.getUTCSeconds(), 2) - }, - }, - dateFormatter: { - format: date => `${date.getUTCFullYear()}-${toDouble(date.getUTCMonth() + 1)}-${toDouble(date.getUTCDate())}`, - }, - }, + }, disabled_features: [ // 禁用功能 + 'volume_force_overlay', 'left_toolbar', - 'timeframes_toolbar', - 'header_symbol_search', - 'header_compare', - // 'header_fullscreen_button', - 'header_widget', - // 'use_localstorage_for_settings', - 'save_chart_properties_to_local_storage', - // 'header_chart_type', - // 'display_market_status', - 'symbol_search_hot_key', - 'compare_symbol', - 'border_around_the_chart', - 'remove_library_container_border', - 'symbol_info', - // 'header_interval_dialog_button', - // 'show_interval_dialog_on_key_press', - 'volume_force_overlay', - // 'header_resolutions', - // 'legend_context_menu', - // new - 'symbol_info', - 'pane_context_menu', + 'timeframes_toolbar', + 'header_symbol_search', + 'header_compare', + // 'header_fullscreen_button', + 'header_widget', + // 'use_localstorage_for_settings', + 'save_chart_properties_to_local_storage', + // 'header_chart_type', + // 'display_market_status', + 'symbol_search_hot_key', + 'compare_symbol', + 'border_around_the_chart', + 'remove_library_container_border', + 'symbol_info', + // 'header_interval_dialog_button', + // 'show_interval_dialog_on_key_press', + 'volume_force_overlay', + // 'header_resolutions', + // 'legend_context_menu', + // new + 'symbol_info', + 'pane_context_menu', ], enabled_features: [ // 启用的功能 - 'hide_left_toolbar_by_default', - 'pane_context_menu', - 'hide_last_na_study_output', - 'dont_show_boolean_study_arguments', + 'hide_left_toolbar_by_default', + 'pane_context_menu', + 'hide_last_na_study_output', + 'dont_show_boolean_study_arguments', ], - overrides: { - 'paneProperties.background': tradingViewStyle.bg, - 'symbolWatermarkProperties.transparency': 85, - 'scalesProperties.backgroundColor': '#151a1e', - 'scalesProperties.textColor': '#888', + overrides: { + 'paneProperties.background': tradingViewStyle.bg, + 'symbolWatermarkProperties.transparency': 85, + 'scalesProperties.backgroundColor': '#151a1e', + 'scalesProperties.textColor': '#888', - 'paneProperties.vertGridProperties.color': tradingViewStyle.grid, - 'paneProperties.horzGridProperties.color': tradingViewStyle.grid, - 'paneProperties.crossHairProperties.color': - tradingViewStyle.crosshair, - 'scalesProperties.lineColor': tradingViewStyle.lineColor, - 'symbolWatermarkProperties.color': 'rgba(0, 0, 0, 0)', + 'paneProperties.vertGridProperties.color': tradingViewStyle.grid, + 'paneProperties.horzGridProperties.color': tradingViewStyle.grid, + 'paneProperties.crossHairProperties.color': + tradingViewStyle.crosshair, + 'scalesProperties.lineColor': tradingViewStyle.lineColor, + 'symbolWatermarkProperties.color': 'rgba(0, 0, 0, 0)', - 'mainSeriesProperties.style': 1, + 'mainSeriesProperties.style': 1, - // Candles styles - 'mainSeriesProperties.candleStyle.upColor': tradingViewStyle.long, - 'mainSeriesProperties.candleStyle.downColor': tradingViewStyle.short, - 'mainSeriesProperties.candleStyle.drawWick': true, - 'mainSeriesProperties.candleStyle.drawBorder': true, - 'mainSeriesProperties.candleStyle.borderColor': '#C400CB', - 'mainSeriesProperties.candleStyle.borderUpColor': - tradingViewStyle.long, - 'mainSeriesProperties.candleStyle.borderDownColor': - tradingViewStyle.short, - 'mainSeriesProperties.candleStyle.wickUpColor': tradingViewStyle.long, - 'mainSeriesProperties.candleStyle.wickDownColor': - tradingViewStyle.short, + // Candles styles + 'mainSeriesProperties.candleStyle.upColor': tradingViewStyle.long, + 'mainSeriesProperties.candleStyle.downColor': tradingViewStyle.short, + 'mainSeriesProperties.candleStyle.drawWick': true, + 'mainSeriesProperties.candleStyle.drawBorder': true, + 'mainSeriesProperties.candleStyle.borderColor': '#C400CB', + 'mainSeriesProperties.candleStyle.borderUpColor': + tradingViewStyle.long, + 'mainSeriesProperties.candleStyle.borderDownColor': + tradingViewStyle.short, + 'mainSeriesProperties.candleStyle.wickUpColor': tradingViewStyle.long, + 'mainSeriesProperties.candleStyle.wickDownColor': + tradingViewStyle.short, - 'study_Overlay@tv-basicstudies.barStyle.upColor': 'blue', - 'study_Overlay@tv-basicstudies.barStyle.downColor': 'blue', + 'study_Overlay@tv-basicstudies.barStyle.upColor': 'blue', + 'study_Overlay@tv-basicstudies.barStyle.downColor': 'blue', - 'study_Overlay@tv-basicstudies.lineStyle.color': 'blue', + 'study_Overlay@tv-basicstudies.lineStyle.color': 'blue', - 'study_Overlay@tv-basicstudies.areaStyle.color1': 'blue', - 'study_Overlay@tv-basicstudies.areaStyle.color2': 'blue', - 'study_Overlay@tv-basicstudies.areaStyle.linecolor': 'blue', - }, + 'study_Overlay@tv-basicstudies.areaStyle.color1': 'blue', + 'study_Overlay@tv-basicstudies.areaStyle.color2': 'blue', + 'study_Overlay@tv-basicstudies.areaStyle.linecolor': 'blue', + }, }) tv.onChartReady(() => { @@ -198,5 +188,4 @@ export default { \ No newline at end of file