UNPKG

@dschz/solid-tradingview-widgets

Version:

SolidJS bindings for TradingView Widgets — ready-to-use financial tools you can embed into your website to display market data.

1,349 lines (1,341 loc) 74.7 kB
import { JSX } from 'solid-js'; type ColorTheme = "light" | "dark"; type Size = number | "full"; type Locale = /** English */ "en" | "in" | "de_DE" | "fr" | "ca_ES" | "es" | "it" | "pl" | "tr" | "ru" | "br" | "id" | "ms_MY" | "th_TH" | "vi_VN" | "ja" | "ko" | "zh_CN" | "zh_TW" | "ar_AE" | "he_IL"; /** * Supported countries for economic calendar filtering. * * The economic calendar can be filtered to show events from specific countries. * This includes major economies from all continents with comprehensive coverage * of North America, Europe, Asia-Pacific, Middle East, Africa, and Latin America. * * @example * ```tsx * // Show events from major economies * <EconomicCalendar countries={["United States", "Germany", "Japan"]} /> * * // Focus on European Union events * <EconomicCalendar countries={["European Union", "Germany", "France", "Italy"]} /> * * // Emerging markets focus * <EconomicCalendar countries={["China", "India", "Brazil", "South Africa"]} /> * ``` */ type Country = "United States" | "Canada" | "Austria" | "Belgium" | "Cyprus" | "Czech Republic" | "Denmark" | "Estonia" | "European Union" | "Finland" | "France" | "Germany" | "Greece" | "Hungary" | "Iceland" | "Ireland" | "Italy" | "Latvia" | "Lithuania" | "Luxembourg" | "Netherlands" | "Norway" | "Poland" | "Portugal" | "Romania" | "Russia" | "Serbia" | "Slovakia" | "Spain" | "Sweden" | "Switzerland" | "Ukraine" | "United Kingdom" | "Angola" | "Bahrain" | "Botswana" | "Egypt" | "Ethiopia" | "Ghana" | "Israel" | "Kenya" | "Kuwait" | "Malawi" | "Mauritius" | "Morocco" | "Mozambique" | "Namibia" | "Nigeria" | "Oman" | "Qatar" | "Rwanda" | "Saudi Arabia" | "Seychelles" | "South Africa" | "Tanzania" | "Tunisia" | "Turkey" | "Uganda" | "United Arab Emirates" | "Zambia" | "Zimbabwe" | "Argentina" | "Brazil" | "Chile" | "Colombia" | "Mexico" | "Peru" | "Venezuela" | "Australia" | "Bangladesh" | "China" | "Hong Kong" | "India" | "Indonesia" | "Japan" | "South Korea" | "Sri Lanka" | "Malaysia" | "New Zealand" | "Pakistan" | "Philippines" | "Singapore" | "Taiwan" | "Thailand" | "Vietnam"; /** * Props for the EconomicCalendar component. */ type EconomicCalendarProps = { /** * Widget width in pixels. Ignored if `autosize` is true. * @default "full" */ readonly width?: Size; /** * Widget height in pixels. Ignored if `autosize` is true. * @default "full" */ readonly height?: Size; /** * Locale for widget interface and date/time formatting. * @default "en" */ readonly locale?: Locale; /** * Color theme for the widget interface. * @default "light" */ readonly colorTheme?: ColorTheme; /** * Array of countries to filter economic events by. * When empty, shows events from all countries. * Duplicates are automatically removed. * * @default [] * @example * ```tsx * // Major economies * countries={["United States", "Germany", "Japan", "China"]} * * // European focus * countries={["European Union", "United Kingdom", "Switzerland"]} * * // Emerging markets * countries={["Brazil", "India", "South Africa", "Turkey"]} * ``` */ readonly countries?: Country[]; /** * Whether the widget should automatically resize to fit its container. * When true, `width` and `height` props are ignored. * @default true */ readonly autosize?: boolean; /** * Whether to show only high-importance economic events. * When true, filters out low and medium importance events. * When false, shows all importance levels. * * @default false * @example * ```tsx * // Show only critical events like Fed meetings, GDP releases * <EconomicCalendar showHighImportanceOnly /> * * // Show all events including minor data releases * <EconomicCalendar showHighImportanceOnly={false} /> * ``` */ readonly showHighImportanceOnly?: boolean; /** * Whether to use a transparent background. * @default false */ readonly isTransparent?: boolean; /** * Callback function called when an error occurs during widget initialization. * @param error The error that occurred */ readonly onError?: (error: Error) => void; }; /** * TradingView Economic Calendar widget for displaying upcoming economic events. * * Keep an eye on key upcoming economic events, announcements, and news. The widget * provides comprehensive economic event tracking with filtering capabilities for * event importance and affected countries. Perfect for traders and investors who * need to stay informed about market-moving economic releases. * * @see https://www.tradingview.com/widget-docs/widgets/calendars/economic-calendar/ * * @example * Basic usage - all events from all countries: * ```tsx * <EconomicCalendar /> * ``` * * @example * Major economies with high importance filter: * ```tsx * <EconomicCalendar * countries={["United States", "European Union", "Japan", "United Kingdom"]} * showHighImportanceOnly * colorTheme="dark" * /> * ``` * * @example * Custom sizing and regional focus: * ```tsx * <EconomicCalendar * countries={["Germany", "France", "Italy", "Spain"]} * width={800} * height={600} * autosize={false} * showHighImportanceOnly={false} * isTransparent * /> * ``` * * @example * Emerging markets tracking: * ```tsx * <EconomicCalendar * countries={["China", "India", "Brazil", "South Africa", "Turkey", "Mexico"]} * locale="en" * colorTheme="light" * /> * ``` */ declare const EconomicCalendar: (props: EconomicCalendarProps) => JSX.Element; /** * Chart time intervals supported by TradingView AdvancedChart. * * @example * ```tsx * <AdvancedChart interval="D" /> // Daily chart * <AdvancedChart interval="60" /> // 1-hour chart * ``` */ type AdvancedChartInterval = "1" | "3" | "5" | "15" | "30" | "60" | "120" | "180" | "240" | "D" | "W"; /** * Timezone identifiers for chart data display. * Controls what timezone is used for displaying candle open/close times. * * @example * ```tsx * <AdvancedChart timezone="America/New_York" /> // Eastern Time * <AdvancedChart timezone="exchange" /> // Use exchange timezone * ``` */ type TimeZone = "exchange" | "Etc/UTC" | "Pacific/Honolulu" | "America/Anchorage" | "America/Juneau" | "America/Los_Angeles" | "America/Phoenix" | "America/Vancouver" | "US/Mountain" | "America/Mexico_City" | "America/El_Salvador" | "America/Bogota" | "America/Chicago" | "America/Lima" | "America/Caracas" | "America/New_York" | "America/Santiago" | "America/Toronto" | "America/Argentina/Buenos_Aires" | "America/Sao_Paulo" | "Atlantic/Azores" | "Atlantic/Reykjavik" | "Africa/Casablanca" | "Europe/Dublin" | "Africa/Lagos" | "Europe/Lisbon" | "Europe/London" | "Africa/Tunis" | "Europe/Amsterdam" | "Europe/Belgrade" | "Europe/Berlin" | "Europe/Bratislava" | "Europe/Brussels" | "Europe/Budapest" | "Europe/Copenhagen" | "Africa/Johannesburg" | "Europe/Luxembourg" | "Europe/Madrid" | "Europe/Malta" | "Europe/Oslo" | "Europe/Paris" | "Europe/Prague" | "Europe/Rome" | "Europe/Stockholm" | "Europe/Vienna" | "Europe/Warsaw" | "Europe/Zurich" | "Europe/Athens" | "Asia/Bahrain" | "Europe/Bucharest" | "Africa/Cairo" | "Europe/Helsinki" | "Europe/Istanbul" | "Asia/Jerusalem" | "Asia/Kuwait" | "Europe/Moscow" | "Africa/Nairobi" | "Asia/Nicosia" | "Asia/Qatar" | "Europe/Riga" | "Asia/Riyadh" | "Europe/Tallinn" | "Europe/Vilnius" | "Asia/Tehran" | "Asia/Dubai" | "Asia/Muscat" | "Asia/Kabul" | "Asia/Ashkhabad" | "Asia/Almaty" | "Asia/Karachi" | "Asia/Colombo" | "Asia/Kolkata" | "Asia/Kathmandu" | "Asia/Dhaka" | "Asia/Yangon" | "Asia/Bangkok" | "Asia/Ho_Chi_Minh" | "Asia/Jakarta" | "Asia/Chongqing" | "Asia/Hong_Kong" | "Asia/Kuala_Lumpur" | "Asia/Manila" | "Australia/Perth" | "Asia/Shanghai" | "Asia/Singapore" | "Asia/Taipei" | "Asia/Seoul" | "Asia/Tokyo" | "Australia/Adelaide" | "Australia/Brisbane" | "Australia/Sydney" | "Pacific/Norfolk" | "Pacific/Auckland" | "Pacific/Chatham" | "Pacific/Fakaofo"; /** * Chart visualization styles available in TradingView. * * @example * ```tsx * <AdvancedChart chartStyle="candles" /> // Traditional candlestick chart * <AdvancedChart chartStyle="line" /> // Simple line chart * <AdvancedChart chartStyle="renko" /> // Renko brick chart * ``` */ type AdvancedChartStyle = "bars" | "candles" | "hollow_candles" | "area" | "line" | "line_break" | "renko" | "heikin_ashi" | "kagi" | "point_and_figure"; /** * Technical indicators and studies available for the chart. * These are mapped to TradingView's internal indicator IDs. * * @example * ```tsx * <AdvancedChart * indicators={["relativeStrengthIndex", "bollingerBands", "volume"]} * /> * ``` */ type AdvancedChartIndicator = "volume24h" | "accumulationDistribution" | "advanceDeclineLine" | "advanceDeclineRatio" | "advanceDeclineRatioBars" | "arnaudLegouxMovingAverage" | "aroon" | "averageDayRange" | "averageDirectionalIndex" | "averageTrueRange" | "awesomeOscillator" | "balanceOfPower" | "bbTrend" | "bollingerBands" | "bollingerBandsPercentB" | "bollingerBandwidth" | "bollingerBars" | "bullBearPower" | "chaikinMoneyFlow" | "chaikinOscillator" | "chandeKrollStop" | "chandeMomentumOscillator" | "chopZone" | "choppinessIndex" | "commodityChannelIndex" | "connorsRsi" | "coppockCurve" | "correlationCoefficientBasic" | "correlationCoefficient" | "cumulativeVolumeDelta" | "cumulativeVolumeIndex" | "detrendedPriceOscillator" | "directionalMovementIndex" | "donchianChannels" | "doubleEma" | "easeOfMovement" | "elderForceIndex" | "envelope" | "fisherTransform" | "gaps" | "historicalVolatility" | "hullMovingAverage" | "ichimokuCloud" | "keltnerChannels" | "klingerOscillator" | "knowSureThing" | "leastSquaresMovingAverage" | "linearRegressionChannel" | "maCross" | "massIndex" | "mcginleyDynamic" | "median" | "momentum" | "moneyFlowIndex" | "moonPhases" | "movingAverageConvergenceDivergence" | "movingAverageExponential" | "movingAverageRibbon" | "movingAverageSimple" | "movingAverageWeighted" | "multiTimePeriodCharts" | "netVolume" | "onBalanceVolume" | "openInterest" | "parabolicSar" | "performance" | "pivotPointsHighLow" | "pivotPointsStandard" | "priceOscillator" | "priceTarget" | "priceVolumeTrendBasic" | "priceVolumeTrend" | "rankCorrelationIndex" | "rateOfChange" | "rciRibbon" | "relativeStrengthIndex" | "relativeVigorIndex" | "relativeVolatilityIndex" | "relativeVolumeAtTime" | "robBookerIntradayPivotPoints" | "robBookerKnoxvilleDivergence" | "robBookerMissedPivotPoints" | "robBookerReversal" | "robBookerZivGhostPivots" | "rsiDivergenceIndicator" | "seasonality" | "smiErgodicIndicator" | "smiErgodicOscillator" | "smoothedMovingAverage" | "stochastic" | "stochasticMomentumIndex" | "stochasticRsi" | "supertrend" | "technicalRatings" | "timeWeightedAveragePrice" | "tradingSessions" | "trendStrengthIndex" | "tripleEma" | "trix" | "trueStrengthIndex" | "ultimateOscillator" | "upDownVolume" | "visibleAveragePrice" | "volatilityStop" | "volume" | "volumeDelta" | "volumeOscillator" | "volumeWeightedAveragePrice" | "volumeWeightedMovingAverage" | "vortexIndicator" | "williamsAlligator" | "williamsFractals" | "williamsPercentRange" | "woodiesCci" | "zigZag"; /** * Position for comparison symbols on the chart. * - `SameScale`: Symbol shares the same price scale as the main symbol * - `NewPriceScale`: Symbol gets its own price scale on the right * - `NewPane`: Symbol is displayed in a separate pane below the main chart */ type ComparisonPosition = "SameScale" | "NewPriceScale" | "NewPane"; /** * Configuration for additional symbols to compare against the main symbol. * * @example * ```tsx * <AdvancedChart * symbol="NASDAQ:AAPL" * compareSymbols={[ * { symbol: "NASDAQ:GOOGL", position: "SameScale" }, * { symbol: "NASDAQ:MSFT", position: "NewPriceScale" } * ]} * /> * ``` */ type ComparisonSymbol = { /** The symbol to compare (e.g., "NASDAQ:GOOGL") */ readonly symbol: string; /** How to display this symbol relative to the main chart */ readonly position: ComparisonPosition; }; /** * Props for the AdvancedChart component. */ type AdvancedChartProps = { /** * The financial symbol to display (e.g., "NASDAQ:AAPL", "BINANCE:BTCUSDT"). * This is the primary symbol that will be charted. * * @example "NASDAQ:AAPL", "FOREX:EURUSD", "BINANCE:BTCUSDT" */ readonly symbol: string; /** * Color theme for the chart interface. * @default "light" */ readonly colorTheme?: ColorTheme; /** * Chart width in pixels. Ignored if `autosize` is true. * @default 400 */ readonly width?: number; /** * Chart height in pixels. Ignored if `autosize` is true. * @default 300 */ readonly height?: number; /** * Locale for chart interface and number formatting. * @default "en" */ readonly locale?: Locale; /** * Custom background color for the chart area. * Supports any CSS color format: hex, rgb, rgba, hsl, oklch, etc. * * @example * ```tsx * backgroundColor="rgba(13, 13, 13, 1)" // Dark background * backgroundColor="hsl(210, 100%, 95%)" // Light blue * backgroundColor="#1a1a1a" // Hex dark * ``` */ readonly backgroundColor?: string; /** * Custom color for chart grid lines. * Supports any CSS color format: hex, rgb, rgba, hsl, oklch, etc. * * @example * ```tsx * gridColor="rgba(255, 0, 0, 0.2)" // Semi-transparent red * gridColor="hsl(240, 100%, 80%)" // Light blue * gridColor="#ffff0033" // Yellow with alpha * ``` */ readonly gridColor?: string; /** * Time interval for chart candles/bars. * Numbers represent minutes, "D" = daily, "W" = weekly. * @default "1" */ readonly interval?: AdvancedChartInterval; /** * Timezone for displaying chart data timestamps. * Use "exchange" to show data in the exchange's timezone. * @default "Etc/UTC" */ readonly timezone?: TimeZone; /** * Chart visualization style (candles, bars, line, etc.). * @default "candles" */ readonly chartStyle?: AdvancedChartStyle; /** * Array of technical indicators to display on the chart. * Indicators will be automatically added when the chart loads. * * @example * ```tsx * indicators={["relativeStrengthIndex", "movingAverageSimple", "volume"]} * ``` */ readonly indicators?: AdvancedChartIndicator[]; /** * Array of symbols for the watchlist sidebar. * * @example * ```tsx * watchlist={["NASDAQ:AAPL", "NASDAQ:GOOGL", "NASDAQ:MSFT"]} * ``` */ readonly watchlist?: string[]; /** * Additional symbols to compare against the main symbol. * These will be overlaid on the chart for comparison. */ readonly compareSymbols?: ComparisonSymbol[]; /** * Whether the chart should automatically resize to fit its container. * When true, `width` and `height` props are ignored. * @default true */ readonly autosize?: boolean; /** * Whether users can change the symbol from within the chart interface. * @default true */ readonly allowSymbolChange?: boolean; /** * Whether to show the bottom toolbar with date range buttons. * @default false */ readonly showBottomToolbar?: boolean; /** * Whether to show detailed information panel. * @default false */ readonly showDetails?: boolean; /** * Whether to show the left sidebar with drawing tools. * @default true */ readonly showDrawingToolsBar?: boolean; /** * Whether to show the hotlist sidebar on the right. * @default false */ readonly showHotlist?: boolean; /** * Whether to show the save image button in the top toolbar. * @default false */ readonly showSaveImageButton?: boolean; /** * Whether to show symbol description/legend information. * @default true */ readonly showSymbolDescription?: boolean; /** * Whether to show the top toolbar with chart controls. * @default true */ readonly showTopToolbar?: boolean; /** * Whether to show volume bars at the bottom of the chart. * @default true */ readonly showVolume?: boolean; /** * Callback function called when an error occurs during chart initialization. * @param error The error that occurred */ readonly onError?: (error: Error) => void; }; /** * Advanced TradingView chart widget with full trading capabilities. * * This is the most feature-rich chart component, providing the complete TradingView * charting experience with technical analysis tools, indicators, drawing tools, * and extensive customization options. * * @see https://www.tradingview.com/widget-docs/widgets/charts/advanced-chart/ * * @example * Basic usage: * ```tsx * <AdvancedChart symbol="NASDAQ:AAPL" /> * ``` * * @example * With custom styling and indicators: * ```tsx * <AdvancedChart * symbol="NASDAQ:AAPL" * interval="D" * chartStyle="candles" * colorTheme="dark" * backgroundColor="rgba(13, 13, 13, 1)" * gridColor="rgba(255, 255, 255, 0.1)" * indicators={["relativeStrengthIndex", "bollingerBands"]} * showDrawingToolsBar * showVolume * /> * ``` * * @example * Comparison chart: * ```tsx * <AdvancedChart * symbol="NASDAQ:AAPL" * compareSymbols={[ * { symbol: "NASDAQ:GOOGL", position: "SameScale" }, * { symbol: "NASDAQ:MSFT", position: "NewPriceScale" } * ]} * /> * ``` */ declare const AdvancedChart: (props: AdvancedChartProps) => JSX.Element; /** * Date range options for the MiniChart widget. * Controls the time period displayed in the chart. * * - `1D`: 1 Day - Intraday view with hourly candles * - `1M`: 1 Month - Daily candles for the past month * - `3M`: 3 Months - Daily candles for the past quarter * - `1Y`: 1 Year - Daily/weekly candles for the past year * - `5Y`: 5 Years - Weekly/monthly candles for 5 years * - `ALL`: All Time - Full historical data available * * @example * ```tsx * <MiniChart symbol="NASDAQ:AAPL" dateRange="1D" /> // Intraday view * <MiniChart symbol="NASDAQ:AAPL" dateRange="1Y" /> // Year overview * <MiniChart symbol="NASDAQ:AAPL" dateRange="ALL" /> // Full history * ``` */ type MiniChartDateRange = "1D" | "1M" | "3M" | "1Y" | "5Y" | "ALL"; /** * Props for the MiniChart component. */ type MiniChartProps = { /** * The financial symbol to display (e.g., "NASDAQ:AAPL", "BINANCE:BTCUSDT"). * This is the primary symbol that will be charted. * * @example "NASDAQ:AAPL", "FOREX:EURUSD", "BINANCE:BTCUSDT", "NYSE:TSLA" */ readonly symbol: string; /** * Chart width in pixels. Ignored if `autosize` is true. * @default "full" */ readonly width?: Size; /** * Chart height in pixels. Ignored if `autosize` is true. * @default "full" */ readonly height?: Size; /** * Locale for chart interface and number formatting. * @default "en" */ readonly locale?: Locale; /** * Time period to display in the chart. * @default "1M" */ readonly dateRange?: MiniChartDateRange; /** * Color theme for the chart interface. * @default "light" */ readonly colorTheme?: ColorTheme; /** * Custom color for the main trend line. * Supports any CSS color format: hex, rgb, rgba, hsl, etc. * * @example * ```tsx * trendLineColor="#2962FF" // Blue trend line * trendLineColor="rgb(255, 107, 53)" // Orange trend line * trendLineColor="hsl(210, 100%, 50%)" // HSL blue * ``` */ readonly trendLineColor?: string; /** * Custom color for the area fill under the trend line (top gradient). * Supports any CSS color format: hex, rgb, rgba, hsl, etc. * * @example * ```tsx * underLineColor="rgba(41, 98, 255, 0.3)" // Semi-transparent blue * underLineColor="#FF6B3530" // Hex with alpha * ``` */ readonly underLineColor?: string; /** * Custom color for the area fill under the trend line (bottom gradient). * Creates a gradient effect when combined with underLineColor. * Supports any CSS color format: hex, rgb, rgba, hsl, etc. * * @example * ```tsx * underLineColor="rgba(41, 98, 255, 0.3)" * underLineBottomColor="rgba(41, 98, 255, 0.1)" // Lighter bottom * ``` */ readonly underLineBottomColor?: string; /** * Whether the chart should automatically resize to fit its container. * When true, `width` and `height` props are ignored. * @default true */ readonly autosize?: boolean; /** * Whether to use a transparent background. * @default false */ readonly isTransparent?: boolean; /** * Whether to show only the chart without additional details. * When true, hides symbol info, price details, and other UI elements. * @default false */ readonly chartOnly?: boolean; /** * Whether to hide the time scale at the bottom of the chart. * @default false */ readonly noTimeScale?: boolean; /** * Callback function called when an error occurs during chart initialization. * @param error The error that occurred */ readonly onError?: (error: Error) => void; }; /** * TradingView MiniChart widget for compact price visualization. * * A lightweight, compact chart widget perfect for displaying price trends and basic * market data in smaller spaces like dashboards, sidebars, or overview panels. * The MiniChart provides essential price information with customizable styling * while maintaining a minimal footprint. * * @see https://www.tradingview.com/widget-docs/widgets/charts/mini-chart/ * * @example * Basic usage: * ```tsx * <MiniChart symbol="NASDAQ:AAPL" /> * ``` * * @example * Custom styling with colors: * ```tsx * <MiniChart * symbol="NASDAQ:AAPL" * dateRange="1Y" * colorTheme="dark" * trendLineColor="#FF6B35" * underLineColor="rgba(255, 107, 53, 0.3)" * underLineBottomColor="rgba(255, 107, 53, 0.1)" * /> * ``` * * @example * Minimalist chart-only view: * ```tsx * <MiniChart * symbol="BINANCE:BTCUSDT" * dateRange="1D" * chartOnly * noTimeScale * isTransparent * width={300} * height={150} * autosize={false} * /> * ``` * * @example * Dashboard widget with custom dimensions: * ```tsx * <MiniChart * symbol="FOREX:EURUSD" * dateRange="3M" * width={400} * height={200} * autosize={false} * trendLineColor="#00C851" * colorTheme="light" * /> * ``` */ declare const MiniChart: (props: MiniChartProps) => JSX.Element; /** * Scale modes for price axis display in the SymbolOverview widget. * * - `normal`: Linear price scale (standard arithmetic progression) * - `percentage`: Percentage-based scale showing relative changes * - `logarithmic`: Logarithmic scale for better visualization of exponential growth * * @example * ```tsx * <SymbolOverview scaleMode="percentage" /> // Show percentage changes * <SymbolOverview scaleMode="logarithmic" /> // Better for volatile assets * ``` */ type ScaleMode = "normal" | "percentage" | "logarithmic"; /** * Position of the price scale axis in the chart. * * - `left`: Price scale on the left side of the chart * - `right`: Price scale on the right side of the chart (default) * - `no`: Hide the price scale completely * * @example * ```tsx * <SymbolOverview scalePosition="left" /> // Left-aligned price scale * <SymbolOverview scalePosition="no" /> // Clean chart without price scale * ``` */ type ScalePosition = "left" | "right" | "no"; /** * Chart visualization types for the SymbolOverview widget. * * - `area`: Filled area chart with gradient (default for most use cases) * - `line`: Simple line chart showing price movement * - `bar`: OHLC bar chart showing open, high, low, close prices * - `candlestick`: Japanese candlestick chart with body and wicks * * @example * ```tsx * <SymbolOverview chartType="candlestick" /> // Full OHLC data visualization * <SymbolOverview chartType="line" /> // Simple price line * ``` */ type ChartType = "area" | "line" | "bar" | "candlestick"; /** * Value tracking display modes for price information. * * - `floating_tooltip`: Floating tooltip that follows cursor movement * - `colored_tooltip`: Colored tooltip with enhanced visibility * - `legend`: Fixed legend display showing current values * - `scale_labels`: Values displayed on the price scale axis * * @example * ```tsx * <SymbolOverview valueTrackingMode="legend" /> // Fixed legend display * <SymbolOverview valueTrackingMode="floating_tooltip" /> // Interactive tooltip * ``` */ type ValueTrackingMode = "floating_tooltip" | "colored_tooltip" | "legend" | "scale_labels"; /** * Line drawing styles for line and area charts. * * - `simple`: Straight lines connecting data points (default) * - `curved`: Smooth curved lines with bezier interpolation * - `stepLine`: Step-like lines creating a staircase pattern * * @example * ```tsx * <SymbolOverview lineType="curved" /> // Smooth curved lines * <SymbolOverview lineType="stepLine" /> // Step-like visualization * ``` */ type LineType = "simple" | "curved" | "stepLine"; /** * Header font size options for the widget title and symbol information. * * - `small`: Compact header with minimal space usage * - `medium`: Standard header size (default) * - `large`: Prominent header for emphasis * * @example * ```tsx * <SymbolOverview headerFontSize="large" /> // Prominent header * <SymbolOverview headerFontSize="small" /> // Compact design * ``` */ type HeaderFontSize = "small" | "medium" | "large"; /** * Price change display modes in the widget header. * * - `price-and-percent`: Show both absolute price change and percentage (default) * - `price-only`: Show only absolute price change value * - `percent-only`: Show only percentage change * - `no-values`: Hide change values completely * * @example * ```tsx * <SymbolOverview changeMode="percent-only" /> // Only show percentage * <SymbolOverview changeMode="no-values" /> // Clean display without changes * ``` */ type ChangeMode = "price-and-percent" | "price-only" | "percent-only" | "no-values"; /** * Time format for timestamp display in the widget. * * - `12h`: 12-hour format with AM/PM (e.g., "2:30 PM") * - `24h`: 24-hour format (e.g., "14:30") * * @example * ```tsx * <SymbolOverview timeFormat="24h" /> // European time format * <SymbolOverview timeFormat="12h" /> // American time format * ``` */ type TimeFormat = "12h" | "24h"; /** * Configuration for symbol comparison in the chart. * Allows overlaying multiple symbols for relative performance analysis. */ type CompareSymbol = { /** The symbol to compare (e.g., "NASDAQ:GOOGL") */ readonly symbol: string; /** Custom color for the comparison line */ readonly lineColor?: string; /** Line width for the comparison symbol (default: 1) */ readonly lineWidth?: number; /** Whether to show labels for the comparison symbol */ readonly showLabels?: boolean; }; /** * Props for the SymbolOverview component. */ type SymbolOverviewProps = { /** * Array of financial symbols to display in the overview. * Each symbol should include the exchange prefix for accurate data retrieval. * * **Supported formats:** * - `EXCHANGE:SYMBOL` format (e.g., ["NASDAQ:AAPL", "NYSE:TSLA"]) * - Multiple asset classes: stocks, forex, crypto, commodities, indices * * @example * ```tsx * // Single symbol * <SymbolOverview symbols={["NASDAQ:AAPL"]} /> * * // Multiple symbols comparison * <SymbolOverview symbols={["NASDAQ:AAPL", "NASDAQ:GOOGL", "NASDAQ:MSFT"]} /> * * // Mixed asset classes * <SymbolOverview symbols={["NASDAQ:AAPL", "BINANCE:BTCUSDT", "FX:EURUSD"]} /> * ``` */ readonly symbols: string[]; /** Widget width in pixels, or "full" for container width */ readonly width?: Size; /** Widget height in pixels, or "full" for container height */ readonly height?: Size; /** Display language and regional formatting */ readonly locale?: Locale; /** Price scale display mode for better data visualization */ readonly scaleMode?: ScaleMode; /** Position of the price scale axis */ readonly scalePosition?: ScalePosition; /** Widget color theme (light/dark) */ readonly colorTheme?: ColorTheme; /** Chart visualization type (area, line, bar, candlestick) */ readonly chartType?: ChartType; /** Value tracking and tooltip display mode */ readonly valueTrackingMode?: ValueTrackingMode; /** Additional symbol for comparison overlay */ readonly compareSymbol?: CompareSymbol; /** Line drawing style for line/area charts */ readonly lineType?: LineType; /** Header text size for symbol information */ readonly headerFontSize?: HeaderFontSize; /** Price change display format in header */ readonly changeMode?: ChangeMode; /** Time format for timestamps */ readonly timeFormat?: TimeFormat; /** Line width for chart lines (default: 1) */ readonly lineWidth?: number; /** Base font size for widget text */ readonly fontSize?: number; /** Text color for widget content */ readonly fontColor?: string; /** Main trend line color */ readonly trendLineColor?: string; /** Area chart upper gradient color */ readonly underLineColor?: string; /** Area chart lower gradient color */ readonly underLineBottomColor?: string; /** Auto-resize to container dimensions */ readonly autosize?: boolean; /** Transparent widget background */ readonly isTransparent?: boolean; /** Show/hide time scale axis */ readonly showTimeScale?: boolean; /** Show/hide widget header with symbol info */ readonly showHeader?: boolean; /** Line color for line charts only (maps to trendLineColor internally) */ readonly color?: string; /** Line color for area chart border (area charts only) */ readonly lineColor?: string; /** Top gradient color for area charts only */ readonly topColor?: string; /** Bottom gradient color for area charts only */ readonly bottomColor?: string; /** Bullish bar/candle color (bar and candlestick charts only) */ readonly upColor?: string; /** Bearish bar/candle color (bar and candlestick charts only) */ readonly downColor?: string; /** Bullish border color for bars/candles (bar and candlestick charts only) */ readonly borderUpColor?: string; /** Bearish border color for bars/candles (bar and candlestick charts only) */ readonly borderDownColor?: string; /** Bullish wick color (candlestick charts only) */ readonly wickUpColor?: string; /** Bearish wick color (candlestick charts only) */ readonly wickDownColor?: string; /** Chart grid line color */ readonly gridLineColor?: string; /** Widget text color override */ readonly widgetFontColor?: string; /** Widget background color */ readonly backgroundColor?: string; /** Show/hide volume bars below main chart */ readonly showVolume?: boolean; /** Volume bar color for up periods */ readonly volumeUpColor?: string; /** Volume bar color for down periods */ readonly volumeDownColor?: string; /** Show/hide date range selector buttons */ readonly showDateRanges?: boolean; /** Show/hide symbol logo in header */ readonly showSymbolLogo?: boolean; /** Show/hide market status indicator */ readonly showMarketStatus?: boolean; /** Show/hide moving average line */ readonly showMA?: boolean; /** Moving average line color */ readonly maLineColor?: string; /** Moving average line width */ readonly maLineWidth?: number; /** Moving average period (e.g., 20, 50, 200) */ readonly maLength?: number; /** Error handler for widget loading failures */ readonly onError?: (error: Error) => void; }; /** * TradingView SymbolOverview widget for displaying financial instrument data with mini charts. * * This versatile widget combines symbol information (price, change, volume) with a compact * chart visualization, making it perfect for dashboards, watchlists, and portfolio overviews. * It supports multiple symbols, various chart types, and extensive customization options * for professional financial applications. * * **Key Features:** * - Multi-symbol support with comparison capabilities * - 4 chart types: area, line, bar, candlestick * - Comprehensive color customization for all chart elements * - Volume display with customizable colors * - Moving average overlay with configurable periods * - Responsive design with auto-sizing capabilities * - Real-time data updates from TradingView * - Professional styling options and themes * * **Chart Types:** * - **Area**: Filled gradient charts ideal for trend visualization * - **Line**: Clean line charts for simple price tracking * - **Bar**: OHLC bars showing full price action * - **Candlestick**: Japanese candlesticks with body and wick colors * * **Color Format Support:** * All color props support multiple CSS formats: * - Hex: `#1a1a1a`, `#ff6b3580` (with alpha) * - RGB/RGBA: `rgb(255, 107, 53)`, `rgba(41, 98, 255, 0.3)` * - HSL: `hsl(210, 100%, 50%)` * - OKLCH: `oklch(0.7 0.15 180)` * * **Chart-Specific Color Properties:** * Different color properties apply to different chart types: * * - **Line Charts**: Use `color` for the main line color. * - **Area Charts**: Use `lineColor` (border), `topColor` (top gradient), `bottomColor` (bottom gradient) * - **Bar Charts**: Use `upColor`/`downColor` (bar fill), `borderUpColor`/`borderDownColor` (bar borders) * - **Candlestick Charts**: Use `upColor`/`downColor` (candle body), `borderUpColor`/`borderDownColor` (body borders), `wickUpColor`/`wickDownColor` (wick colors) * - **All Charts**: `gridLineColor`, `widgetFontColor`, `backgroundColor` apply universally * * @see https://www.tradingview.com/widget-docs/widgets/charts/symbol-overview/ * * @example * ```tsx * // Basic symbol overview * <SymbolOverview * symbols={["NASDAQ:AAPL"]} * colorTheme="light" * width={400} * height={300} * /> * ``` * * @example * ```tsx * // Multi-symbol comparison with custom styling * <SymbolOverview * symbols={["NASDAQ:AAPL", "NASDAQ:GOOGL", "NASDAQ:MSFT"]} * chartType="candlestick" * colorTheme="dark" * upColor="#00C853" * downColor="#FF1744" * showVolume={true} * showMA={true} * maLength={20} * maLineColor="#2196F3" * /> * ``` * * @example * ```tsx * // Responsive dashboard widget * <SymbolOverview * symbols={["BINANCE:BTCUSDT"]} * autosize={true} * isTransparent={true} * showHeader={true} * showSymbolLogo={true} * valueTrackingMode="legend" * backgroundColor="rgba(255, 255, 255, 0.1)" * /> * ``` */ declare const SymbolOverview: (props: SymbolOverviewProps) => JSX.Element; /** * Feed modes for the TopStories widget. * - `all_symbols`: Shows news from all markets and symbols * - `market`: Shows news for a specific market sector * - `symbol`: Shows news for a specific symbol (requires symbol prop) * * @example * ```tsx * <TopStories feedMode="all_symbols" /> // All market news * <TopStories feedMode="symbol" symbol="NASDAQ:AAPL" /> // Apple-specific news * ``` */ type TopStoriesFeedMode = "all_symbols" | "market" | "symbol"; /** * Display modes for the TopStories widget layout. * - `adaptive`: Automatically adjusts layout based on container size * - `regular`: Standard layout with full article previews * - `compact`: Condensed layout with minimal article previews * * @example * ```tsx * <TopStories displayMode="compact" /> // Minimal space usage * <TopStories displayMode="regular" /> // Full article previews * ``` */ type TopStoriesDisplayMode = "adaptive" | "regular" | "compact"; /** * Base props shared by all TopStories feed modes. */ type BaseTopStoriesProps = { /** * Widget width in pixels. Ignored if `autosize` is true. * @default "full" */ readonly width?: Size; /** * Widget height in pixels. Ignored if `autosize` is true. * @default "full" */ readonly height?: Size; /** * Color theme for the widget interface. * @default "light" */ readonly colorTheme?: ColorTheme; /** * Locale for widget interface and content language. * @default "en" */ readonly locale?: Locale; /** * Layout mode for displaying news articles. * @default "adaptive" */ readonly displayMode?: TopStoriesDisplayMode; /** * Whether the widget should automatically resize to fit its container. * When true, `width` and `height` props are ignored. * @default true */ readonly autosize?: boolean; /** * Whether to use a transparent background. * @default false */ readonly isTransparent?: boolean; /** * Callback function called when an error occurs during widget initialization. * @param error The error that occurred */ readonly onError?: (error: Error) => void; }; /** * Props when feedMode is "symbol" - symbol prop is required. * Use this configuration to show news specifically related to a particular symbol. * * @example * ```tsx * <TopStories feedMode="symbol" symbol="NASDAQ:AAPL" /> * <TopStories feedMode="symbol" symbol="BINANCE:BTCUSDT" /> * ``` */ type SymbolModeProps = BaseTopStoriesProps & { /** Feed mode set to symbol-specific news */ readonly feedMode: Exclude<TopStoriesFeedMode, "all_symbols" | "market">; /** * The financial symbol to show news for (e.g., "NASDAQ:AAPL", "BINANCE:BTCUSDT"). * Required when feedMode is "symbol". */ readonly symbol: string; }; /** * Props when feedMode is "all_symbols" or "market" - symbol prop is not needed. * Use this configuration for general market news or sector-specific news. * * @example * ```tsx * <TopStories feedMode="all_symbols" /> // All market news * <TopStories feedMode="market" /> // Market sector news * ``` */ type NonSymbolModeProps = BaseTopStoriesProps & { /** Feed mode for general or market news */ readonly feedMode: Exclude<TopStoriesFeedMode, "symbol">; /** Symbol prop is not allowed for non-symbol feed modes */ readonly symbol?: never; }; /** * Union type for all possible TopStories prop combinations. * Ensures type safety for conditional symbol prop requirement. */ type TopStoriesProps = SymbolModeProps | NonSymbolModeProps; /** * TradingView TopStories widget for displaying financial news. * * Help your audience keep track of what's happening in the crypto and stock markets * with daily news briefs designed to be read in 20 seconds or less. The widget * provides curated financial news with multiple display modes and feed configurations. * * @see https://www.tradingview.com/widget-docs/widgets/news/top-stories/ * * @example * Basic usage - all market news: * ```tsx * <TopStories /> * ``` * * @example * Symbol-specific news: * ```tsx * <TopStories * feedMode="symbol" * symbol="NASDAQ:AAPL" * displayMode="compact" * colorTheme="dark" * /> * ``` * * @example * Custom styling and layout: * ```tsx * <TopStories * feedMode="all_symbols" * displayMode="regular" * width={600} * height={400} * colorTheme="light" * isTransparent={false} * autosize={false} * /> * ``` */ declare const TopStories: (props: TopStoriesProps) => JSX.Element; /** * Currency display options for the CryptoMarket widget. * * Controls how cryptocurrency prices and market data are denominated and displayed: * - `USD`: Display all prices in US Dollars (most common for institutional and retail analysis) * - `BTC`: Display all prices in Bitcoin terms (useful for Bitcoin-denominated trading and analysis) * * When using BTC denomination, prices show how much Bitcoin each cryptocurrency costs, * which is particularly useful for traders who think in Bitcoin terms or want to see * relative performance against Bitcoin as the base currency. * * @example * ```tsx * <CryptoMarket displayCurrency="USD" /> // Prices in USD * <CryptoMarket displayCurrency="BTC" /> // Prices in BTC terms * ``` */ type CryptoMarketDisplayCurrency = "USD" | "BTC"; /** * Props for the CryptoMarket component. */ type CryptoMarketProps = { /** * Widget width in pixels. Ignored if `autosize` is true. * @default "full" */ readonly width?: Size; /** * Widget height in pixels. Ignored if `autosize` is true. * @default "full" */ readonly height?: Size; /** * Color theme for the widget interface. * @default "light" */ readonly colorTheme?: ColorTheme; /** * Locale for widget interface and content language. * @default "en" */ readonly locale?: Locale; /** * The currency to display in the widget. * @default "USD" */ readonly displayCurrency?: CryptoMarketDisplayCurrency; /** * Whether the widget should automatically resize to fit its container. * When true, `width` and `height` props are ignored. * @default true */ readonly autosize?: boolean; /** * Whether to use a transparent background. * @default false */ readonly isTransparent?: boolean; /** * Callback function called when an error occurs during widget initialization. * @param error The error that occurred */ readonly onError?: (error: Error) => void; }; /** * TradingView CryptoMarket widget for cryptocurrency market overview and analysis. * * This specialized widget provides a comprehensive view of the cryptocurrency market, * displaying real-time data for thousands of digital assets including Bitcoin, Ethereum, * and altcoins. The widget offers sortable columns, filtering capabilities, and multiple * currency denominations to help traders and investors analyze the crypto market landscape. * * **Key Features:** * - Comprehensive cryptocurrency coverage (Bitcoin, Ethereum, altcoins, DeFi tokens) * - Real-time price data and market statistics * - Multiple currency denomination options (USD, BTC) * - Sortable columns (price, market cap, volume, 24h change, etc.) * - Interactive filtering and search capabilities * - Market cap and volume analysis * - Price performance indicators * - Clean, responsive interface * * **Data Columns Include:** * - **Symbol & Name:** Cryptocurrency ticker and full name * - **Price:** Current market price in selected currency * - **Market Cap:** Total market capitalization * - **Volume:** 24-hour trading volume * - **Change:** Price change over 24 hours (percentage and absolute) * - **Circulating Supply:** Number of tokens in circulation * - **Price Charts:** Mini sparkline price charts * * **Currency Options:** * - **USD Mode:** Standard fiat currency view for traditional analysis * - **BTC Mode:** Bitcoin-denominated prices for crypto-native perspective * * @see https://www.tradingview.com/widget-docs/widgets/screeners/crypto-mkt-screener/ * * @example * Basic cryptocurrency market overview: * ```tsx * <CryptoMarket /> * ``` * * @example * Bitcoin-denominated crypto market with custom styling: * ```tsx * <CryptoMarket * displayCurrency="BTC" * colorTheme="dark" * width={800} * height={600} * autosize={false} * /> * ``` * * @example * Transparent crypto market widget for embedding: * ```tsx * <CryptoMarket * displayCurrency="USD" * colorTheme="light" * isTransparent * locale="en" * /> * ``` * * @example * Custom-sized crypto market with specific dimensions: * ```tsx * <CryptoMarket * displayCurrency="USD" * width={1000} * height={700} * locale="es" * colorTheme="dark" * autosize={false} * isTransparent={false} * /> * ``` */ declare const CryptoMarket: (props: CryptoMarketProps) => JSX.Element; /** * Exchange regions and markets supported by the TradingView Screener widget. * * The screener supports stock exchanges from major financial markets worldwide, * as well as forex and cryptocurrency markets. Each exchange has its own set of * available column views and screening criteria. * * **Americas:** * - `america`: United States stock markets (NYSE, NASDAQ, etc.) * - `argentina`: Buenos Aires Stock Exchange (BYMA) * - `brazil`: B3 (Brasil Bolsa Balcão) * - `canada`: Toronto Stock Exchange (TSX) * - `chile`: Santiago Stock Exchange * - `colombia`: Colombia Stock Exchange * - `mexico`: Mexican Stock Exchange (BMV) * - `venezuela`: Caracas Stock Exchange * - `australia`: Australian Securities Exchange (ASX) * * **Europe:** * - `austria`: Vienna Stock Exchange * - `cyprus`: Cyprus Stock Exchange * - `czech`: Prague Stock Exchange * - `denmark`: NASDAQ Copenhagen * - `estonia`: NASDAQ Tallinn * - `finland`: NASDAQ Helsinki * - `germany`: Frankfurt Stock Exchange (XETRA) * - `greece`: Athens Exchange * - `hungary`: Budapest Stock Exchange * - `iceland`: NASDAQ Iceland * - `italy`: Borsa Italiana * - `latvia`: NASDAQ Riga * - `lithuania`: NASDAQ Vilnius * - `poland`: Warsaw Stock Exchange * - `russia`: Moscow Exchange * - `spain`: Madrid Stock Exchange (BME) * - `switzerland`: SIX Swiss Exchange * * **Asia & Middle East:** * - `china`: Shanghai and Shenzhen Stock Exchanges * - `india`: NSE and BSE (National and Bombay Stock Exchanges) * - `indonesia`: Indonesia Stock Exchange * - `israel`: Tel Aviv Stock Exchange * - `kuwait`: Kuwait Stock Exchange * - `srilanka`: Colombo Stock Exchange * - `taiwan`: Taiwan Stock Exchange * - `turkey`: Borsa Istanbul * - `uae`: Dubai Financial Market and Abu Dhabi Securities Exchange * - `vietnam`: Ho Chi Minh and Hanoi Stock Exchanges * * **Africa:** * - `egypt`: Egyptian Exchange * - `morocco`: Casablanca Stock Exchange * - `rsa`: Johannesburg Stock Exchange (South Africa) * * **Global Markets:** * - `forex`: Foreign exchange currency pairs * - `crypto`: Cryptocurrency markets * * @example * ```tsx * <Screener exchange="america" /> // US markets * <Screener exchange="germany" /> // German DAX and other German stocks * <Screener exchange="forex" /> // Currency pairs * <Screener exchange="crypto" /> // Cryptocurrencies * ``` */ type ScreenerExchange = "america" | "argentina" | "brazil" | "canada" | "chile" | "colombia" | "mexico" | "venezuela" | "australia" | "austria" | "cyprus" | "czech" | "denmark" | "estonia" | "finland" | "germany" | "greece" | "hungary" | "iceland" | "italy" | "latvia" | "lithuania" | "poland" | "russia" | "spain" | "switzerland" | "china" | "india" | "indonesia" | "israel" | "kuwait" | "srilanka" | "taiwan" | "turkey" | "uae" | "vietnam" | "egypt" | "morocco" | "rsa" | "forex" | "crypto"; /** * Available column views for stock screening. * Different markets support different column sets: * - Stock markets: Full feature set with all financial data * - Forex/Crypto: Limited set focusing on price and technical data * * **All Columns (Stock Markets):** * - `overview`: Basic symbol information and key metrics * - `performance`: Price performance over various time periods * - `valuation`: Valuation ratios (P/E, P/B, EV/EBITDA, etc.) * - `dividends`: Dividend yield, payout ratio, ex-dividend dates * - `margins`: Profit margins (gross, operating, net) * - `income_statement`: Revenue, earnings, and income metrics * - `balance_sheet`: Assets, liabilities, and equity data * - `oscillators`: Technical oscillator indicators (RSI, Stochastic, etc.) * - `moving_averages`: Moving average technical indicators * * **Sub Columns (Forex/Crypto Markets):** * - `overview`: Basic symbol information and key metrics * - `performance`: Price performance over various time periods * - `oscillators`: Technical oscillator indicators * - `moving_averages`: Moving average technical indicators */ declare const ALL_COLUMNS: readonly ["overview", "performance", "valuation", "dividends", "margins", "income_statement", "balance_sheet", "oscillators", "moving_averages"]; declare const SUB_COLUMNS: readonly ["overview", "performance", "oscillators", "moving_averages"]; type ScreenerColumns = typeof ALL_COLUMNS | typeof SUB_COLUMNS; declare const ScreenerColumnViews: Record<ScreenerExchange, ScreenerColumns>; /** * Available screening criteria for filtering stocks. * Different markets support different screening options: * - Stock markets: Full feature set with fundamental and technical screens * - Forex/Crypto: Limited set focusing on technical analysis * * **All Screens (Stock Markets):** * - `most_capitalized`: Largest companies by market cap * - `volume_leaders`: Highest trading volume * - `top_gainers`: Best price performance today * - `top_losers`: Worst price performance today * - `ath`: Stocks at all-time highs * - `atl`: Stocks at all-time lows * - `high_dividend`: Highest dividend yields * - `above_52wk_high`: Trading above 52-week high * - `below_52wk_low`: Trading below 52-week low * - `monthly_high`: At monthly price highs * - `monthly_low`: At monthly price lows * - `most_volatile`: Highest price volatility * - `unusual_volume`: Unusual trading volume activity * - `overbought`: Technically overbought stocks * - `oversold`: Technically oversold stocks * - `outperforming_SMA50`: Above 50-day moving average * - `underperforming