UNPKG

candlestick-chart-generator

Version:

A Node.js library for generating candlestick chart screenshots using financial data

39 lines (33 loc) • 1.47 kB
const CandlestickChartGenerator = require('./index'); async function testEnhancedChart() { const generator = new CandlestickChartGenerator({ headless: true }); try { console.log('=== Testing Enhanced Chart Features ===\n'); console.log('šŸš€ Generating chart with volume, OHLC, current price, time, and buy/sell signals...\n'); await generator.generateChartScreenshot({ symbol: 'BTC-USD', interval: '4h', startDate: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000), // Last 30 days endDate: new Date(), outputPath: 'test_enhanced_chart.png', width: 1400, height: 800, chartOptions: { backgroundColor: '#131722' } }); console.log('āœ… Enhanced chart generated successfully!'); console.log('šŸ“Š Features included:'); console.log(' • Volume bars below main chart'); console.log(' • Current price and time display'); console.log(' • OHLC values for latest candle'); console.log(' • Buy/Sell signals based on MA crossover'); console.log(' • Formatted volume display'); console.log('\nšŸ“ Chart saved as: test_enhanced_chart.png'); } catch (error) { console.error('āŒ Error:', error.message); } finally { await generator.close(); } } testEnhancedChart();