@ganaka/sdk 1.6.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -132
- package/dist/index.d.ts +196 -0
- package/dist/index.js +872 -477
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +872 -477
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,172 +16,218 @@ pnpm add @ganaka/sdk
|
|
|
16
16
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
19
|
+
### Using GanakaClient for Standalone API Calls
|
|
20
|
+
|
|
21
|
+
The `GanakaClient` allows you to fetch data without setting up a full ganaka run:
|
|
22
|
+
|
|
19
23
|
```typescript
|
|
20
24
|
import { GanakaClient } from "@ganaka/sdk";
|
|
25
|
+
import dotenv from "dotenv";
|
|
26
|
+
|
|
27
|
+
dotenv.config();
|
|
21
28
|
|
|
22
|
-
// Initialize the client
|
|
29
|
+
// Initialize the client (reads DEVELOPER_KEY from environment)
|
|
30
|
+
const client = new GanakaClient();
|
|
31
|
+
|
|
32
|
+
// Or with explicit configuration
|
|
23
33
|
const client = new GanakaClient({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
developerToken: "your-developer-token",
|
|
35
|
+
apiDomain: "https://api.ganaka.live", // optional, defaults to this
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Fetch historical candles
|
|
39
|
+
const candles = await client.fetchCandles({
|
|
40
|
+
symbol: "RELIANCE",
|
|
41
|
+
interval: "1minute",
|
|
42
|
+
start_datetime: "2026-01-20T09:15:00",
|
|
43
|
+
end_datetime: "2026-01-20T15:30:00",
|
|
27
44
|
});
|
|
28
45
|
|
|
29
|
-
//
|
|
30
|
-
const
|
|
31
|
-
|
|
46
|
+
// Fetch quote for a symbol
|
|
47
|
+
const quote = await client.fetchQuote({
|
|
48
|
+
symbol: "RELIANCE",
|
|
49
|
+
datetime: "2026-01-20T10:30:00",
|
|
50
|
+
});
|
|
32
51
|
|
|
33
|
-
//
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
52
|
+
// Fetch shortlist
|
|
53
|
+
const shortlist = await client.fetchShortlist({
|
|
54
|
+
type: "top-gainers",
|
|
55
|
+
datetime: "2026-01-20T10:30:00",
|
|
56
|
+
});
|
|
38
57
|
```
|
|
39
58
|
|
|
40
|
-
|
|
59
|
+
### Using ganaka() for Iterative Strategies
|
|
60
|
+
|
|
61
|
+
The `ganaka()` function is used for running iterative strategies with time loops:
|
|
41
62
|
|
|
42
63
|
```typescript
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
64
|
+
import { ganaka } from "@ganaka/sdk";
|
|
65
|
+
import dotenv from "dotenv";
|
|
66
|
+
|
|
67
|
+
dotenv.config();
|
|
68
|
+
|
|
69
|
+
await ganaka({
|
|
70
|
+
fn: async ({ fetchCandles, fetchQuote, placeOrder, currentTimestamp }) => {
|
|
71
|
+
// Your strategy logic here
|
|
72
|
+
const candles = await fetchCandles({
|
|
73
|
+
symbol: "RELIANCE",
|
|
74
|
+
interval: "1minute",
|
|
75
|
+
start_datetime: "2026-01-20T09:15:00",
|
|
76
|
+
end_datetime: currentTimestamp,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const quote = await fetchQuote({
|
|
80
|
+
symbol: "RELIANCE",
|
|
81
|
+
datetime: currentTimestamp,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Place order if conditions are met
|
|
85
|
+
if (quote && quote.price > 100) {
|
|
86
|
+
await placeOrder({
|
|
87
|
+
nseSymbol: "RELIANCE",
|
|
88
|
+
entryPrice: quote.price,
|
|
89
|
+
stopLossPrice: quote.price * 0.95,
|
|
90
|
+
takeProfitPrice: quote.price * 1.05,
|
|
91
|
+
datetime: currentTimestamp,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
startTime: "2026-01-20T09:15:00",
|
|
96
|
+
endTime: "2026-01-20T15:30:00",
|
|
97
|
+
intervalMinutes: 1,
|
|
98
|
+
name: "My Strategy",
|
|
99
|
+
tags: ["momentum", "scalping"],
|
|
49
100
|
});
|
|
50
101
|
```
|
|
51
102
|
|
|
52
|
-
##
|
|
103
|
+
## Configuration
|
|
53
104
|
|
|
54
|
-
###
|
|
105
|
+
### Environment Variables
|
|
55
106
|
|
|
56
|
-
|
|
57
|
-
// Get all shortlists
|
|
58
|
-
const shortlists = await client.getShortlists();
|
|
107
|
+
The SDK reads configuration from environment variables:
|
|
59
108
|
|
|
60
|
-
|
|
61
|
-
|
|
109
|
+
- `DEVELOPER_KEY` - Your developer token (required)
|
|
110
|
+
- `API_DOMAIN` - API base URL (optional, defaults to `https://api.ganaka.live`)
|
|
62
111
|
|
|
63
|
-
|
|
64
|
-
const newShortlist = await client.createShortlist({
|
|
65
|
-
name: "My Watchlist",
|
|
66
|
-
symbols: ["AAPL", "GOOGL", "MSFT"],
|
|
67
|
-
});
|
|
112
|
+
### GanakaClient Configuration
|
|
68
113
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
name: "Updated Watchlist",
|
|
72
|
-
});
|
|
114
|
+
```typescript
|
|
115
|
+
import { GanakaClient } from "@ganaka/sdk";
|
|
73
116
|
|
|
74
|
-
|
|
75
|
-
|
|
117
|
+
const client = new GanakaClient({
|
|
118
|
+
developerToken: "your-developer-token", // optional if DEVELOPER_KEY env var is set
|
|
119
|
+
apiDomain: "https://api.ganaka.live", // optional, defaults to this
|
|
120
|
+
});
|
|
76
121
|
```
|
|
77
122
|
|
|
78
|
-
|
|
123
|
+
## API Methods
|
|
79
124
|
|
|
80
|
-
|
|
81
|
-
// Search instruments
|
|
82
|
-
const results = await client.searchInstruments("apple");
|
|
125
|
+
### GanakaClient Methods
|
|
83
126
|
|
|
84
|
-
|
|
85
|
-
const instrument = await client.getInstrument("AAPL");
|
|
127
|
+
All methods return promises that resolve to the API response data.
|
|
86
128
|
|
|
87
|
-
|
|
88
|
-
const instruments = await client.getInstruments(["AAPL", "GOOGL"]);
|
|
89
|
-
```
|
|
129
|
+
#### `fetchCandles(params)`
|
|
90
130
|
|
|
91
|
-
|
|
131
|
+
Fetch historical candles for a symbol.
|
|
92
132
|
|
|
93
133
|
```typescript
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
name: "My Strategy",
|
|
100
|
-
type: "momentum",
|
|
101
|
-
parameters: {
|
|
102
|
-
period: 20,
|
|
103
|
-
threshold: 0.02,
|
|
104
|
-
},
|
|
105
|
-
status: "inactive",
|
|
134
|
+
const candles = await client.fetchCandles({
|
|
135
|
+
symbol: "RELIANCE",
|
|
136
|
+
interval: "1minute", // or "5minute", "1day", etc.
|
|
137
|
+
start_datetime: "2026-01-20T09:15:00", // IST format (YYYY-MM-DDTHH:mm:ss)
|
|
138
|
+
end_datetime: "2026-01-20T15:30:00",
|
|
106
139
|
});
|
|
107
|
-
|
|
108
|
-
// Start/stop a strategy
|
|
109
|
-
await client.startStrategy("strategy-id");
|
|
110
|
-
await client.stopStrategy("strategy-id");
|
|
111
140
|
```
|
|
112
141
|
|
|
113
|
-
|
|
142
|
+
#### `fetchQuote(params)`
|
|
143
|
+
|
|
144
|
+
Fetch quote for a symbol at a specific datetime.
|
|
114
145
|
|
|
115
146
|
```typescript
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
quantity: 100,
|
|
120
|
-
orderType: "market",
|
|
121
|
-
side: "buy",
|
|
147
|
+
const quote = await client.fetchQuote({
|
|
148
|
+
symbol: "RELIANCE",
|
|
149
|
+
datetime: "2026-01-20T10:30:00", // IST format
|
|
122
150
|
});
|
|
123
|
-
|
|
124
|
-
// Get orders
|
|
125
|
-
const orders = await client.getOrders();
|
|
126
|
-
|
|
127
|
-
// Cancel an order
|
|
128
|
-
await client.cancelOrder("order-id");
|
|
129
151
|
```
|
|
130
152
|
|
|
131
|
-
|
|
153
|
+
#### `fetchQuoteTimeline(symbol, end_datetime)`
|
|
132
154
|
|
|
133
|
-
|
|
134
|
-
// Get WebSocket client
|
|
135
|
-
const ws = client.getWebSocket();
|
|
155
|
+
Fetch quote timeline for a symbol.
|
|
136
156
|
|
|
137
|
-
|
|
138
|
-
await client.
|
|
157
|
+
```typescript
|
|
158
|
+
const timeline = await client.fetchQuoteTimeline(
|
|
159
|
+
"RELIANCE",
|
|
160
|
+
"2026-01-20T15:30:00" // IST format
|
|
161
|
+
);
|
|
162
|
+
```
|
|
139
163
|
|
|
140
|
-
|
|
141
|
-
ws.on("connected", () => {
|
|
142
|
-
console.log("Connected to real-time data");
|
|
143
|
-
});
|
|
164
|
+
#### `fetchNiftyQuote(params)`
|
|
144
165
|
|
|
145
|
-
|
|
146
|
-
console.log("Tick data:", data);
|
|
147
|
-
});
|
|
166
|
+
Fetch NIFTY quote at a specific datetime.
|
|
148
167
|
|
|
149
|
-
|
|
150
|
-
|
|
168
|
+
```typescript
|
|
169
|
+
const niftyQuote = await client.fetchNiftyQuote({
|
|
170
|
+
datetime: "2026-01-20T10:30:00", // IST format
|
|
151
171
|
});
|
|
172
|
+
```
|
|
152
173
|
|
|
153
|
-
|
|
154
|
-
ws.subscribeTicks(["AAPL", "GOOGL"]);
|
|
174
|
+
#### `fetchNiftyQuoteTimeline(end_datetime)`
|
|
155
175
|
|
|
156
|
-
|
|
157
|
-
ws.unsubscribeTicks(["AAPL"]);
|
|
176
|
+
Fetch NIFTY quote timeline.
|
|
158
177
|
|
|
159
|
-
|
|
160
|
-
client.
|
|
178
|
+
```typescript
|
|
179
|
+
const niftyTimeline = await client.fetchNiftyQuoteTimeline(
|
|
180
|
+
"2026-01-20T15:30:00" // IST format
|
|
181
|
+
);
|
|
161
182
|
```
|
|
162
183
|
|
|
163
|
-
|
|
184
|
+
#### `fetchShortlist(queryParams)`
|
|
164
185
|
|
|
165
|
-
|
|
186
|
+
Fetch shortlist for a specific type and datetime.
|
|
166
187
|
|
|
167
188
|
```typescript
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
message?: string;
|
|
173
|
-
}
|
|
189
|
+
const shortlist = await client.fetchShortlist({
|
|
190
|
+
type: "top-gainers", // or "top-losers", etc.
|
|
191
|
+
datetime: "2026-01-20T10:30:00", // IST format
|
|
192
|
+
});
|
|
174
193
|
```
|
|
175
194
|
|
|
176
|
-
|
|
195
|
+
#### `fetchShortlistPersistence(queryParams)`
|
|
196
|
+
|
|
197
|
+
Fetch shortlist persistence - stocks that consistently appeared in a shortlist over a time range.
|
|
177
198
|
|
|
178
199
|
```typescript
|
|
179
|
-
const
|
|
200
|
+
const persistence = await client.fetchShortlistPersistence({
|
|
201
|
+
type: "top-gainers",
|
|
202
|
+
start_datetime: "2026-01-20T09:15:00", // IST format
|
|
203
|
+
end_datetime: "2026-01-20T15:30:00", // IST format
|
|
204
|
+
});
|
|
205
|
+
```
|
|
180
206
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
207
|
+
### ganaka() Function
|
|
208
|
+
|
|
209
|
+
The `ganaka()` function provides a `RunContext` with all the above methods plus:
|
|
210
|
+
|
|
211
|
+
- `placeOrder(data)` - Place an order (only available within a run context)
|
|
212
|
+
- `currentTimestamp` - Current timestamp in IST format for the current loop iteration
|
|
213
|
+
|
|
214
|
+
## Error Handling
|
|
215
|
+
|
|
216
|
+
All methods throw errors if the API request fails. Handle them with try-catch:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
try {
|
|
220
|
+
const candles = await client.fetchCandles({
|
|
221
|
+
symbol: "RELIANCE",
|
|
222
|
+
interval: "1minute",
|
|
223
|
+
start_datetime: "2026-01-20T09:15:00",
|
|
224
|
+
end_datetime: "2026-01-20T15:30:00",
|
|
225
|
+
});
|
|
226
|
+
console.log("Candles:", candles);
|
|
227
|
+
} catch (error) {
|
|
228
|
+
if (error instanceof Error) {
|
|
229
|
+
console.error("Failed to fetch candles:", error.message);
|
|
230
|
+
}
|
|
185
231
|
}
|
|
186
232
|
```
|
|
187
233
|
|
|
@@ -190,7 +236,14 @@ if (response.success) {
|
|
|
190
236
|
This SDK is written in TypeScript and provides full type definitions:
|
|
191
237
|
|
|
192
238
|
```typescript
|
|
193
|
-
import type {
|
|
239
|
+
import type {
|
|
240
|
+
GanakaClient,
|
|
241
|
+
GanakaClientConfig,
|
|
242
|
+
FetchCandlesResponse,
|
|
243
|
+
FetchQuoteResponse,
|
|
244
|
+
FetchShortlistResponse,
|
|
245
|
+
RunContext,
|
|
246
|
+
} from "@ganaka/sdk";
|
|
194
247
|
```
|
|
195
248
|
|
|
196
249
|
## Development
|
|
@@ -238,23 +291,3 @@ MIT
|
|
|
238
291
|
## Contributing
|
|
239
292
|
|
|
240
293
|
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,16 @@ declare const deleteRun: {
|
|
|
79
79
|
}, z.core.$strip>;
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
declare const fetchAvailableDates: ({ developerToken, apiDomain, runId, currentTimestamp, currentTimezone, }: {
|
|
83
|
+
developerToken: string;
|
|
84
|
+
apiDomain: string;
|
|
85
|
+
runId: string | null;
|
|
86
|
+
currentTimestamp: string;
|
|
87
|
+
currentTimezone?: string;
|
|
88
|
+
}) => () => Promise<default_2.infer<typeof v1_developer_available_dates_schemas.getAvailableDates.response>["data"]>;
|
|
89
|
+
|
|
90
|
+
export declare type FetchAvailableDatesResponse = Awaited<ReturnType<ReturnType<typeof fetchAvailableDates>>>;
|
|
91
|
+
|
|
82
92
|
declare const fetchCandles: ({ developerToken, apiDomain, runId, currentTimestamp, currentTimezone, }: {
|
|
83
93
|
developerToken: string;
|
|
84
94
|
apiDomain: string;
|
|
@@ -89,6 +99,16 @@ declare const fetchCandles: ({ developerToken, apiDomain, runId, currentTimestam
|
|
|
89
99
|
|
|
90
100
|
export declare type FetchCandlesResponse = Awaited<ReturnType<ReturnType<typeof fetchCandles>>>;
|
|
91
101
|
|
|
102
|
+
declare const fetchHolidays: ({ developerToken, apiDomain, runId, currentTimestamp, currentTimezone, }: {
|
|
103
|
+
developerToken: string;
|
|
104
|
+
apiDomain: string;
|
|
105
|
+
runId: string | null;
|
|
106
|
+
currentTimestamp: string;
|
|
107
|
+
currentTimezone?: string;
|
|
108
|
+
}) => () => Promise<default_2.infer<typeof v1_developer_holidays_schemas.getHolidays.response>["data"]>;
|
|
109
|
+
|
|
110
|
+
export declare type FetchHolidaysResponse = Awaited<ReturnType<ReturnType<typeof fetchHolidays>>>;
|
|
111
|
+
|
|
92
112
|
declare const fetchNiftyQuote: ({ developerToken, apiDomain, runId, currentTimestamp, currentTimezone, }: {
|
|
93
113
|
developerToken: string;
|
|
94
114
|
apiDomain: string;
|
|
@@ -178,6 +198,141 @@ export declare function ganaka<T>({ fn, startTime, endTime, intervalMinutes, del
|
|
|
178
198
|
tags?: string[];
|
|
179
199
|
}): Promise<void>;
|
|
180
200
|
|
|
201
|
+
/**
|
|
202
|
+
* GanakaClient provides standalone access to Ganaka API methods without requiring a run context.
|
|
203
|
+
* This allows you to fetch data (candles, quotes, shortlists, etc.) without setting up a full ganaka run.
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* import { GanakaClient } from "@ganaka/sdk";
|
|
208
|
+
*
|
|
209
|
+
* const client = new GanakaClient();
|
|
210
|
+
* const candles = await client.fetchCandles({
|
|
211
|
+
* symbol: "RELIANCE",
|
|
212
|
+
* interval: "1minute",
|
|
213
|
+
* start_datetime: "2026-01-20T09:15:00",
|
|
214
|
+
* end_datetime: "2026-01-20T15:30:00",
|
|
215
|
+
* });
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
export declare class GanakaClient {
|
|
219
|
+
private developerToken;
|
|
220
|
+
private apiDomain;
|
|
221
|
+
constructor(config?: GanakaClientConfig);
|
|
222
|
+
/**
|
|
223
|
+
* Fetch historical candles for a symbol.
|
|
224
|
+
*
|
|
225
|
+
* @param params - Query parameters for fetching candles
|
|
226
|
+
* @param params.symbol - The symbol to fetch candles for
|
|
227
|
+
* @param params.interval - The interval for candles (e.g., "1minute", "5minute", "1day")
|
|
228
|
+
* @param params.start_datetime - Start datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
229
|
+
* @param params.end_datetime - End datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
230
|
+
* @returns Promise resolving to candle data
|
|
231
|
+
*/
|
|
232
|
+
fetchCandles(params: z.infer<typeof v1_developer_groww_schemas.getGrowwHistoricalCandles.query>): Promise<z.infer<typeof v1_developer_groww_schemas.getGrowwHistoricalCandles.response>["data"]>;
|
|
233
|
+
/**
|
|
234
|
+
* Fetch quote for a symbol at a specific datetime.
|
|
235
|
+
*
|
|
236
|
+
* @param params - Query parameters for fetching quote
|
|
237
|
+
* @param params.symbol - The symbol to fetch quote for
|
|
238
|
+
* @param params.datetime - Datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
239
|
+
* @returns Promise resolving to quote data or null
|
|
240
|
+
*/
|
|
241
|
+
fetchQuote(params: z.infer<typeof v1_developer_groww_schemas.getGrowwQuote.query>): Promise<z.infer<typeof v1_developer_groww_schemas.getGrowwQuote.response>["data"] | null>;
|
|
242
|
+
/**
|
|
243
|
+
* Fetch quote timeline for a symbol.
|
|
244
|
+
* Given a symbol and an end_datetime, returns the quote timeline for the given date.
|
|
245
|
+
*
|
|
246
|
+
* @param symbol - The symbol to fetch quote timeline for
|
|
247
|
+
* @param end_datetime - End datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
248
|
+
* @returns Promise resolving to quote timeline data
|
|
249
|
+
*/
|
|
250
|
+
fetchQuoteTimeline(symbol: string, end_datetime: string): Promise<z.infer<typeof v1_developer_groww_schemas.getGrowwQuoteTimeline.response>["data"]["quoteTimeline"]>;
|
|
251
|
+
/**
|
|
252
|
+
* Fetch NIFTY quote at a specific datetime.
|
|
253
|
+
*
|
|
254
|
+
* @param params - Query parameters for fetching NIFTY quote
|
|
255
|
+
* @param params.datetime - Datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
256
|
+
* @returns Promise resolving to NIFTY quote data or null
|
|
257
|
+
*/
|
|
258
|
+
fetchNiftyQuote(params: z.infer<typeof v1_developer_groww_schemas.getGrowwNiftyQuote.query>): Promise<z.infer<typeof v1_developer_groww_schemas.getGrowwNiftyQuote.response>["data"] | null>;
|
|
259
|
+
/**
|
|
260
|
+
* Fetch NIFTY quote timeline.
|
|
261
|
+
* Given an end_datetime, returns the NIFTY quote timeline for the given date.
|
|
262
|
+
*
|
|
263
|
+
* @param end_datetime - End datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
264
|
+
* @returns Promise resolving to NIFTY quote timeline data
|
|
265
|
+
*/
|
|
266
|
+
fetchNiftyQuoteTimeline(end_datetime: string): Promise<z.infer<typeof v1_developer_groww_schemas.getGrowwNiftyQuoteTimeline.response>["data"]["niftyTimeline"]>;
|
|
267
|
+
/**
|
|
268
|
+
* Fetch shortlist for a specific type and datetime.
|
|
269
|
+
*
|
|
270
|
+
* @param queryParams - Query parameters for fetching shortlist
|
|
271
|
+
* @param queryParams.type - The type of shortlist (e.g., "top-gainers", "top-losers")
|
|
272
|
+
* @param queryParams.datetime - Datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
273
|
+
* @returns Promise resolving to shortlist data or null
|
|
274
|
+
*/
|
|
275
|
+
fetchShortlist(queryParams: z.infer<typeof v1_developer_lists_schemas.getLists.query>): Promise<z.infer<typeof v1_developer_lists_schemas.getLists.response>["data"] | null>;
|
|
276
|
+
/**
|
|
277
|
+
* Fetch shortlist persistence.
|
|
278
|
+
* Given a shortlist type and a start and end datetime,
|
|
279
|
+
* returns the list of instruments that appeared in the shortlist during the time range
|
|
280
|
+
* in descending order of appearance count.
|
|
281
|
+
*
|
|
282
|
+
* This helps identify the stocks that have been consistently appearing in the shortlist
|
|
283
|
+
* over a given period of time.
|
|
284
|
+
*
|
|
285
|
+
* @param queryParams - Query parameters for fetching shortlist persistence
|
|
286
|
+
* @param queryParams.type - The type of shortlist (e.g., "top-gainers", "top-losers")
|
|
287
|
+
* @param queryParams.start_datetime - Start datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
288
|
+
* @param queryParams.end_datetime - End datetime in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
289
|
+
* @returns Promise resolving to shortlist persistence data or null
|
|
290
|
+
*/
|
|
291
|
+
fetchShortlistPersistence(queryParams: z.infer<typeof v1_developer_shortlist_persistence_schemas.getShortlistPersistence.query>): Promise<z.infer<typeof v1_developer_shortlist_persistence_schemas.getShortlistPersistence.response>["data"] | null>;
|
|
292
|
+
/**
|
|
293
|
+
* Fetch available dates with timestamps.
|
|
294
|
+
* Returns which dates have data available, grouped by date with all timestamps for each date.
|
|
295
|
+
*
|
|
296
|
+
* @returns Promise resolving to available dates data with dates and timestamps
|
|
297
|
+
*/
|
|
298
|
+
fetchAvailableDates(): Promise<z.infer<typeof v1_developer_available_dates_schemas.getAvailableDates.response>["data"]>;
|
|
299
|
+
/**
|
|
300
|
+
* Fetch market holidays.
|
|
301
|
+
* Returns all dates marked as market holidays.
|
|
302
|
+
*
|
|
303
|
+
* @returns Promise resolving to holidays data
|
|
304
|
+
*/
|
|
305
|
+
fetchHolidays(): Promise<z.infer<typeof v1_developer_holidays_schemas.getHolidays.response>["data"]>;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export declare interface GanakaClientConfig {
|
|
309
|
+
/**
|
|
310
|
+
* Developer token for API authentication.
|
|
311
|
+
* If not provided, will be read from DEVELOPER_KEY environment variable.
|
|
312
|
+
*/
|
|
313
|
+
developerToken?: string;
|
|
314
|
+
/**
|
|
315
|
+
* API domain base URL.
|
|
316
|
+
* If not provided, defaults to "https://api.ganaka.live".
|
|
317
|
+
* Can also be set via API_DOMAIN environment variable.
|
|
318
|
+
*/
|
|
319
|
+
apiDomain?: string;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
declare const getAvailableDates: {
|
|
323
|
+
query: z.ZodObject<{}, z.core.$strip>;
|
|
324
|
+
response: z.ZodObject<{
|
|
325
|
+
statusCode: z.ZodNumber;
|
|
326
|
+
message: z.ZodString;
|
|
327
|
+
data: z.ZodObject<{
|
|
328
|
+
dates: z.ZodArray<z.ZodObject<{
|
|
329
|
+
date: z.ZodString;
|
|
330
|
+
timestamps: z.ZodArray<z.ZodString>;
|
|
331
|
+
}, z.core.$strip>>;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
}, z.core.$strip>;
|
|
334
|
+
};
|
|
335
|
+
|
|
181
336
|
declare const getAvailableDatetimes: {
|
|
182
337
|
query: z.ZodObject<{}, z.core.$strip>;
|
|
183
338
|
response: z.ZodObject<{
|
|
@@ -593,6 +748,21 @@ declare const getGrowwToken: {
|
|
|
593
748
|
}, z.core.$strip>;
|
|
594
749
|
};
|
|
595
750
|
|
|
751
|
+
declare const getHolidays: {
|
|
752
|
+
response: z.ZodObject<{
|
|
753
|
+
statusCode: z.ZodNumber;
|
|
754
|
+
message: z.ZodString;
|
|
755
|
+
data: z.ZodObject<{
|
|
756
|
+
holidays: z.ZodArray<z.ZodObject<{
|
|
757
|
+
id: z.ZodString;
|
|
758
|
+
date: z.ZodString;
|
|
759
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
760
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
761
|
+
}, z.core.$strip>>;
|
|
762
|
+
}, z.core.$strip>;
|
|
763
|
+
}, z.core.$strip>;
|
|
764
|
+
};
|
|
765
|
+
|
|
596
766
|
declare const getLists: {
|
|
597
767
|
query: z.ZodObject<{
|
|
598
768
|
type: z.ZodEnum<{
|
|
@@ -1015,6 +1185,20 @@ export declare interface RunContext {
|
|
|
1015
1185
|
* over a given period of time.
|
|
1016
1186
|
*/
|
|
1017
1187
|
fetchShortlistPersistence: ReturnType<typeof fetchShortlistPersistence>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Fetch available dates with timestamps.
|
|
1190
|
+
* Returns which dates have data available, grouped by date with all timestamps for each date.
|
|
1191
|
+
*
|
|
1192
|
+
* @returns Available dates data with dates and timestamps
|
|
1193
|
+
*/
|
|
1194
|
+
fetchAvailableDates: ReturnType<typeof fetchAvailableDates>;
|
|
1195
|
+
/**
|
|
1196
|
+
* Fetch market holidays.
|
|
1197
|
+
* Returns all dates marked as market holidays.
|
|
1198
|
+
*
|
|
1199
|
+
* @returns Holidays data
|
|
1200
|
+
*/
|
|
1201
|
+
fetchHolidays: ReturnType<typeof fetchHolidays>;
|
|
1018
1202
|
/**
|
|
1019
1203
|
* Current timestamp in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
1020
1204
|
* for every loop iteration
|
|
@@ -1190,6 +1374,12 @@ declare namespace v1_dashboard_shortlists_schemas {
|
|
|
1190
1374
|
}
|
|
1191
1375
|
}
|
|
1192
1376
|
|
|
1377
|
+
declare namespace v1_developer_available_dates_schemas {
|
|
1378
|
+
export {
|
|
1379
|
+
getAvailableDates
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1193
1383
|
declare namespace v1_developer_groww_schemas {
|
|
1194
1384
|
export {
|
|
1195
1385
|
growwHistoricalCandlesSchema,
|
|
@@ -1202,6 +1392,12 @@ declare namespace v1_developer_groww_schemas {
|
|
|
1202
1392
|
}
|
|
1203
1393
|
}
|
|
1204
1394
|
|
|
1395
|
+
declare namespace v1_developer_holidays_schemas {
|
|
1396
|
+
export {
|
|
1397
|
+
getHolidays
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1205
1401
|
declare namespace v1_developer_lists_schemas {
|
|
1206
1402
|
export {
|
|
1207
1403
|
listSchema,
|