|
|
@@ -12,6 +12,7 @@ import {
|
|
|
extractBidVolumes,
|
|
|
extractMaxTradedVolume,
|
|
|
extractAvgTradedVolume,
|
|
|
+ extractMedianTradedVolume,
|
|
|
extractMaxVolume,
|
|
|
zoomTimeFormat,
|
|
|
extractMaxAskBidVolume
|
|
|
@@ -312,7 +313,8 @@ export default class StockHeatmap extends React.Component {
|
|
|
this.updateHeatmapDimensions();
|
|
|
|
|
|
// 2. Draw the bid ask spread heatmap
|
|
|
- this.clearCanvas(0, 0, this.defaults.hmWidth(), this.defaults.hmHeight(), '#ffffff');
|
|
|
+ this.clearCanvas(this.defaults.borderPadding[3], this.defaults.borderPadding[0],
|
|
|
+ this.defaults.hmWidth(), this.defaults.hmHeight(), this.defaults.clearColor);
|
|
|
this.drawMainGraph();
|
|
|
|
|
|
// 3. Draw xy Axis
|
|
|
@@ -629,7 +631,8 @@ export default class StockHeatmap extends React.Component {
|
|
|
drawMainGraph = () => {
|
|
|
this.drawingContext.save();
|
|
|
if (this.xScale && this.yScale && this.bidAskScale && this.drawingContext !== null) {
|
|
|
- const avgTradedVolume = extractAvgTradedVolume(this.data);
|
|
|
+ // const avgTradedVolume = extractAvgTradedVolume(this.data);
|
|
|
+ const medianTradedVolume = extractMedianTradedVolume(this.windowedData);
|
|
|
const maxBidAskVolume = extractMaxAskBidVolume(this.windowedData);
|
|
|
const xh2 = this.xScale.bandwidth() * 0.5;
|
|
|
const yh2 = this.yScale.bandwidth() * 0.5;
|
|
|
@@ -693,7 +696,7 @@ export default class StockHeatmap extends React.Component {
|
|
|
let trade_color = d3.color("#44c98b").rgb();
|
|
|
trade_color.opacity = 0.7;
|
|
|
this.drawingContext.fillStyle = trade_color.toString();
|
|
|
- const r = 50 - 45 * (2.71 ** (-0.01 * (+marketDepth.lastBuyQty / avgTradedVolume)));
|
|
|
+ const r = 50 - 45 * (2.71 ** (-0.01 * (+marketDepth.lastBuyQty / medianTradedVolume)));
|
|
|
this.drawingContext.beginPath();
|
|
|
this.drawingContext.arc(
|
|
|
this.xScale(ts) + xh2,
|
|
|
@@ -728,7 +731,7 @@ export default class StockHeatmap extends React.Component {
|
|
|
let trade_color = d3.color("#cc5040").rgb();
|
|
|
trade_color.opacity = 0.7;
|
|
|
this.drawingContext.fillStyle = trade_color.toString();
|
|
|
- const r = 50 - 45 * (2.71 ** (-0.01 * (+marketDepth.lastSellQty / avgTradedVolume)));
|
|
|
+ const r = 50 - 45 * (2.71 ** (-0.01 * (+marketDepth.lastSellQty / medianTradedVolume)));
|
|
|
this.drawingContext.beginPath();
|
|
|
this.drawingContext.arc(
|
|
|
this.xScale(ts) + xh2,
|