在Vue3项目中使用 Echarts 绘制股票图表的分享(六):绘制K线图

效果图

K线图
K线图有很多种类,当前展示仅为基础的传统分析的一种。

绘制K线图

完整代码

<template>
  <div class="stock-chart">
    <div class="stock-chart-box" @touchstart="start($event)" @touchend="end">
      <!-- K线图 -->
      <v-chart ref="vchart" v-if="showCharts" :option="options" :update-options="{ notMerge: true }" />
    </div>
  </div>
</template>
<script lang="ts" setup>
import {
    
     ref, reactive, onBeforeMount, nextTick } from 'vue';
import 'echarts';
import VChart from 'vue-echarts';
// vchart组件的引用
const vchart: any = ref(null);
// 控制图表展示
let showCharts = ref<boolean>(false);

let timer = ref(null);

// MA均线
let ma5 = ref<number[]>([]);
let ma10 = ref<number[]>([]);
let ma20 = ref<number[]>([]);
let ma30 = ref<number[]>([]);

// MACD
let dif = ref<number[]>([]);
let dea = ref<number[]>([]);
let macd = ref<any[]>([]);

// 控制图表缩放和数据滚动
let isOffset = ref<boolean>(false);

let startValue = ref<number>(60);
let endValue = ref<number>(100);

// 当前数据长度,K线和牛熊先知的数据长度保持一致
let currentDateLength = ref<number>(0);

// 交易日期数据
let xDates = ref<string[]>([]);

// k线数据
let yDatas = ref<any[]>([]);

// 成交量
let showVolumes = ref<any[]>([]);

// 图表配置项
let options = reactive({
    
    
  animation: false, //禁止动画效果
  grid: [
    {
    
    
      show: false, //显示坐标系的边框
      id: 'gd1',
      top: '4%',
      left: '4%',
      right: '4%',
      bottom: '50%'
    },
    {
    
    
      show: false, //显示坐标系的边框
      id: 'gd2',
      top: '50%',
      left: '4%',
      right: '4%',
      bottom: '30%'
    },
    {
    
    
      show: false, //显示坐标系的边框
      id: 'gd3',
      top: '70%',
      left: '4%',
      right: '4%',
      bottom: '10%'
    },
    {
    
    
      show: false, //显示坐标系的边框
      id: 'gd4',
      top: '50%',
      left: '4%',
      right: '4%',
      bottom: '30%'
    }
  ],
  tooltip: {
    
    
    show: isOffset.value,
    trigger: 'none',
    axisPointer: {
    
    
      type: 'cross',
      animation: false,
      snap: true,
      z: 999,
      crossStyle: {
    
    
        type: 'solid',
        width: 0.5
      },
      lineStyle: {
    
    
        type: 'solid',
        width: 0.5
      },
      fontSize: 10,
      label: {
    
    
        color: '#ffffff',
        backgroundColor: '#6E7079',
        // precision: 2,
        // padding: [5, 10, 5, 7],
        formatter: function (val: any) {
    
    
          if ((val.axisIndex == 0 || val.axisIndex == 1) && val.axisDimension == 'x') {
    
    
            return '';
          } else if (val.axisDimension == 'y') {
    
    
            return fomatFloat(val.value);
          } else {
    
    
            let ri = val.value.slice(5, 10);
            return ri;
          }
        }
      }
    }
  },
  axisPointer: {
    
     link: [{
    
     xAxisIndex: 'all' }] },
  // 调色盘
  color: ['#FF3232', '#009900'],
  xAxis: [] as any[],
  yAxis: [] as any[],
  dataZoom: [] as any[],
  visualMap: [],
  series: [] as any[]
});
function fomatFloat(src: any, pos = 2) {
    
    
  return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);
}
/**
 * MA均线(传统分析)
 */
function calculateMA() {
    
    
  ma5.value = [];
  ma10.value = [];
  ma20.value = [];
  ma30.value = [];
  let ma5close = 0.0;
  let ma10close = 0.0;
  let ma20close = 0.0;
  let ma30close = 0.0;
  yDatas.value.forEach((item: any, index: any, array: any) => {
    
    
    let close = fomatFloat(item.value[1]);
    ma5close += close;
    ma10close += close;
    ma20close += close;
    ma30close += close;
    if (index >= 5) {
    
    
      ma5close = ma5close - fomatFloat(yDatas.value[index - 5].value[1]);
      ma5.value.push(ma5close / 5);
    } else {
    
    
      ma5.value.push(ma5close / (index + 1));
    }
    if (index >= 10) {
    
    
      ma10close = ma10close - fomatFloat(yDatas.value[index - 10].value[1]);
      ma10.value.push(ma10close / 10);
    } else {
    
    
      ma10.value.push(ma10close / (index + 1));
    }
    if (index >= 20) {
    
    
      ma20close = ma20close - fomatFloat(yDatas.value[index - 20].value[1]);
      ma20.value.push(ma20close / 20);
    } else {
    
    
      ma20.value.push(ma20close / (index + 1));
    }
    if (index >= 30) {
    
    
      ma30close = ma30close - fomatFloat(yDatas.value[index - 30].value[1]);
      ma30.value.push(ma30close / 30);
    } else {
    
    
      ma30.value.push(ma30close / (index + 1));
    }
  });

  options.series.push(
    {
    
    
      type: 'line',
      data: ma5.value,
      smooth: true,
      symbol: 'none',
      gridIndex: 0,
      xAxisIndex: 0,
      yAxisIndex: 0,
      z: 5,
      lineStyle: {
    
    
        opacity: 1,
        color: '#ffffff',
        width: 1
      },
      emphasis: {
    
    
        focus: 'none',
        scale: false,
        disabled: 'none',
        lineStyle: {
    
    
          width: 1
        }
      }
    },
    {
    
    
      type: 'line',
      data: ma10.value,
      smooth: true,
      symbol: 'none',
      gridIndex: 0,
      xAxisIndex: 0,
      yAxisIndex: 0,
      z: 5,
      lineStyle: {
    
    
        opacity: 1,
        color: '#FF00FF',
        width: 1
      },
      emphasis: {
    
    
        focus: 'none',
        scale: false,
        disabled: 'none',
        lineStyle: {
    
    
          width: 1
        }
      }
    },
    {
    
    
      type: 'line',
      data: ma20.value,
      smooth: true,
      symbol: 'none',
      gridIndex: 0,
      xAxisIndex: 0,
      yAxisIndex: 0,
      z: 5,
      lineStyle: {
    
    
        opacity: 1,
        color: '#FFFF00',
        width: 1
      },
      emphasis: {
    
    
        focus: 'none',
        scale: false,
        disabled: 'none',
        lineStyle: {
    
    
          width: 1
        }
      }
    },
    {
    
    
      type: 'line',
      data: ma30.value,
      smooth: true,
      symbol: 'none',
      gridIndex: 0,
      xAxisIndex: 0,
      yAxisIndex: 0,
      z: 5,
      lineStyle: {
    
    
        opacity: 1,
        color: '#3DC130',
        width: 1
      },
      emphasis: {
    
    
        focus: 'none',
        scale: false,
        disabled: 'none',
        lineStyle: {
    
    
          width: 1
        }
      }
    }
  );
}
/**
 * MACD(传统分析)
 */
function calculateMACD() {
    
    
  let ema12 = 0;
  let ema26 = 0;
  let difVal = 0;
  let deaVal = 0;
  let macdVal = 0;
  yDatas.value.forEach((item: any, index: any, array: any) => {
    
    
    let close = fomatFloat(item.value[1]);
    if (index == 0) {
    
    
      ema12 = close;
      ema26 = close;
    } else {
    
    
      //  EMA(12) = 前一日EMA(12) X 11/13 + 今日收盘价 X 2/13
      //  EMA(26) = 前一日EMA(26) X 25/27 + 今日收盘价 X 2/27
      ema12 = (ema12 * 11) / 13 + (close * 2) / 13;
      ema26 = (ema26 * 25) / 27 + (close * 2) / 27;
    }
    //  DIF = EMA(12) - EMA(26) 。
    //  今日DEA = (前一日DEA X 8/10 + 今日DIF X 2/10)
    //  用(DIF-DEA)*2即为MACD柱状图。
    difVal = ema12 - ema26;
    deaVal = (deaVal * 8) / 10 + (difVal * 2) / 10;
    macdVal = (difVal - deaVal) * 2;
    dif.value[index] = difVal;
    dea.value[index] = deaVal;
    macd.value[index] = {
    
    
      value: macdVal,
      itemStyle: {
    
    
        color: macdVal >= 0 ? '#FF3232' : '#00FFFF',
        borderColor: macdVal >= 0 ? '#FF3232' : '#00FFFF'
      }
    };
  });
  // value: stockData[i][4],
  // itemStyle: {
    
    
  //   color: stockData[i][1] >= stockData[i][0] ? '#FF3232' : '#009900',
  //   borderColor: stockData[i][1] >= stockData[i][0] ? '#FF3232' : '#009900'
  // }
  options.series.push(
    {
    
    
      gridIndex: 3,
      xAxisIndex: 3,
      yAxisIndex: 3,
      type: 'bar',
      data: macd.value,
      barWidth: '50%',
      smooth: true,
      large: true, //大数据优化
      largeThreshold: 200 //优化阈值
    },
    {
    
    
      type: 'line',
      data: dif.value,
      smooth: true,
      symbol: 'none',
      gridIndex: 3,
      xAxisIndex: 3,
      yAxisIndex: 3,
      z: 5,
      lineStyle: {
    
    
        opacity: 1,
        color: '#FFFF00',
        width: 1
      },
      emphasis: {
    
    
        focus: 'none',
        scale: false,
        disabled: 'none',
        lineStyle: {
    
    
          width: 1
        }
      }
    },
    {
    
    
      type: 'line',
      data: dea.value,
      smooth: true,
      symbol: 'none',
      gridIndex: 3,
      xAxisIndex: 3,
      yAxisIndex: 3,
      z: 5,
      lineStyle: {
    
    
        opacity: 1,
        color: '#FF00FF',
        width: 1
      },
      emphasis: {
    
    
        focus: 'none',
        scale: false,
        disabled: 'none',
        lineStyle: {
    
    
          width: 1
        }
      }
    }
  );
}
/**
 * 初始化图表
 */
function initChart() {
    
    
  let stockData: any = [
    [17.09, 17.01, 17.12, 16.91, 105957594, 1831122716.47, 17.28, 17.39, -0.07, -0.4, 0.55, '2021-12-23'],
    [17.02, 17, 17.04, 16.91, 48825149, 843109664.77, 17.27, 17.32, -0.01, -0.06, 0.25, '2021-12-24'],
    [17.02, 16.92, 17.04, 16.86, 73111899, 1260455319.19, 17.24, 17.31, -0.09, -0.52, 0.38, '2021-12-27'],
    [16.92, 16.87, 17.02, 16.79, 112663891, 1934461075.51, 17.17, 17.22, -0.05, -0.29, 0.58, '2021-12-28'],
    [16.86, 16.45, 16.86, 16.4, 146937398, 2480534592.86, 16.88, 17.17, -0.42, -2.45, 0.76, '2021-12-29'],
    [16.46, 16.52, 16.65, 16.42, 79666360, 1342374249.46, 16.85, 16.75, 0.07, 0.42, 0.41, '2021-12-30'],
    [16.56, 16.19, 16.6, 16.11, 175076089, 2899617148.55, 16.56, 16.82, -0.34, -2.02, 0.9, '2021-12-31'],
    [16.19, 16.37, 16.37, 15.89, 116925933, 1918887050.94, 16.41, 16.48, 0.18, 1.09, 0.6, '2022-01-04'],
    [16.29, 16.85, 16.92, 16.26, 196199817, 3344124589.35, 17.04, 16.66, 0.49, 2.94, 1.01, '2022-01-05'],
    [16.81, 16.82, 16.96, 16.7, 110788519, 1896535837.6, 17.12, 17.15, -0.03, -0.17, 0.57, '2022-01-06'],
    [16.8, 16.9, 16.97, 16.76, 112663070, 1937710958.28, 17.2, 17.12, 0.08, 0.47, 0.58, '2022-01-07'],
    [16.98, 16.89, 17.11, 16.73, 90977401, 1563414572.47, 17.18, 17.2, -0.01, -0.06, 0.47, '2022-01-10'],
    [16.95, 17.1, 17.23, 16.84, 158199940, 2752485391.28, 17.4, 17.19, 0.22, 1.28, 0.82, '2022-01-11'],
    [17.1, 16.7, 17.14, 16.6, 150216355, 2561266412.25, 17.05, 17.41, -0.41, -2.36, 0.77, '2022-01-12'],
    [16.61, 16.68, 16.94, 16.52, 90942265, 1550319158.87, 17.05, 17, -0.02, -0.12, 0.47, '2022-01-13'],
    [16.7, 16.04, 16.72, 16.01, 210309491, 3459950804.53, 16.45, 16.98, -0.65, -3.83, 1.08, '2022-01-14'],
    [16.06, 15.93, 16.19, 15.84, 114368943, 1855633789.59, 16.23, 16.33, -0.11, -0.67, 0.59, '2022-01-17'],
    [15.96, 16.23, 16.25, 15.87, 115297431, 1891094610.09, 16.4, 16.22, 0.3, 1.85, 0.59, '2022-01-18'],
    [16.25, 16.21, 16.39, 16.07, 98839185, 1630973587.2, 16.5, 16.52, -0.02, -0.12, 0.51, '2022-01-19'],
    [16.18, 17.02, 17.15, 16.13, 303119376, 5195805549.58, 17.14, 16.5, 0.83, 5.03, 1.56, '2022-01-20'],
    [17.14, 17.04, 17.25, 16.91, 148168295, 2575115124.69, 17.38, 17.33, 0.02, 0.12, 0.76, '2022-01-21'],
    [17.03, 16.9, 17.07, 16.68, 87477087, 1501390339.01, 17.16, 17.35, -0.15, -0.86, 0.45, '2022-01-24'],
    [16.78, 16.55, 16.78, 16.51, 109328397, 1851999025.42, 16.94, 17.2, -0.35, -2.03, 0.56, '2022-01-25'],
    [16.21, 16.01, 16.25, 15.96, 102464311, 1677261296.33, 16.37, 16.65, -0.35, -2.1, 0.53, '2022-01-27'],
    [16.1, 15.55, 16.16, 15.54, 167556367, 2695470330.62, 16.09, 16.3, -0.47, -2.88, 0.86, '2022-01-28'],
    [15.74, 16.1, 16.12, 15.61, 151547630, 2451798485.84, 16.18, 15.83, 0.56, 3.54, 0.78, '2022-02-07'],
    [16.01, 16.53, 16.67, 15.97, 175469528, 2950309012.49, 16.81, 16.39, 0.44, 2.68, 0.9, '2022-02-08'],
    [16.62, 16.56, 16.7, 16.41, 105116166, 1774253636.5, 16.88, 16.83, 0.03, 0.18, 0.54, '2022-02-09'],
    [16.47, 16.69, 16.73, 16.38, 78455735, 1326848947.79, 16.91, 16.86, 0.13, 0.77, 0.4, '2022-02-10'],
    [16.73, 16.8, 17.03, 16.73, 107813914, 1852167493.23, 17.18, 16.99, 0.11, 0.65, 0.56, '2022-02-11'],
    [16.8, 16.29, 16.85, 16.22, 115065851, 1917613419.43, 16.67, 17.1, -0.52, -3.04, 0.59, '2022-02-14'],
    [16.21, 15.99, 16.38, 15.82, 120826437, 1968985378.18, 16.3, 16.58, -0.3, -1.81, 0.62, '2022-02-15'],
    [16.06, 16.12, 16.24, 15.92, 78239959, 1282234150.21, 16.39, 16.28, 0.13, 0, 0.4, '2022-02-16'],
    [16.1, 16.13, 16.26, 16.03, 79450184, 1306514349.59, 16.44, 16.41, 0.01, 0.06, 0.41, '2022-02-17'],
    [16.03, 16.47, 16.47, 16.02, 80249940, 1330233365.68, 16.58, 16.42, 0.35, 2.13, 0.41, '2022-02-18'],
    [16.37, 16.22, 16.38, 16.03, 80099455, 1316023718.12, 16.43, 16.77, -0.26, -1.55, 0.41, '2022-02-21'],
    [16.02, 15.94, 16.15, 15.87, 89495673, 1454156224.87, 16.25, 16.51, -0.28, -1.7, 0.46, '2022-02-22'],
    [16.01, 15.9, 16.02, 15.76, 88674244, 1431289852.14, 16.14, 16.23, -0.04, -0.25, 0.46, '2022-02-23'],
    [15.84, 15.63, 15.86, 15.52, 132408685, 2112842553.1, 15.96, 16.19, -0.28, -1.73, 0.68, '2022-02-24'],
    [15.71, 15.62, 15.8, 15.59, 72639707, 1157890268.48, 15.94, 15.91, -0.01, -0.06, 0.37, '2022-02-25'],
    [15.62, 15.47, 15.64, 15.34, 72399045, 1137154096, 15.71, 15.9, -0.15, -0.94, 0.37, '2022-02-28'],
    [15.51, 15.64, 15.67, 15.34, 93504034, 1474693968, 15.77, 15.75, 0.17, 1.08, 0.48, '2022-03-01'],
    [15.51, 15.4, 15.59, 15.38, 76076086, 1196321952, 15.73, 15.92, -0.24, -1.51, 0.39, '2022-03-02'],
    [15.45, 15.43, 15.53, 15.35, 57828505, 908171584, 15.7, 15.68, 0.03, 0.19, 0.3, '2022-03-03'],
    [15.34, 15.06, 15.35, 15.01, 99093566, 1523793664, 15.38, 15.71, -0.38, -2.42, 0.51, '2022-03-04'],
    [14.9, 14.46, 14.9, 14.4, 111315899, 1655959936, 14.88, 15.33, -0.61, -3.98, 0.57, '2022-03-07'],
    [14.36, 14.06, 14.6, 14, 100303269, 1463145936, 14.59, 14.72, -0.41, -2.79, 0.52, '2022-03-08'],
    [14.15, 13.6, 14.19, 12.99, 180076017, 2492042992, 13.84, 14.31, -0.47, -3.28, 0.93, '2022-03-09'],
    [13.93, 14.31, 14.49, 13.84, 224915816, 3269867792, 14.54, 13.84, 0.73, 5.27, 1.16, '2022-03-10'],
    [14.37, 14.23, 14.67, 14.19, 111840734, 1637278464, 14.64, 14.9, -0.41, -2.75, 0.58, '2022-03-14'],
    [14.15, 13.44, 14.15, 13.36, 178140887, 2479769552, 13.92, 14.49, -0.81, -5.59, 0.92, '2022-03-15'],
    [13.61, 14.06, 14.15, 14.15, 153177906, 2141637072, 13.98, 13.68, 0.63, 4.61, 0.79, '2022-03-16'],
    [14.4, 14.19, 14.45, 13.99, 173006142, 2506504224, 0, 14.31, 0, 0.98, 0.89, '2022-03-17'],
    [14.11, 14.44, 14.59, 13.89, 152880713, 2222158762.02, 14.54, 14.45, 0.25, 1.73, 0.79, '2022-03-18'],
    [14.24, 14.33, 14.56, 14.14, 120886805, 1765673892.12, 14.61, 14.7, -0.11, -0.75, 0.62, '2022-03-21'],
    [14.33, 14.91, 14.95, 14.24, 162865658, 2443174055.85, 15, 14.59, 0.59, 4.04, 0.84, '2022-03-22'],
    [14.84, 14.73, 14.92, 14.64, 105010238, 1577561341.66, 15.02, 15.18, -0.18, -1.19, 0.54, '2022-03-23'],
    [14.66, 14.93, 15.04, 14.55, 100235995, 1518870080.31, 15.15, 15, 0.2, 1.33, 0.52, '2022-03-24'],
    [14.88, 14.72, 14.98, 14.56, 74293335, 1116354595.16, 15.03, 15.2, -0.22, -1.45, 0.38, '2022-03-25'],
    [14.54, 14.59, 14.78, 14.37, 72713699, 1078327302.93, 14.83, 14.98, -0.13, -0.87, 0.37, '2022-03-28'],
    [14.62, 14.42, 14.69, 14.34, 61564315, 909169631.24, 14.77, 14.85, -0.17, -1.14, 0.32, '2022-03-29'],
    [14.6, 14.94, 15, 14.5, 123679155, 1859617040.64, 15.04, 14.68, 0.53, 3.61, 0.64, '2022-03-30'],
    [14.83, 15.11, 15.29, 14.79, 116374674, 1789209946.79, 15.37, 15.21, 0.17, 1.12, 0.6, '2022-03-31'],
    [15.1, 15.47, 15.51, 14.93, 148487874, 2319616863.02, 15.62, 15.38, 0.37, 2.41, 0.77, '2022-04-01'],
    [15.36, 16.1, 16.25, 15.35, 248854005, 4064051491.84, 16.33, 15.75, 0.64, 4.06, 1.28, '2022-04-06'],
    [16.09, 15.99, 16.37, 15.91, 165906455, 2724002904.78, 16.42, 16.39, -0.11, -0.67, 0.85, '2022-04-07'],
    [15.97, 16.11, 16.16, 15.84, 106677946, 1741072072.48, 16.32, 16.28, 0.12, 0.74, 0.55, '2022-04-08'],
    [16.06, 15.77, 16.11, 15.52, 141673536, 2277469055.78, 16.08, 16.4, -0.35, -2.13, 0.73, '2022-04-11'],
    [15.77, 15.64, 15.97, 15.38, 103926142, 1654820082.53, 15.92, 16.05, -0.13, -0.81, 0.54, '2022-04-12'],
    [15.61, 15.52, 15.8, 15.44, 89062806, 1415496125.98, 15.89, 15.92, -0.12, -0.75, 0.46, '2022-04-13'],
    [15.72, 15.76, 15.96, 15.64, 92961494, 1493343952.15, 16.06, 15.8, 0.24, 1.52, 0.48, '2022-04-14'],
    [15.62, 16.13, 16.24, 15.58, 123176103, 2014010094.33, 16.35, 16.04, 0.38, 2.37, 0.63, '2022-04-15'],
    [15.86, 15.62, 15.91, 15.53, 108688756, 1734236523.85, 15.96, 16.42, -0.52, -3.17, 0.56, '2022-04-18'],
    [15.62, 15.53, 15.69, 15.34, 82177249, 1294226951.21, 15.75, 15.9, -0.09, -0.57, 0.42, '2022-04-19'],
    [15.53, 15.57, 15.77, 15.42, 71655528, 1137697846.98, 15.88, 15.81, 0.04, 0.25, 0.37, '2022-04-20'],
    [15.49, 15.53, 15.7, 15.42, 70989116, 1124663651.04, 15.84, 15.85, -0.04, -0.25, 0.37, '2022-04-21'],
    [15.36, 15.78, 15.9, 15.13, 92127408, 1468452957.95, 15.94, 15.81, 0.25, 1.58, 0.47, '2022-04-22'],
    [15.39, 14.59, 15.63, 14.52, 166448098, 2527610217.43, 15.19, 16.06, -1.21, -7.53, 0.86, '2022-04-25'],
    [14.62, 14.47, 14.72, 14.19, 98820956, 1456929632.19, 14.74, 14.85, -0.12, -0.81, 0.51, '2022-04-26'],
    [14.72, 15.37, 15.37, 14.7, 149029503, 2296798759, 15.41, 14.73, 0.92, 6.25, 0.77, '2022-04-27'],
    [15.29, 15.37, 15.65, 15.1, 91177187, 1426381925.81, 15.64, 15.65, 0, 0, 0.47, '2022-04-28'],
    [15.41, 15.05, 15.46, 14.71, 164501308, 2503476827.84, 15.22, 15.65, -0.33, -2.11, 0.85, '2022-04-29'],
    [14.93, 15.05, 15.18, 14.88, 79019620, 1208735141.83, 15.3, 15.32, 0, 0, 0.41, '2022-05-05'],
    [14.75, 14.7, 14.93, 14.65, 83243182, 1250995594.77, 15.03, 15.32, -0.36, -2.35, 0.43, '2022-05-06'],
    [14.68, 14.29, 14.68, 14.2, 81862135, 1197104247.06, 14.62, 14.96, -0.41, -2.74, 0.42, '2022-05-09'],
    [14.24, 14.33, 14.34, 13.86, 99228502, 1425836927.23, 14.37, 14.55, 0.04, 0.27, 0.51, '2022-05-10'],
    [14.28, 14.37, 14.58, 14.18, 84857362, 1240700426.07, 14.62, 14.59, 0.04, 0.27, 0.44, '2022-05-11'],
    [14.22, 14.13, 14.3, 14.08, 68506423, 987061607.22, 14.41, 14.63, -0.25, -1.71, 0.35, '2022-05-12'],
    [14.24, 14.35, 14.4, 14.23, 67631191, 985962932.09, 14.58, 14.38, 0.23, 1.6, 0.35, '2022-05-13'],
    [14.4, 14.16, 14.47, 14.1, 66822782, 965652298.06, 14.45, 14.61, -0.2, -1.37, 0.34, '2022-05-16'],
    [14.25, 14.45, 14.46, 14.07, 93140639, 1357428406.75, 14.57, 14.41, 0.3, 2.08, 0.48, '2022-05-17'],
    [14.59, 14.49, 14.63, 14.41, 77857833, 1150500437.95, 14.78, 14.71, 0.04, 0.27, 0.4, '2022-05-18'],
    [14.29, 14.36, 14.44, 14.24, 59092172, 863214130.52, 14.61, 14.75, -0.13, -0.88, 0.3, '2022-05-19'],
    [14.44, 14.75, 14.77, 14.41, 94859778, 1415164711.31, 14.92, 14.62, 0.4, 2.74, 0.49, '2022-05-20'],
    [14.8, 14.57, 14.8, 14.5, 64772592, 962683728.68, 14.86, 15.02, -0.19, -1.27, 0.33, '2022-05-23'],
    [14.61, 14.15, 14.61, 14.15, 93355706, 1358693535.33, 14.55, 14.83, -0.43, -2.9, 0.48, '2022-05-24'],
    [14.17, 14.14, 14.23, 14.05, 60322826, 866228924.02, 14.36, 14.4, -0.01, -0.07, 0.31, '2022-05-25'],
    [14.16, 13.94, 14.17, 13.82, 101131756, 1435689342.04, 14.2, 14.39, -0.2, -1.39, 0.52, '2022-05-26'],
    [14.04, 13.93, 14.1, 13.86, 72306674, 1029702185.93, 14.24, 14.19, -0.01, -0.07, 0.37, '2022-05-27'],
    [14.01, 13.83, 14.03, 13.79, 89690123, 1265573047.59, 14.11, 14.18, -0.1, -0.71, 0.46, '2022-05-30'],
    [13.82, 13.91, 13.93, 13.75, 93886855, 1325012047.99, 14.11, 14.08, 0.08, 0.57, 0.48, '2022-05-31'],
    [13.89, 13.83, 13.89, 13.75, 84529898, 1187423732.04, 14.05, 14.16, -0.08, -0.57, 0.44, '2022-06-01'],
    [13.77, 13.7, 13.78, 13.63, 97926822, 1363740797.79, 13.93, 14.08, -0.13, -0.92, 0.5, '2022-06-02'],
    [13.66, 13.92, 13.92, 13.4, 171085175, 2370807610.48, 13.86, 13.95, 0.22, 1.58, 0.88, '2022-06-06'],
    [13.77, 13.91, 14, 13.74, 131511262, 1860366715.71, 14.15, 14.17, -0.01, -0.07, 0.68, '2022-06-07'],
    [13.91, 13.91, 13.92, 13.76, 114552124, 1613524957.82, 14.09, 14.16, 0, 0, 0.59, '2022-06-08'],
    [13.89, 14.1, 14.2, 13.85, 163290134, 2339986707.88, 14.33, 14.16, 0.19, 1.34, 0.84, '2022-06-09'],
    [14.01, 14.07, 14.08, 13.88, 134601231, 1914639698.11, 14.22, 14.35, -0.03, -0.21, 0.69, '2022-06-10'],
    [13.93, 13.66, 13.94, 13.63, 154775285, 2163340108.91, 13.98, 14.32, -0.41, -2.86, 0.8, '2022-06-13'],
    [13.47, 13.87, 13.88, 13.47, 115142939, 1602169897.99, 13.91, 13.91, 0.21, 1.51, 0.59, '2022-06-14'],
    [13.85, 14.48, 14.84, 13.81, 341354368, 5010292726.77, 14.68, 14.12, 0.62, 4.39, 1.76, '2022-06-15'],
    [14.48, 14.18, 14.57, 14.17, 133254631, 1939976254.77, 14.56, 14.74, -0.3, -2.04, 0.69, '2022-06-16'],
    [14.07, 14.19, 14.27, 13.95, 105378794, 1513925913.67, 14.37, 14.44, 0.01, 0.07, 0.54, '2022-06-17'],
    [14.18, 14.09, 14.18, 14.01, 103216680, 1479529786.97, 14.33, 14.45, -0.11, -0.76, 0.53, '2022-06-20'],
    [14.09, 14.12, 14.37, 13.98, 132179398, 1905346056.7, 14.41, 14.34, 0.03, 0.21, 0.68, '2022-06-21'],
    [14.11, 13.83, 14.11, 13.83, 105604592, 1498415783.73, 14.19, 14.37, -0.29, -2.02, 0.54, '2022-06-22'],
    [13.84, 13.95, 13.98, 13.81, 80602803, 1140899091.64, 14.15, 14.08, 0.12, 0.85, 0.42, '2022-06-23'],
    [13.95, 13.98, 14, 13.86, 86604061, 1227798687.09, 14.18, 14.2, 0.03, 0.21, 0.45, '2022-06-24'],
    [13.99, 14.23, 14.3, 13.97, 149727818, 2166380438.04, 14.47, 14.23, 0.26, 1.83, 0.77, '2022-06-27'],
    [14.21, 14.37, 14.41, 14.16, 112511048, 1638673242.41, 14.56, 14.49, 0.14, 0.97, 0.58, '2022-06-28'],
    [14.39, 14.38, 14.64, 14.29, 126654728, 1865064678.48, 14.73, 14.63, 0.01, 0.07, 0.65, '2022-06-29'],
    [14.37, 14.72, 14.75, 14.29, 154874501, 2304888691.73, 14.88, 14.64, 0.34, 2.32, 0.8, '2022-06-30'],
    [14.73, 14.66, 14.8, 14.58, 77924332, 1164030775.95, 14.94, 14.98, -0.06, -0.4, 0.4, '2022-07-01'],
    [14.69, 14.68, 14.72, 14.49, 83496807, 1241453402.11, 14.87, 14.92, 0.02, 0.13, 0.43, '2022-07-04'],
    [14.72, 14.65, 15, 14.56, 111517210, 1674719025.12, 15.02, 14.94, -0.03, -0.2, 0.57, '2022-07-05'],
    [14.57, 14.27, 14.67, 14.2, 104333523, 1520022514.77, 14.57, 14.91, -0.38, -2.55, 0.54, '2022-07-06'],
    [14.28, 14.17, 14.39, 14.13, 73016098, 1057696546.69, 14.49, 14.53, -0.11, -0.76, 0.38, '2022-07-07'],
    [14.24, 14.28, 14.39, 14.12, 63969823, 928850348.74, 14.52, 14.42, 0.12, 0.83, 0.33, '2022-07-08'],
    [14.24, 14.2, 14.31, 14.11, 61169194, 883613754.05, 14.45, 14.54, -0.08, -0.55, 0.32, '2022-07-11'],
    [14.16, 14.17, 14.47, 14.13, 74288242, 1078431989.61, 14.52, 14.46, -0.04, -0.28, 0.38, '2022-07-12'],
    [14.17, 13.72, 14.21, 13.64, 217599606, 3056913117.84, 14.05, 14.42, -0.45, -3.12, 1.12, '2022-07-13'],
    [13.46, 13.13, 13.47, 13.06, 263212087, 3534578702.13, 13.43, 13.97, -0.6, -4.29, 1.36, '2022-07-14'],
    [13.24, 13.01, 13.32, 12.99, 159863740, 2139915274.03, 13.39, 13.37, -0.13, -0.97, 0.82, '2022-07-15'],
    [13.02, 13.15, 13.2, 12.98, 115350581, 1536340973.2, 13.32, 13.24, 0.15, 1.13, 0.59, '2022-07-18'],
    [13.1, 13.18, 13.19, 13.05, 75559710, 1008562417.24, 13.35, 13.39, 0.03, 0.22, 0.39, '2022-07-19'],
    [13.19, 13.15, 13.23, 13.11, 80145866, 1073936299.76, 13.4, 13.42, -0.03, -0.22, 0.41, '2022-07-20'],
    [13.08, 12.78, 13.1, 12.76, 197038789, 2588696130.23, 13.14, 13.39, -0.38, -2.84, 1.02, '2022-07-21'],
    [12.84, 12.81, 12.93, 12.62, 137650974, 1755555714.49, 12.75, 12.78, 0.03, 0.23, 0.71, '2022-07-22'],
    [12.8, 12.82, 12.85, 12.67, 76395581, 976071707.3, 12.78, 12.81, 0.01, 0.08, 0.39, '2022-07-25'],
    [12.75, 12.91, 12.91, 12.71, 102404881, 1314310442.31, 12.83, 12.82, 0.09, 0.7, 0.53, '2022-07-26'],
    [12.85, 12.79, 12.88, 12.73, 92391408, 1182889760.74, 12.8, 12.91, -0.12, -0.93, 0.48, '2022-07-27'],
    [12.81, 12.88, 12.91, 12.78, 75034652, 964903657.66, 12.86, 12.79, 0.09, 0.7, 0.39, '2022-07-28'],
    [12.88, 12.68, 12.9, 12.65, 83149747, 1059518584.72, 12.74, 12.88, -0.2, -1.55, 0.43, '2022-07-29'],
    [12.66, 12.42, 12.66, 12.4, 102573271, 1277987010, 12.46, 12.68, -0.26, -2.05, 0.53, '2022-08-01'],
    [12.22, 12.26, 12.34, 11.94, 137300930, 1664397666.12, 12.12, 12.42, -0.16, -1.29, 0.71, '2022-08-02'],
    [12.19, 12.03, 12.27, 12.01, 74613653, 905653324.71, 12.14, 12.26, -0.23, -1.88, 0.38, '2022-08-03'],
    [12.1, 12.16, 12.17, 12.02, 60267562, 729351710.02, 12.1, 12.03, 0.13, 1.08, 0.31, '2022-08-04'],
    [12.13, 12.31, 12.33, 11.98, 76529787, 930836354.1, 12.16, 12.16, 0.15, 1.23, 0.39, '2022-08-05'],
    [12.25, 12.2, 12.36, 12.16, 55199969, 674950920.8, 12.23, 12.31, -0.11, -0.89, 0.28, '2022-08-08'],
    [12.21, 12.12, 12.22, 12.08, 55844757, 677098632.55, 12.12, 12.2, -0.08, -0.66, 0.29, '2022-08-09'],
    [12.12, 12.06, 12.24, 12.02, 68302321, 825806007.77, 12.09, 12.12, -0.06, -0.5, 0.35, '2022-08-10'],
    [12.08, 12.35, 12.39, 12.04, 139930361, 1710719478.11, 12.23, 12.06, 0.29, 2.4, 0.72, '2022-08-11'],
    [12.26, 12.38, 12.41, 12.2, 82050356, 1010612433.4, 12.32, 12.35, 0.03, 0.24, 0.42, '2022-08-12'],
    [12.29, 12.11, 12.36, 12.09, 117201000, 1425087455.23, 12.16, 12.38, -0.27, -2.18, 0.6, '2022-08-15'],
    [12.11, 12.13, 12.2, 12.1, 63122370, 765907218.72, 12.13, 12.11, 0.02, 0.17, 0.33, '2022-08-16'],
    [12.15, 12.4, 12.42, 12.07, 134850658, 1656961619.36, 12.29, 12.13, 0.27, 2.23, 0.69, '2022-08-17'],
    [12.48, 12.25, 12.54, 12.16, 126970094, 1560630567.7, 12.29, 12.4, -0.15, -1.21, 0.65, '2022-08-18'],
    [12.27, 12.57, 12.75, 12.23, 210641724, 2653471090.1, 12.6, 12.25, 0.32, 2.61, 1.09, '2022-08-19'],
    [12.58, 12.5, 12.68, 12.41, 113807658, 1423361878.69, 12.51, 12.57, -0.07, -0.56, 0.59, '2022-08-22'],
    [12.45, 12.34, 12.49, 12.28, 92146307, 1137300431.45, 12.34, 12.5, -0.16, -1.28, 0.47, '2022-08-23'],
    [12.33, 12.4, 12.54, 12.33, 129537533, 1613309589.13, 12.45, 12.34, 0.06, 0.49, 0.67, '2022-08-24'],
    [12.4, 12.62, 12.66, 12.3, 106401061, 1329230362.32, 12.49, 12.4, 0.22, 1.77, 0.55, '2022-08-25'],
    [12.68, 12.61, 12.75, 12.46, 92763426, 1168951099.46, 12.6, 12.62, -0.01, -0.08, 0.48, '2022-08-26'],
    [12.5, 12.42, 12.56, 12.31, 92449065, 1145189174.15, 12.39, 12.61, -0.19, -1.51, 0.48, '2022-08-29'],
    [12.43, 12.48, 12.54, 12.28, 79971238, 991447627.25, 12.4, 12.42, 0.06, 0.48, 0.41, '2022-08-30'],
    [12.38, 12.75, 12.78, 12.36, 165304158, 2091408314.78, 12.65, 12.48, 0.27, 2.16, 0.85, '2022-08-31'],
    [12.65, 12.61, 12.79, 12.58, 86198195, 1092666276.97, 12.68, 12.75, -0.14, -1.1, 0.44, '2022-09-01'],
    [12.62, 12.51, 12.69, 12.43, 78636281, 983433862.85, 12.51, 12.61, -0.1, -0.79, 0.41, '2022-09-02'],
    [12.46, 12.57, 12.6, 12.37, 63203998, 788451088.8, 12.47, 12.51, 0.06, 0.48, 0.33, '2022-09-05'],
    [12.58, 12.5, 12.66, 12.43, 73129499, 914692183.62, 12.51, 12.57, -0.07, -0.56, 0.38, '2022-09-06'],
    [12.42, 12.33, 12.42, 12.28, 97981281, 1208329758.86, 12.33, 12.5, -0.17, -1.36, 0.5, '2022-09-07'],
    [12.32, 12.36, 12.44, 12.3, 62111692, 768913483.55, 12.38, 12.33, 0.03, 0.24, 0.32, '2022-09-08'],
    [12.4, 12.72, 12.74, 12.36, 195129731, 2469131334.35, 12.65, 12.36, 0.36, 2.91, 1.01, '2022-09-09'],
    [12.88, 12.95, 13.02, 12.66, 172268989, 2223707380.14, 12.91, 12.72, 0.23, 1.81, 0.89, '2022-09-13'],
    [12.75, 12.73, 12.87, 12.7, 85803584, 1095054828.69, 12.76, 12.95, -0.22, -1.7, 0.44, '2022-09-14'],
    [12.8, 13, 13.1, 12.77, 184101788, 2393239453.41, 13, 12.73, 0.27, 2.12, 0.95, '2022-09-15'],
    [12.92, 12.56, 12.95, 12.56, 135744781, 1719252822.13, 12.67, 13, -0.44, -3.38, 0.7, '2022-09-16'],
    [12.54, 12.57, 12.67, 12.48, 63212104, 793491306.11, 12.55, 12.56, 0.01, 0.08, 0.33, '2022-09-19'],
    [12.61, 12.34, 12.63, 12.32, 88998853, 1102212203.64, 12.38, 12.57, -0.23, -1.83, 0.46, '2022-09-20'],
    [12.31, 12.43, 12.48, 12.2, 68419739, 845477181.51, 12.36, 12.34, 0.09, 0.73, 0.35, '2022-09-21'],
    [12.33, 12.29, 12.36, 12.25, 58613338, 720058210.32, 12.28, 12.43, -0.14, -1.13, 0.3, '2022-09-22'],
    [12.24, 12.29, 12.43, 12.23, 58644106, 722703127.68, 12.32, 12.29, 0, 0, 0.3, '2022-09-23'],
    [12.16, 12, 12.28, 11.99, 90372904, 1094060839.05, 12.11, 12.29, -0.29, -2.36, 0.47, '2022-09-26'],
    [12, 12.15, 12.16, 11.81, 78962229, 946732993.84, 11.99, 12, 0.15, 1.25, 0.41, '2022-09-27'],
    [12.09, 12.11, 12.25, 11.92, 78092558, 946211766.9, 12.12, 12.15, -0.04, -0.33, 0.4, '2022-09-28'],
    [12.25, 11.86, 12.28, 11.82, 91771804, 1100405198.17, 11.99, 12.11, -0.25, -2.06, 0.47, '2022-09-29'],
    [11.87, 11.84, 11.96, 11.83, 53723019, 638906947.77, 11.89, 11.86, -0.02, -0.17, 0.28, '2022-09-30'],
    [11.7, 11.47, 11.77, 11.46, 96608018, 1119089730.68, 11.58, 11.84, -0.37, -3.13, 0.5, '2022-10-10'],
    [11.54, 11.48, 11.58, 11.41, 41525337, 476749226.5, 11.48, 11.47, 0.01, 0.09, 0.21, '2022-10-11'],
    [11.45, 11.6, 11.62, 11.35, 55957243, 641776508.91, 11.47, 11.48, 0.12, 1.05, 0.29, '2022-10-12'],
    [11.51, 11.34, 11.54, 11.31, 85261597, 970021739.4, 11.38, 11.6, -0.26, -2.24, 0.44, '2022-10-13'],
    [11.45, 11.53, 11.63, 11.4, 109606158, 1265486550.33, 11.55, 11.34, 0.19, 1.68, 0.56, '2022-10-14'],
    [11.42, 11.48, 11.52, 11.34, 102482271, 1171523550.16, 11.43, 11.53, -0.05, -0.43, 0.53, '2022-10-17'],
    [11.55, 11.48, 11.64, 11.46, 94683709, 1091646643.72, 11.53, 11.48, 0, 0, 0.49, '2022-10-18'],
    [11.42, 11.29, 11.49, 11.28, 92398968, 1049700767.19, 11.36, 11.48, -0.19, -1.66, 0.48, '2022-10-19'],
    [11.23, 11.2, 11.31, 11.16, 78192323, 876967150.61, 11.22, 11.29, -0.09, -0.8, 0.4, '2022-10-20'],
    [11.21, 11.09, 11.25, 11.07, 78557429, 876648490.61, 11.16, 11.2, -0.11, -0.98, 0.4, '2022-10-21'],
    [11.09, 10.62, 11.1, 10.61, 138339065, 1496043940.13, 10.81, 11.09, -0.47, -4.24, 0.71, '2022-10-24'],
    [10.7, 10.65, 10.81, 10.6, 131697940, 1406437766.06, 10.68, 10.62, 0.03, 0.28, 0.68, '2022-10-25'],
    [10.64, 10.66, 10.73, 10.61, 114382988, 1220733277.85, 10.67, 10.65, 0.01, 0.09, 0.59, '2022-10-26'],
    [10.7, 10.68, 10.77, 10.66, 95738346, 1024868047.21, 10.7, 10.66, 0.02, 0.19, 0.49, '2022-10-27'],
    [10.63, 10.42, 10.7, 10.41, 105794701, 1114999302.11, 10.54, 10.68, -0.26, -2.43, 0.55, '2022-10-28'],
    [10.33, 10.34, 10.45, 10.22, 98309569, 1016230012.22, 10.34, 10.42, -0.08, -0.77, 0.51, '2022-10-31'],
    [10.38, 10.67, 10.68, 10.36, 138123413, 1459758367.32, 10.57, 10.34, 0.33, 3.19, 0.71, '2022-11-01'],
    [10.61, 10.63, 10.68, 10.48, 130298818, 1377816220.13, 10.57, 10.67, -0.04, -0.37, 0.67, '2022-11-02'],
    [10.54, 10.44, 10.57, 10.38, 98353561, 1028904286.04, 10.46, 10.63, -0.19, -1.79, 0.51, '2022-11-03'],
    [10.4, 10.82, 10.85, 10.39, 177611223, 1903720943.52, 10.72, 10.44, 0.38, 3.64, 0.92, '2022-11-04'],
    [10.81, 10.88, 10.91, 10.73, 98808204, 1070554832.9, 10.83, 10.82, 0.06, 0.55, 0.51, '2022-11-07'],
    [10.89, 10.85, 10.92, 10.78, 58322205, 632835804.82, 10.85, 10.88, -0.03, -0.28, 0.3, '2022-11-08'],
    [10.84, 10.89, 11.08, 10.82, 83210685, 911153622.45, 10.95, 10.85, 0.04, 0.37, 0.43, '2022-11-09'],
    [10.79, 10.87, 10.9, 10.69, 55202119, 596916589.27, 10.81, 10.89, -0.02, -0.18, 0.28, '2022-11-10'],
    [11.13, 11.43, 11.66, 11.01, 254507055, 2878557391.61, 11.31, 10.87, 0.56, 5.15, 1.31, '2022-11-11'],
    [11.7, 11.95, 12.28, 11.7, 387208410, 4637823413.97, 11.98, 11.43, 0.52, 4.55, 2, '2022-11-14'],
    [11.86, 12.01, 12.18, 11.83, 157390134, 1891249648.05, 12.02, 11.95, 0.06, 0.5, 0.81, '2022-11-15'],
    [11.97, 11.82, 12.05, 11.79, 127869288, 1519133931.85, 11.88, 12.01, -0.19, -1.58, 0.66, '2022-11-16'],
    [11.81, 11.69, 11.84, 11.58, 109104716, 1273790880.66, 11.67, 11.82, -0.13, -1.1, 0.56, '2022-11-17'],
    [11.74, 11.59, 11.78, 11.57, 86809329, 1011078679.59, 11.65, 11.69, -0.1, -0.86, 0.45, '2022-11-18'],
    [11.48, 11.46, 11.5, 11.22, 104773707, 1189388618.26, 11.35, 11.59, -0.13, -1.12, 0.54, '2022-11-21'],
    [11.46, 11.82, 11.93, 11.44, 149132388, 1748727406.58, 11.73, 11.46, 0.36, 3.14, 0.77, '2022-11-22'],
    [11.78, 11.82, 12.05, 11.72, 124765653, 1483352651.73, 11.89, 11.82, 0, 0, 0.64, '2022-11-23'],
    [11.92, 11.77, 11.99, 11.69, 79671882, 941002372.92, 11.81, 11.82, -0.05, -0.42, 0.41, '2022-11-24'],
    [11.79, 12.17, 12.23, 11.77, 176072817, 2130171604.64, 12.1, 11.77, 0.4, 3.4, 0.91, '2022-11-25'],
    [11.9, 11.81, 11.92, 11.69, 133156295, 1568351120.17, 11.78, 12.17, -0.36, -2.96, 0.69, '2022-11-28'],
    [12.16, 12.99, 12.99, 12.13, 474927650, 6026006641.97, 12.69, 11.81, 1.18, 9.99, 2.45, '2022-11-29'],
    [12.9, 13.03, 13.34, 12.82, 320962830, 4206404173.08, 13.11, 12.99, 0.04, 0.31, 1.65, '2022-11-30'],
    [13.38, 13.1, 13.66, 13.07, 200268883, 2658203027.2, 13.27, 13.03, 0.07, 0.54, 1.03, '2022-12-01'],
    [13.14, 12.9, 13.15, 12.69, 140420278, 1803658762.25, 12.84, 13.1, -0.2, -1.53, 0.72, '2022-12-02'],
    [13.09, 13.53, 13.57, 13.01, 228762742, 3057231972.57, 13.36, 12.9, 0.63, 4.88, 1.18, '2022-12-05'],
    [13.34, 13.43, 13.66, 13.25, 125257891, 1680593515.5, 13.42, 13.53, -0.1, -0.74, 0.65, '2022-12-06'],
    [13.33, 13.15, 13.37, 13.03, 137737690, 1815667663.45, 13.18, 13.43, -0.28, -2.08, 0.71, '2022-12-07'],
    [13.15, 13.36, 13.52, 13.12, 106572280, 1422047904.5, 13.34, 13.15, 0.21, 1.6, 0.55, '2022-12-08'],
    [13.4, 13.7, 13.75, 13.35, 161583192, 2197501648.81, 13.6, 13.36, 0.34, 2.54, 0.83, '2022-12-09'],
    [13.58, 13.11, 13.58, 13.06, 139258428, 1848277966.6, 13.27, 13.7, -0.59, -4.31, 0.72, '2022-12-12'],
    [13.15, 13.24, 13.36, 13.14, 90228513, 1194285343.09, 13.24, 13.11, 0.13, 0.99, 0.46, '2022-12-13'],
    [13.23, 13.23, 13.4, 13.08, 97406110, 1287867945.07, 13.22, 13.24, -0.01, -0.08, 0.5, '2022-12-14'],
    [13.14, 13.1, 13.28, 12.94, 83534926, 1094434005.98, 13.1, 13.23, -0.13, -0.98, 0.43, '2022-12-15'],
    [13.02, 13.34, 13.4, 13.02, 92425167, 1225269166.25, 13.26, 13.1, 0.24, 1.83, 0.48, '2022-12-16'],
    [13.33, 13.04, 13.47, 12.95, 103086606, 1355435567.16, 13.15, 13.34, -0.3, -2.25, 0.53, '2022-12-19'],
    [12.97, 12.76, 13.08, 12.67, 89621223, 1150630681.38, 12.84, 13.04, -0.28, -2.15, 0.46, '2022-12-20'],
    [12.85, 12.89, 12.99, 12.74, 61458964, 791782473.29, 12.88, 12.76, 0.13, 1.02, 0.32, '2022-12-21'],
    [13, 12.95, 13.15, 12.9, 67239430, 876159828.48, 13.03, 12.89, 0.06, 0.47, 0.35, '2022-12-22'],
    [12.85, 12.98, 13.06, 12.8, 56442641, 730705958.53, 12.95, 12.95, 0.03, 0.23, 0.29, '2022-12-23'],
    [12.99, 12.77, 13.04, 12.71, 79711987, 1021903962.65, 12.82, 12.98, -0.21, -1.62, 0.41, '2022-12-26'],
    [12.87, 13.11, 13.22, 12.87, 88600412, 1160090119.01, 13.09, 12.77, 0.34, 2.66, 0.46, '2022-12-27'],
    [13.16, 13.14, 13.38, 13, 79119198, 1042402080.41, 13.18, 13.11, 0.03, 0.23, 0.41, '2022-12-28'],
    [13.07, 13.03, 13.13, 12.85, 66689009, 865144967.1, 12.97, 13.14, -0.11, -0.84, 0.34, '2022-12-29'],
    [13.04, 13.16, 13.28, 12.96, 81803598, 1074756753.75, 13.14, 13.03, 0.13, 1, 0.42, '2022-12-30'],
    [13.2, 13.77, 13.85, 13.05, 219412794, 2971546989.04, 13.54, 13.16, 0.61, 4.64, 1.13, '2023-01-03'],
    [13.71, 14.32, 14.42, 13.63, 218968253, 3110729449.03, 14.21, 13.77, 0.55, 3.99, 1.13, '2023-01-04'],
    [14.4, 14.48, 14.74, 14.37, 166542518, 2417272355.99, 14.51, 14.32, 0.16, 1.12, 0.86, '2023-01-05'],
    [14.5, 14.62, 14.72, 14.48, 119574471, 1747915169.26, 14.62, 14.48, 0.14, 0.97, 0.62, '2023-01-06'],
    [14.75, 14.8, 14.88, 14.52, 105765911, 1561368487.3, 14.76, 14.62, 0.18, 1.23, 0.55, '2023-01-09'],
    [14.76, 14.44, 14.89, 14.39, 126942339, 1851093716.76, 14.58, 14.8, -0.36, -2.43, 0.65, '2023-01-10'],
    [14.45, 14.67, 14.78, 14.39, 83056612, 1217450811.64, 14.66, 14.44, 0.23, 1.59, 0.43, '2023-01-11'],
    [14.77, 14.67, 14.77, 14.53, 62569484, 914367699.65, 14.61, 14.67, 0, 0, 0.32, '2023-01-12'],
    [14.67, 14.95, 14.95, 14.55, 94908583, 1407181074.29, 14.83, 14.67, 0.28, 1.91, 0.49, '2023-01-13'],
    [14.95, 15.08, 15.28, 14.85, 156003989, 2356399992.83, 15.1, 14.95, 0.13, 0.87, 0.8, '2023-01-16'],
    [15.13, 14.97, 15.18, 14.77, 93583454, 1396151514.52, 14.92, 15.08, -0.11, -0.73, 0.48, '2023-01-17'],
    [14.95, 15.11, 15.18, 14.91, 71843403, 1083362997.53, 15.08, 14.97, 0.14, 0.94, 0.37, '2023-01-18'],
    [15.13, 15.09, 15.25, 14.87, 64187520, 963744633.47, 15.01, 15.11, -0.02, -0.13, 0.33, '2023-01-19'],
    [15.16, 15.13, 15.24, 15, 60859008, 920144805.73, 15.12, 15.09, 0.04, 0.27, 0.31, '2023-01-20'],
    [15.6, 15.15, 15.74, 14.89, 137431750, 2096867649.37, 15.26, 15.13, 0.02, 0.13, 0.71, '2023-01-30'],
    [15.24, 14.99, 15.51, 14.96, 103049784, 1568639326.21, 15.22, 15.15, -0.16, -1.06, 0.53, '2023-01-31'],
    [15.03, 14.7, 15.08, 14.51, 165342148, 2426471972.52, 14.68, 14.99, -0.29, -1.93, 0.85, '2023-02-01'],
    [14.74, 14.6, 14.78, 14.27, 157790039, 2280744883.13, 14.45, 14.7, -0.1, -0.68, 0.81, '2023-02-02'],
    [14.45, 14.32, 14.55, 14.16, 124638298, 1782105890.79, 14.3, 14.6, -0.28, -1.92, 0.64, '2023-02-03'],
    [14.1, 14, 14.13, 13.86, 131761010, 1838428709.03, 13.95, 14.32, -0.32, -2.23, 0.68, '2023-02-06'],
    [14.06, 14.21, 14.32, 14.03, 86946046, 1235297762.54, 14.21, 14, 0.21, 1.5, 0.45, '2023-02-07'],
    [14.24, 14.04, 14.32, 14.03, 65789257, 928708933.85, 14.12, 14.21, -0.17, -1.2, 0.34, '2023-02-08'],
    [14.01, 14.13, 14.3, 13.96, 83035002, 1174361963.28, 14.14, 14.04, 0.09, 0.64, 0.43, '2023-02-09'],
    [14.1, 13.98, 14.12, 13.86, 84728366, 1184283386.2, 13.98, 14.13, -0.15, -1.06, 0.44, '2023-02-10'],
    [13.94, 13.82, 13.94, 13.6, 180005416, 2473405202.92, 13.74, 13.98, -0.16, -1.14, 0.93, '2023-02-13'],
    [13.85, 13.96, 13.98, 13.8, 90993709, 1263892077.72, 13.89, 13.82, 0.14, 1.01, 0.47, '2023-02-14'],
    [13.95, 13.67, 13.96, 13.62, 125024398, 1713566672.72, 13.71, 13.96, -0.29, -2.08, 0.64, '2023-02-15'],
    [13.68, 13.6, 13.91, 13.5, 127912329, 1757431083.85, 13.74, 13.67, -0.07, -0.51, 0.66, '2023-02-16'],
    [13.63, 13.43, 13.72, 13.43, 91836369, 1246777397.11, 13.58, 13.6, -0.17, -1.25, 0.47, '2023-02-17'],
    [13.5, 14.15, 14.15, 13.49, 211619117, 2945969773.39, 13.92, 13.43, 0.72, 5.36, 1.09, '2023-02-20'],
    [14.06, 14.1, 14.2, 13.92, 99049499, 1393153377.3, 14.07, 14.15, -0.05, -0.35, 0.51, '2023-02-21'],
    [14, 14.02, 14.12, 13.94, 63892239, 895742534.31, 14.02, 14.1, -0.08, -0.57, 0.33, '2023-02-22'],
    [14, 14.05, 14.32, 13.98, 82449068, 1165539851.19, 14.14, 14.02, 0.03, 0.21, 0.42, '2023-02-23'],
    [14.02, 13.86, 14.03, 13.8, 72998904, 1012652971.88, 13.87, 14.05, -0.19, -1.35, 0.38, '2023-02-24'],
    [13.75, 13.69, 13.88, 13.68, 62146193, 854854040.54, 13.76, 13.86, -0.17, -1.23, 0.32, '2023-02-27'],
    [13.75, 13.78, 13.85, 13.61, 60793592, 833316018.45, 13.71, 13.69, 0.09, 0.66, 0.31, '2023-02-28'],
    [13.8, 14.17, 14.19, 13.74, 122345178, 1719710647.06, 14.06, 13.78, 0.39, 2.83, 0.63, '2023-03-01'],
    [14.13, 14.24, 14.44, 14.06, 101587684, 1447565979.98, 14.25, 14.17, 0.07, 0.49, 0.52, '2023-03-02'],
    [14.35, 14.29, 14.37, 14.14, 69095439, 985552120.63, 14.26, 14.24, 0.05, 0.35, 0.36, '2023-03-03'],
    [14.3, 13.85, 14.3, 13.72, 145582414, 2023954547.2, 13.9, 14.29, -0.44, -3.08, 0.75, '2023-03-06'],
    [13.85, 13.69, 14.1, 13.65, 127926629, 1773654737.03, 13.86, 13.85, -0.16, -1.16, 0.66, '2023-03-07'],
    [13.63, 13.53, 13.64, 13.4, 109689791, 1479838980.07, 13.49, 13.69, -0.16, -1.17, 0.57, '2023-03-08'],
    [13.54, 13.2, 13.58, 13.13, 173606476, 2305765842.21, 13.28, 13.53, -0.33, -2.44, 0.89, '2023-03-09'],
    [13, 13.14, 13.27, 13, 85699610, 1128558359.5, 13.17, 13.2, -0.06, -0.45, 0.44, '2023-03-10'],
    [13.12, 13.05, 13.29, 13, 100063496, 1309490079.38, 13.09, 13.14, -0.09, -0.68, 0.52, '2023-03-13'],
    [12.99, 12.87, 13, 12.73, 114907558, 1474124198.86, 12.83, 13.05, -0.18, -1.38, 0.59, '2023-03-14'],
    [13.05, 13.05, 13.18, 12.94, 97936372, 1278262225.47, 13.05, 12.87, 0.18, 1.4, 0.5, '2023-03-15'],
    [12.89, 12.82, 13.03, 12.8, 91679249, 1182054433.62, 12.89, 13.05, -0.23, -1.76, 0.47, '2023-03-16'],
    [12.99, 12.75, 13.04, 12.65, 155681414, 2000832407.83, 12.85, 12.82, -0.07, -0.55, 0.8, '2023-03-17'],
    [12.76, 12.57, 12.85, 12.55, 118881633, 1505893658.68, 12.67, 12.75, -0.18, -1.41, 0.61, '2023-03-20'],
    [12.65, 12.7, 12.78, 12.5, 84074317, 1060914056.37, 12.62, 12.57, 0.13, 1.03, 0.43, '2023-03-21'],
    [12.75, 12.79, 12.88, 12.71, 87669077, 1121080753.38, 12.79, 12.7, 0.09, 0.71, 0.45, '2023-03-22'],
    [12.7, 12.9, 12.9, 12.63, 80430604, 1029380497.27, 12.8, 12.79, 0.11, 0.86, 0.41, '2023-03-23']
  ];
  // 年K只显示全部图表
  // (dataZoom显示的视图范围,数据多则从50% - 100%,数据少则从0% - 100%)
  startValue.value = 60;
  if (stockData.length <= 50) {
    
    
    startValue.value = 0;
  }
  for (let i = 0; i < stockData.length; i++) {
    
    
    // pre_close.push(stockData[i][7])
    // volumes.push(stockData[i][4])
    // turnovers.push(stockData[i][5])
    // pct_change.push(stockData[i][9])
    // turnover_rate.push(stockData[i][10])
    if (i == stockData.length - 1) {
    
    
      if (stockData[i][0] == 0 || stockData[i][1] == 0 || stockData[i][2] == 0 || stockData[i][3] == 0) {
    
    
        continue;
      }
    }
    let forYData = [];
    forYData.push(stockData[i][0], stockData[i][1], stockData[i][3], stockData[i][2]);
    /* 如果功能指标类型不等于2,成交量push-- */
    // if (state.features !== 2) {
    
    
    showVolumes.value[i] = {
    
    
      value: stockData[i][4],
      itemStyle: {
    
    
        color: stockData[i][1] >= stockData[i][0] ? '#FF3232' : '#00FFFF',
        borderColor: stockData[i][1] >= stockData[i][0] ? '#FF3232' : '#00FFFF'
      }
    };
    // }
    yDatas.value[i] = {
    
    
      value: forYData,
      itemStyle: {
    
    
        color: stockData[i][1] >= stockData[i][0] ? '#FF3232' : '#00FFFF',
        color0: stockData[i][1] >= stockData[i][0] ? '#FF3232' : '#00FFFF',
        borderColor: stockData[i][1] >= stockData[i][0] ? '#FF3232' : '#00FFFF',
        borderColor0: stockData[i][1] >= stockData[i][0] ? '#FF3232' : '#00FFFF'
      }
    };
    xDates.value[i] = stockData[i][11];
  }
  // 当前数据长度
  currentDateLength.value = xDates.value.length;

  options['xAxis'] = [
    {
    
    
      type: 'category',
      name: '',
      min: 0,
      max: currentDateLength.value,
      interval: currentDateLength.value,
      gridIndex: 0,
      data: xDates.value,
      axisTick: {
    
    
        show: false
      },
      axisLabel: {
    
    
        show: false,
        fontSize: 10,
        color: '#CCCCCC'
      },
      axisLine: {
    
    
        show: false,
        lineStyle: {
    
    
          color: '#CCCCCC'
        }
      },
      axisPointer: {
    
    
        fontSize: 10,
        label: {
    
    
          show: false
        }
      },
      splitLine: {
    
    
        show: false
      }
    },
    {
    
    
      // 主图
      type: 'category',
      name: '',
      min: 0,
      max: currentDateLength.value,
      interval: currentDateLength.value,
      gridIndex: 1,
      data: xDates.value,
      axisTick: {
    
    
        show: false
      },
      axisLabel: {
    
    
        show: false,
        fontSize: 10,
        color: '#CCCCCC'
      },
      axisLine: {
    
    
        show: false,
        lineStyle: {
    
    
          color: '#CCCCCC'
        }
      },
      axisPointer: {
    
    
        fontSize: 10,
        label: {
    
    
          show: false
        }
      },
      splitLine: {
    
    
        show: false
      }
    },
    {
    
    
      type: 'category',
      name: '',
      gridIndex: 2,
      min: 0,
      max: currentDateLength.value,
      // interval: currentDateLength.value,
      data: xDates.value,
      axisTick: {
    
    
        show: false
      },
      axisLabel: {
    
    
        show: true,
        fontSize: 10,
        color: '#bcbcbc',
        formatter: function (value: any, index: any) {
    
    
          return value;
        }
      },
      axisLine: {
    
    
        show: false,
        lineStyle: {
    
    
          color: '#CCCCCC'
        }
      },
      axisPointer: {
    
    
        label: {
    
    
          show: true,
          fontSize: 10
        }
      },
      splitLine: {
    
    
        show: false
      }
    },
    {
    
    
      gridIndex: 3,
      min: 0,
      max: currentDateLength.value,
      interval: currentDateLength.value,
      data: xDates.value,
      axisTick: {
    
    
        show: false
      },
      axisLabel: {
    
    
        show: false
      },
      axisLine: {
    
    
        show: false
      },
      axisPointer: {
    
    
        show: false
      },
      splitLine: {
    
    
        show: false
      }
    }
  ];

  options['yAxis'] = [
    {
    
    
      gridIndex: 0,
      show: false,
      scale: true,
      z: 5,
      interval: yDatas.value[0]?.value[0] || yDatas.value[0][0],
      axisLabel: {
    
    
        fontSize: 10,
        color: '#CCCCCC'
      },
      axisLine: {
    
    
        show: false,
        lineStyle: {
    
    
          color: '#CCCCCC'
        }
      },
      axisPointer: {
    
    
        snap: true,
        label: {
    
    
          show: true,
          fontSize: 10
        }
      },
      splitLine: {
    
    
        show: false
      }
    },
    {
    
    
      show: false,
      gridIndex: 1,
      scale: true,
      boundaryGap: ['10%', '10%'],
      z: 5,
      // min:0,
      splitNumber: 10,
      axisLabel: {
    
    
        fontSize: 10,
        color: '#CCCCCC'
      },
      axisLine: {
    
    
        show: false,
        lineStyle: {
    
    
          color: '#CCCCCC'
        }
      },
      axisPointer: {
    
    
        label: {
    
    
          show: true,
          fontSize: 10
        }
      },
      splitLine: {
    
    
        show: false
      }
    },
    {
    
    
      show: false,
      gridIndex: 2,
      scale: true,
      z: 4,
      splitNumber: 10,
      axisLabel: {
    
    
        fontSize: 10,
        color: '#CCCCCC'
      },
      axisLine: {
    
    
        show: false,
        lineStyle: {
    
    
          color: '#CCCCCC'
        }
      },
      axisPointer: {
    
    
        snap: true,
        label: {
    
    
          show: true,
          fontSize: 10,
          formatter: function (params: any) {
    
    
            return fomatFloat(params.value);
          }
        }
      },
      splitLine: {
    
    
        show: false
      }
    },
    {
    
    
      show: false,
      gridIndex: 3,
      scale: true,
      z: 4,
      splitNumber: 10,
      axisLabel: {
    
    
        show: true,
        fontSize: 10,
        color: '#CCCCCC'
      },
      axisLine: {
    
    
        show: false,
        lineStyle: {
    
    
          color: '#CCCCCC'
        }
      },
      axisPointer: {
    
    
        snap: true,
        label: {
    
    
          show: true,
          fontSize: 10,
          formatter: function (params: any) {
    
    
            return fomatFloat(params.value);
          }
        }
      },
      splitLine: {
    
    
        show: false
      }
    }
  ];

  options['dataZoom'] = [
    {
    
    
      show: false,
      type: 'inside',
      xAxisIndex: [0, 1, 2, 3],
      start: startValue.value,
      end: endValue.value,
      filterMode: 'filter',
      moveOnMouseMove: !isOffset.value
    },
    {
    
    
      show: false,
      xAxisIndex: [0, 1, 2, 3],
      type: 'slider',
      bottom: '0%',
      start: startValue.value,
      end: endValue.value,
      height: 0,
      handleSize: 0,
      moveHandleSize: 0,
      filterMode: 'filter'
    }
  ];

  options['series'] = [
    {
    
    
      gridIndex: 0,
      xAxisIndex: 0,
      yAxisIndex: 0,
      type: 'candlestick',
      data: yDatas.value,
      barWidth: '50%',
      smooth: true,
      large: true, //大数据优化
      largeThreshold: 200, //优化阈值
      markPoint: {
    
    
        label: {
    
    
          color: '#FFFFFF',
          fontSize: 10
        },
        symbol: 'circle',
        symbolSize: 0,
        data: [
          {
    
    
            type: 'max',
            // 设置markpoint图标的位置
            symbolOffset: [0, -12]
          },
          {
    
    
            type: 'min',
            // 设置markpoint图标的位置
            symbolOffset: [0, 12]
          }
        ]
      },
      itemStyle: {
    
    
        color: '#e93030',
        color0: '#31a426',
        borderColor: '#e93030',
        borderColor0: '#31a426'
      }
    },
    {
    
    
      gridIndex: 2,
      xAxisIndex: 2,
      yAxisIndex: 2,
      type: 'bar',
      data: showVolumes.value,
      barWidth: '50%',
      smooth: true,
      large: true, //大数据优化
      largeThreshold: 200 //优化阈值
    }
  ];
  calculateMA();
  calculateMACD();
  nextTick(() => {
    
    
    showCharts.value = true;
  });
}

function start(event: any) {
    
    
  // console.log('长按事件',event)
  if (timer.value) {
    
    
    clearTimeout(timer.value);
  }
  (timer.value as any) = setTimeout(() => {
    
    
    startValue.value = vchart.value.getOption().dataZoom[0].start;
    endValue.value = vchart.value.getOption().dataZoom[0].end;
    options.dataZoom[0].start = startValue.value;
    options.dataZoom[1].start = startValue.value;
    options.dataZoom[0].end = endValue.value;
    options.dataZoom[1].end = endValue.value;
    vchart.value.setOption(options);
    event.preventDefault();
    isOffset.value = true;
    options.tooltip.show = isOffset.value;
    options.dataZoom['moveOnMouseMove'] = !isOffset.value;
  }, 800);
}
function end() {
    
    
  if (timer.value) {
    
    
    clearTimeout(timer.value);
  }
  if (isOffset.value) {
    
    
    isOffset.value = false;
    options.tooltip.show = isOffset.value;
    options.dataZoom['moveOnMouseMove'] = !isOffset.value;
  }
}
onBeforeMount(() => {
    
    
  initChart();
});
</script>
<style scoped>
.stock-chart {
    
    
  width: 100vw;
  height: 100vh;
  background-color: #141923;
}
.stock-chart-box {
    
    
  position: relative;
  width: 100%;
  height: 6rem;
  z-index: 9;
}
</style>

猜你喜欢

转载自blog.csdn.net/xiaorunye/article/details/128154835