
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
NodeJS SDK for Groww trading APIs
growwapi is a NodeJS SDK for Groww trading APIs. The library provides functionality for trading on Groww including holdings management, margin calculations, order management, and position tracking.
npm install growwapi
Create a .env
file in your project root:
GROWW_API_KEY=your_api_key
GROWW_API_SECRET=your_api_secret
Optional:
GROWW_API_BASE_URL=
GROWW_API_VERSION=
GROWW_FILECACHE_TTL=
GROWW_LIVE_FEED_MAX_RETRY_COUNT=
GROWW_LIVE_FEED_MAX_RETRY_DURATION=
Here's an example of how to initialize the SDK, fetch your holdings, and place an order:
import { GrowwAPI, Exchange, Segment, Product, OrderType, TransactionType, Validity } from 'growwapi';
const groww = new GrowwAPI();
const holdings = await groww.holdings.list();
console.log('Holdings:', holdings);
const orderDetails = {
tradingSymbol: 'RELIANCE',
quantity: 1,
price: 2800,
triggerPrice: 0,
validity: Validity.Day,
exchange: Exchange.NSE,
segment: Segment.CASH,
product: Product.CNC,
orderType: OrderType.Limit,
transactionType: TransactionType.Buy,
};
const order = await groww.orders.create(orderDetails);
console.log('Order placed successfully:', order);
Once your environment is set up and the SDK is initialized, you can explore detailed usage for each feature in the examples directory
Each example demonstrates real-world usage and best practices for the respective module.
LiveFeed
)LiveFeed.connect(callback: (data) => void): void
LiveFeed.subscribe(instrumentId: string): void
LiveFeed.consume(subscription: string): void
LiveFeed.disconnect(): void
LiveData
)LiveData.getQuote(params: GetQuoteParams): Promise<GetQuoteResponse>
LiveData.getLTP(params: GetLTPParams): Promise<GetLTPResponse>
LiveData.getOHLC(params: GetOHLCParams): Promise<GetOHLCResponse>
HistoricData
)HistoricData.get(params: HistoricDataParams): Promise<HistoricDataResponse>
Instructions
)Instructions.getInstructions(): Promise<InstructionsResponse>
Instructions.getFilteredInstructions(params: InstructionsTypeParams): Promise<InstructionsResponse>
Holdings
)Holdings.list(): Promise<HoldingsResponse>
Margins
)Margins.details(): Promise<MarginsResponse>
Margins.requiredForOrder(params: MarginsRequiredParams): Promise<MarginsRequiredResponse>
Orders
)Orders.create(params: CreateOrderParams): Promise<CreateOrderResponse>
Orders.modify(params: ModifyOrderParams): Promise<ModifyOrderResponse>
Orders.cancel(params: CancelOrderParams): Promise<CancelOrderResponse>
Orders.getTrades(params: GetTradesParams): Promise<GetTradesResponse>
Orders.status(params: OrderStatusParams): Promise<OrderStatusResponse>
Orders.statusByReference(params: OrderStatusByReferenceParams): Promise<OrderStatusResponse>
Orders.getOrders(params: ListOrderParams): Promise<OrderResponse[]>
Orders.details(params: OrderDetailsParams): Promise<OrderResponse>
Positions
)Positions.user(params: BaseParams): Promise<PositionsResponse>
Positions.tradingSymbol(params: TradingSymbolParams): Promise<TradingSymbolResponse>
Auth
)Auth.generateToken(): Promise<AuthTokenResponse>
Auth.refreshToken(): Promise<AuthTokenResponse>
All request and response types are available in the types
directory and are strongly typed for TypeScript.
See the types
folder for details.
npm run build
: Builds the project.npm run test
: Runs tests.npm run lint
: Lints the code.npm generate-exports
: Generates exports for all types.npm run test
npm run lint
GROWW_API_KEY
and GROWW_API_SECRET
are correct.types
directory for detailed information on the required and optional parameters.This project is licensed under the Apache License 2.0. See the LICENSE
file for details.
FAQs
NodeJS SDK for Groww trading APIs
The npm package growwapi receives a total of 7 weekly downloads. As such, growwapi popularity was classified as not popular.
We found that growwapi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.