@thoshpathi/utils-smartapi
Version:
Extended utilities for Angel One's smartapi-javascript SDK, including custom methods and helpers for market data like candles, P&L, and more.
47 lines (45 loc) • 1.53 kB
TypeScript
type Trend = "BUY" | "SELL";
type Transaction = "BUY" | "SELL";
type Exchange = "NSE" | "BSE" | "NFO" | "BFO" | "MCX" | "CDS";
type OrderStatus = "open" | "stoploss" | "target" | "closed" | "trailing" | "squareoff" | "manual_squareoff" | "exit";
type LTPData = {
exchange: Exchange;
tradingSymbol: string;
symbolToken: string;
ltp: number;
};
type CandleInterval = "ONE_MINUTE" | "THREE_MINUTE" | "FIVE_MINUTE" | "TEN_MINUTE" | "FIFTEEN_MINUTE" | "THIRTY_MINUTE" | "ONE_HOUR" | "ONE_DAY";
type SpreadType = "call_spread" | "put_spread";
type OptionLabel = "ATM" | `${number}-ITM` | `${number}-OTM`;
type OptionType = "CE" | "PE";
/**
* Map data of <symbol, 'BUY' | 'SELL'>
*/
type ScripTrendMap = Map<string, Trend>;
interface ScripIdentify {
name: string;
symbol: string;
symbolToken: string;
exchange: Exchange;
}
interface InstrumentDump extends ScripIdentify {
id: bigint | number;
lotSize: number;
createdAt: string;
[k: string]: unknown;
}
interface ScripLtp extends ScripIdentify {
id: bigint | number;
ltp: number;
createdAt: string;
[k: string]: unknown;
}
/**
* Map data of <symbol, ScripLtp>
*/
type ScripLtpMap = Map<string, ScripLtp>;
interface CacheInterface {
set: (data: ScripLtpMap) => void;
get: () => ScripLtpMap | undefined;
}
export type { CacheInterface, CandleInterval, Exchange, InstrumentDump, LTPData, OptionLabel, OptionType, OrderStatus, ScripIdentify, ScripLtp, ScripLtpMap, ScripTrendMap, SpreadType, Transaction, Trend };