@copytrade/broker-shoonya
Version:
Shoonya (Finvasia) broker plugin for @copytrade/unified-broker
61 lines • 1.81 kB
TypeScript
export interface ShoonyaCredentials {
userId: string;
password: string;
totpKey: string;
vendorCode: string;
apiSecret: string;
imei: string;
}
export interface ShoonyaLoginResponse {
stat: string;
susertoken?: string;
lastaccesstime?: string;
spasswordreset?: string;
exarr?: string[];
uname?: string;
prarr?: string[];
actid?: string;
email?: string;
brkname?: string;
emsg?: string;
}
export interface PlaceOrderRequest {
userId: string;
buyOrSell: 'B' | 'S';
productType: string;
exchange: string;
tradingSymbol: string;
quantity: number;
discloseQty: number;
priceType: 'LMT' | 'MKT' | 'SL-LMT' | 'SL-MKT';
price: number;
triggerPrice: number;
retention?: 'DAY' | 'IOC' | 'EOS';
amo?: 'YES' | 'NO';
remarks?: string;
}
export declare class ShoonyaService {
private baseUrl;
private sessionToken;
private userId;
private generateSHA256Hash;
private generateTOTP;
private makeRequest;
private makeAuthenticatedRequest;
login(credentials: ShoonyaCredentials): Promise<ShoonyaLoginResponse>;
logout(userId?: string): Promise<any>;
placeOrder(orderData: PlaceOrderRequest): Promise<any>;
getOrderBook(userId: string): Promise<any>;
getOrderStatus(userId: string, orderNumber: string): Promise<any>;
getPositions(userId: string): Promise<any>;
searchScrip(exchange: string, searchText: string): Promise<any>;
getQuotes(exchange: string, token: string): Promise<any>;
isLoggedIn(): boolean;
getSessionToken(): string | null;
validateSession(userId: string): Promise<boolean>;
/**
* Get the current user ID (broker account ID)
*/
getUserId(): string | null;
}
//# sourceMappingURL=shoonyaService.d.ts.map