tradingview-screener-ts
Version:
TypeScript port of TradingView Screener with 100% Python parity - Based on the original Python library by shner-elmo (https://github.com/shner-elmo/TradingView-Screener)
92 lines • 4.53 kB
TypeScript
/**
* Available markets and asset classes for TradingView Screener
*
* This file provides a list of supported TradingView market codes and human-friendly names.
* These can be used for country/region selection and with the setMarkets() method.
*
* Ported directly from Python version: markets_list.py
*/
/**
* List of supported TradingView market codes and human-friendly names.
* Exact port from Python MARKETS list - maintains same structure and order.
*
* Format: [display_name, market_code]
*/
export declare const MARKETS: readonly [readonly ["United States", "america"], readonly ["Canada", "canada"], readonly ["Brazil", "brazil"], readonly ["Mexico", "mexico"], readonly ["United Kingdom", "uk"], readonly ["Germany", "germany"], readonly ["France", "france"], readonly ["Italy", "italy"], readonly ["Spain", "spain"], readonly ["Netherlands", "netherlands"], readonly ["Switzerland", "switzerland"], readonly ["Sweden", "sweden"], readonly ["Norway", "norway"], readonly ["Finland", "finland"], readonly ["Denmark", "denmark"], readonly ["Belgium", "belgium"], readonly ["Austria", "austria"], readonly ["Poland", "poland"], readonly ["Portugal", "portugal"], readonly ["Greece", "greece"], readonly ["Hungary", "hungary"], readonly ["Czech Republic", "czech"], readonly ["Russia", "russia"], readonly ["Turkey", "turkey"], readonly ["Israel", "israel"], readonly ["Japan", "japan"], readonly ["China", "china"], readonly ["Hong Kong", "hongkong"], readonly ["India", "india"], readonly ["Singapore", "singapore"], readonly ["South Korea", "korea"], readonly ["Taiwan", "taiwan"], readonly ["Australia", "australia"], readonly ["New Zealand", "newzealand"], readonly ["South Africa", "southafrica"], readonly ["Egypt", "egypt"], readonly ["Nigeria", "nigeria"], readonly ["Crypto", "crypto"], readonly ["Forex", "forex"], readonly ["Coin", "coin"], readonly ["CFD", "cfd"], readonly ["Futures", "futures"], readonly ["Bonds", "bonds"], readonly ["Economy", "economy"], readonly ["Options", "options"]];
/**
* Type for the MARKETS tuple structure
*/
export type MarketTuple = readonly [string, string];
/**
* Type for market codes (extracted from MARKETS)
*/
export type Market = (typeof MARKETS)[number][1];
/**
* Markets with names - object mapping market codes to display names
* Derived from the MARKETS array for easy lookup
*/
export declare const MARKETS_WITH_NAMES: Record<string, string>;
/**
* List of just the market codes (for backward compatibility)
*/
export declare const MARKETS_LIST: readonly string[];
/**
* Asset classes extracted from MARKETS (items marked as asset classes in Python)
*/
export declare const ASSET_CLASSES: readonly string[];
/**
* Country markets extracted from MARKETS (excluding asset classes)
*/
export declare const COUNTRY_MARKETS: readonly string[];
/**
* Type definitions for market categories
*/
export type AssetClass = (typeof ASSET_CLASSES)[number];
export type CountryMarket = (typeof COUNTRY_MARKETS)[number];
/**
* Market information with descriptions - generated from MARKETS array
*/
export declare const MARKET_INFO: Record<string, {
name: string;
description: string;
type: 'asset_class' | 'country';
}>;
/**
* Helper function to validate if a market is supported
* @param market - Market code to validate
* @returns True if market is supported
*/
export declare function isValidMarket(market: string): market is Market;
/**
* Helper function to get market information
* @param market - Market code
* @returns Market information or undefined if not found
*/
export declare function getMarketInfo(market: string): {
name: string;
description: string;
type: "asset_class" | "country";
};
/**
* Helper function to get market display name from code
* @param marketCode - Market code
* @returns Display name or undefined if not found
*/
export declare function getMarketName(marketCode: string): string | undefined;
/**
* Helper function to get market code from display name
* @param displayName - Display name
* @returns Market code or undefined if not found
*/
export declare function getMarketCode(displayName: string): string | undefined;
/**
* Helper function to get markets by type
* @param type - Type of markets to get
* @returns Array of market codes of the specified type
*/
export declare function getMarketsByType(type: 'asset_class' | 'country'): string[];
/**
* Default export for convenience - the main MARKETS array
*/
export default MARKETS;
//# sourceMappingURL=markets.d.ts.map