UNPKG

underlying-exchange-tokens-india

Version:

Exchange tokens mapping for underlying instruments across different Indian brokers

50 lines (49 loc) 1.85 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getExchangeToken = getExchangeToken; exports.getAvailableSymbols = getAvailableSymbols; exports.isSymbolSupported = isSymbolSupported; __exportStar(require("./types"), exports); __exportStar(require("./constants"), exports); const constants_1 = require("./constants"); /** * Get the exchange token for a given symbol and broker * @param symbol The underlying symbol (e.g., 'NIFTY') * @param broker The broker type (e.g., 'Zerodha') * @returns The exchange token or null if not found */ function getExchangeToken(symbol, broker) { if (!(symbol in constants_1.UNDERLYING_TOKEN_MAP)) { return null; } return constants_1.UNDERLYING_TOKEN_MAP[symbol][broker] || null; } /** * Get all available symbols * @returns Array of available symbols */ function getAvailableSymbols() { return Object.keys(constants_1.UNDERLYING_TOKEN_MAP); } /** * Check if a symbol is supported * @param symbol The symbol to check * @returns boolean indicating if the symbol is supported */ function isSymbolSupported(symbol) { return symbol in constants_1.UNDERLYING_TOKEN_MAP; }