Automate issuer overlay creation from ticker searches
This commit is contained in:
@@ -31,7 +31,7 @@ export function getPriceChangeColor(change: number): string {
|
||||
* Convert CSS variable to computed color value
|
||||
* Used for chart export since html-to-image can't render CSS variables
|
||||
*/
|
||||
export function cssVarToColor(cssVar: string): string {
|
||||
function cssVarToColor(cssVar: string): string {
|
||||
if (typeof window === 'undefined') return cssVar;
|
||||
|
||||
// If it's already a color value, return as-is
|
||||
|
||||
@@ -59,7 +59,7 @@ export function isPriceData(data: ChartDataPoint): data is { date: string; price
|
||||
* Normalize data to ensure consistent structure
|
||||
* Converts price data to OHLCV-like structure for candlestick charts
|
||||
*/
|
||||
export function normalizeChartData<T extends ChartDataPoint>(data: T[]): T[] {
|
||||
function normalizeChartData<T extends ChartDataPoint>(data: T[]): T[] {
|
||||
if (!data || data.length === 0) return [];
|
||||
|
||||
// Sort by date ascending
|
||||
@@ -72,7 +72,7 @@ export function normalizeChartData<T extends ChartDataPoint>(data: T[]): T[] {
|
||||
* Sample data for performance with large datasets
|
||||
* Keeps every Nth point when dataset is too large
|
||||
*/
|
||||
export function sampleData<T extends ChartDataPoint>(
|
||||
function sampleData<T extends ChartDataPoint>(
|
||||
data: T[],
|
||||
maxPoints: number = 1000
|
||||
): T[] {
|
||||
@@ -96,7 +96,7 @@ export function sampleData<T extends ChartDataPoint>(
|
||||
/**
|
||||
* Calculate min/max values for Y-axis domain
|
||||
*/
|
||||
export function calculateYAxisDomain<T extends ChartDataPoint>(
|
||||
function calculateYAxisDomain<T extends ChartDataPoint>(
|
||||
data: T[],
|
||||
padding: number = 0.1
|
||||
): [number, number] {
|
||||
@@ -126,7 +126,7 @@ export function calculateYAxisDomain<T extends ChartDataPoint>(
|
||||
/**
|
||||
* Calculate volume max for volume indicator Y-axis
|
||||
*/
|
||||
export function calculateVolumeMax<T extends ChartDataPoint>(data: T[]): number {
|
||||
function calculateVolumeMax<T extends ChartDataPoint>(data: T[]): number {
|
||||
if (data.length === 0 || !isOHLCVData(data[0])) return 0;
|
||||
|
||||
return Math.max(...data.map(d => (isOHLCVData(d) ? d.volume : 0)));
|
||||
|
||||
Reference in New Issue
Block a user