candlestick-chart-generator
Version:
A Node.js library for generating candlestick chart screenshots using financial data
39 lines (33 loc) ⢠1.47 kB
JavaScript
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();