UNPKG

smartapi-typescript

Version:

TypeScript library for Angel One SmartAPI broker API

113 lines (112 loc) 3.91 kB
import { AxiosInstance } from 'axios'; import { ApiResponse, OrderParams, BracketOrderParams, CoverOrderParams, OrderResponse, OrderDetails } from '../../types'; import { Auth } from '../auth'; /** * Orders module for SmartAPI * Handles placing, modifying, cancelling orders and fetching order details */ export declare class Orders { private auth; private httpClient; private debug; /** * Initialize orders module */ constructor(auth: Auth, httpClient: AxiosInstance, debug?: boolean); /** * Log debug messages if debug mode is enabled */ private log; /** * Place a normal order * @param params Order parameters * @param options Network configuration options * @returns Order response with orderid and uniqueorderid */ placeOrder(params: OrderParams, options?: { clientLocalIP?: string; clientPublicIP?: string; macAddress?: string; }): Promise<ApiResponse<OrderResponse>>; /** * Place a bracket order * A bracket order is a special order that includes an entry order along with target and stoploss orders * @param params Bracket order parameters * @param options Network configuration options * @returns Order response with orderid and uniqueorderid */ placeBracketOrder(params: BracketOrderParams, options?: { clientLocalIP?: string; clientPublicIP?: string; macAddress?: string; }): Promise<ApiResponse<OrderResponse>>; /** * Place a cover order * A cover order is a special order that includes a stoploss order along with the main order * @param params Cover order parameters * @param options Network configuration options * @returns Order response with orderid and uniqueorderid */ placeCoverOrder(params: CoverOrderParams, options?: { clientLocalIP?: string; clientPublicIP?: string; macAddress?: string; }): Promise<ApiResponse<OrderResponse>>; /** * Modify an existing order * @param params Order parameters with order id * @param options Network configuration options * @returns Order modification response with orderid and uniqueorderid */ modifyOrder(params: OrderParams & { orderid: string; }, options?: { clientLocalIP?: string; clientPublicIP?: string; macAddress?: string; }): Promise<ApiResponse<OrderResponse>>; /** * Cancel an order * @param orderId Order ID to cancel * @param variety Order variety * @param options Network configuration options * @returns Order cancellation response with orderid and uniqueorderid */ cancelOrder(orderId: string, variety: string, options?: { clientLocalIP?: string; clientPublicIP?: string; macAddress?: string; }): Promise<ApiResponse<OrderResponse>>; /** * Get order book (list of orders) * @param options Network configuration options * @returns Order book */ getOrderBook(options?: { clientLocalIP?: string; clientPublicIP?: string; macAddress?: string; }): Promise<ApiResponse>; /** * Get details of a specific order by uniqueorderid * * @param uniqueOrderId Unique order ID received in order responses * @param options Network configuration options * @returns Order details response */ getOrderDetails(uniqueOrderId: string, options?: { clientLocalIP?: string; clientPublicIP?: string; macAddress?: string; }): Promise<ApiResponse<OrderDetails>>; /** * Get trade book (list of trades/executions) * @param options Network configuration options * @returns Trade book */ getTradeBook(options?: { clientLocalIP?: string; clientPublicIP?: string; macAddress?: string; }): Promise<ApiResponse>; }