UNPKG

@neabyte/candlestick-cli

Version:

Beautiful terminal candlestick charts with real-time trading data. Create stunning ASCII art charts directly in your terminal with support for live market data, custom colors, and professional trading visualization.

1 lines 642 B
import{CONSTANTS}from"../constants.js";import{truecolor}from"../utils/core.js";import{CandleType}from"../types/candlestick.js";export class VolumePane{height;enabled=!0;bearishColor=[234,74,90];bullishColor=[52,208,88];unicodeFill=CONSTANTS.UNICODE_FILL;constructor(o){this.height=o}colorize(o,e){const i=o===CandleType.Bearish?this.bearishColor:this.bullishColor;return truecolor(e,...i)}render(o,e,i){if(void 0===o.volume)return" ";const r=o.volume/(i||1)*this.height;return e<Math.ceil(r)?this.colorize(o.type,this.unicodeFill):1===e&&this.unicodeFill===CONSTANTS.UNICODE_FILL?this.colorize(o.type,CONSTANTS.UNICODE_HALF_BODY_BOTTOM):" "}}