Bläddra i källkod

一些细节问题修复。

skyffire 1 år sedan
förälder
incheckning
879a01647c
1 ändrade filer med 12 tillägg och 12 borttagningar
  1. 12 12
      src/index.js

+ 12 - 12
src/index.js

@@ -317,18 +317,18 @@ export default class StockHeatmap extends React.Component {
       this.drawingContext.textAlign = 'center';
       this.drawingContext.textBaseline = 'middle';
       this.drawingContext.font = `bold ${textHeight}px sans-serif`;
-      this.drawingContext.fillText((d.marketDepth.buyOrderVolume / d.marketDepth.sellOrderVolume).toFixed(2), x + w *3/4, y + textHeight / 2);
-      // Runing average ratio
-      if(this.windowedData.length >= this.defaults.runningRatioSeconds) {
-        let sellT20RunningSum = 0;
-        let buyT20RunningSum = 0;
-        for (let i = this.windowedData.length - 1; i >= this.windowedData.length - this.defaults.runningRatioSeconds; i--) {
-          sellT20RunningSum += (this.windowedData[i].marketDepth.sells || []).reduce((vol, s) => vol + s.qty,0);
-          buyT20RunningSum += (this.windowedData[i].marketDepth.buys || []).reduce((vol, s) => vol + s.qty,0);
-        }
-        const newBSTPFactor = (buyT20RunningSum / sellT20RunningSum);
-        this.drawingContext.fillText(newBSTPFactor.toFixed(2), x + w /4, y + textHeight *0.5);
-      }
+      this.drawingContext.fillText((d.marketDepth.buyOrderVolume / d.marketDepth.sellOrderVolume).toFixed(2), x + w * 1/2, y + textHeight / 2);
+      // // Runing average ratio
+      // if(this.windowedData.length >= this.defaults.runningRatioSeconds) {
+      //   let sellT20RunningSum = 0;
+      //   let buyT20RunningSum = 0;
+      //   for (let i = this.windowedData.length - 1; i >= this.windowedData.length - this.defaults.runningRatioSeconds; i--) {
+      //     sellT20RunningSum += (this.windowedData[i].marketDepth.sells || []).reduce((vol, s) => vol + s.qty,0);
+      //     buyT20RunningSum += (this.windowedData[i].marketDepth.buys || []).reduce((vol, s) => vol + s.qty,0);
+      //   }
+      //   const newBSTPFactor = (buyT20RunningSum / sellT20RunningSum);
+      //   this.drawingContext.fillText(newBSTPFactor.toFixed(2), x + w /4, y + textHeight *0.5);
+      // }
       this.drawingContext.font = `bold ${13}px sans-serif`;
       this.drawingContext.textBaseline = 'bottom';
       this.drawingContext.fillText('Buy/Sell', x + w / 2, y + textHeight * 2 + 5);