UNPKG

@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.

25 lines (23 loc) 601 B
// src/smartapi/ohlc_data.ts var OHLCData = class { constructor(date, open, high, low, close) { const parsedDate = new Date(date); if (isNaN(parsedDate.getTime())) { throw new Error("Invalid date"); } if ([open, high, low, close].some((value) => isNaN(value))) { throw new Error("Open, High, Low, and Close must be valid numbers"); } if (low > high) { throw new Error("Low cannot be greater than High"); } this.date = parsedDate; this.open = open; this.high = high; this.low = low; this.close = close; } }; export { OHLCData };