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.

44 lines (40 loc) 2.4 kB
import * as _thoshpathi_smartapi_javascript from '@thoshpathi/smartapi-javascript'; import { SmartAPI, SmartAPIParams, TokenData, ExchangeTokens, LTPData, QuoteData, PlaceOrderParams, PlaceOrderResponse, Exchange, CandleInterval, GreeksParams, GainersLosersParams, OIBuildupParams } from '@thoshpathi/smartapi-javascript'; import { OHLCData } from './ohlc_data.mjs'; import { Logger } from '@thoshpathi/utils-core'; declare class SmartApiError extends Error { readonly errorCode: string; constructor(message: string, errorCode: string); } interface CandleDataParams { symboltoken: string; fromdate: Date; todate: Date; exchange: Exchange; interval: CandleInterval; } declare class SmartApiEnhanced extends SmartAPI { private readonly apiRetryDelayMs; private readonly logger?; constructor(params: SmartAPIParams, apiRetryDelayMs: number, logger?: Logger | undefined); private getData; private retryCallback; generateSession_e(clientCode: string, clientMpin: string, totp: string): Promise<TokenData>; logout_e(clientCode: string): Promise<object>; fetchProfile(): Promise<_thoshpathi_smartapi_javascript.UserProfile>; fetchRMS(): Promise<_thoshpathi_smartapi_javascript.RMSData>; fetchOrderBook(): Promise<_thoshpathi_smartapi_javascript.OrderDetails[]>; private fetchMarketData; fetchTokensLtp(exchangeTokens: ExchangeTokens): Promise<LTPData[]>; fetchTokensOhlc(exchangeTokens: ExchangeTokens): Promise<OHLCData[]>; fetchTokensQuote(exchangeTokens: ExchangeTokens): Promise<QuoteData[]>; placeOrder_e(params: PlaceOrderParams): Promise<PlaceOrderResponse>; fetchCandlesDatetimeString(date: Date): string; fetchCandleData(params: CandleDataParams): Promise<OHLCData[]>; fetchCompletedOrders(orderResponses: PlaceOrderResponse[]): Promise<_thoshpathi_smartapi_javascript.OrderDetails[] | null>; fetchOptionGreeks(params: GreeksParams): Promise<_thoshpathi_smartapi_javascript.GreeksData[]>; fetchGainersLosers(params: GainersLosersParams): Promise<_thoshpathi_smartapi_javascript.GainersLosersData[]>; fetchPutCallRatio(): Promise<_thoshpathi_smartapi_javascript.PCRVolumeData[]>; fetchOIBuildup(params: OIBuildupParams): Promise<_thoshpathi_smartapi_javascript.OIBuildupData[]>; } export { type CandleDataParams, SmartApiEnhanced, SmartApiError, SmartApiEnhanced as default };