@ganaka/sdk 1.10.0 → 1.10.1
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/dist/index.d.ts +46 -1
- package/dist/index.js +84 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4319,7 +4319,7 @@ const y = object({
|
|
|
4319
4319
|
end_time: string(),
|
|
4320
4320
|
interval_in_minutes: number$1()
|
|
4321
4321
|
})
|
|
4322
|
-
}),
|
|
4322
|
+
}), P = {
|
|
4323
4323
|
query: object({
|
|
4324
4324
|
symbol: string(),
|
|
4325
4325
|
interval: _enum(b),
|
|
@@ -4330,7 +4330,7 @@ const y = object({
|
|
|
4330
4330
|
response: t.extend({
|
|
4331
4331
|
data: y
|
|
4332
4332
|
})
|
|
4333
|
-
},
|
|
4333
|
+
}, O = {
|
|
4334
4334
|
query: object({
|
|
4335
4335
|
symbol: string(),
|
|
4336
4336
|
exchange: _enum(["NSE", "BSE"]).optional(),
|
|
@@ -4341,11 +4341,11 @@ const y = object({
|
|
|
4341
4341
|
response: t.extend({
|
|
4342
4342
|
data: r.nullable()
|
|
4343
4343
|
})
|
|
4344
|
-
},
|
|
4344
|
+
}, q = {
|
|
4345
4345
|
response: t.extend({
|
|
4346
4346
|
data: string()
|
|
4347
4347
|
})
|
|
4348
|
-
},
|
|
4348
|
+
}, z = {
|
|
4349
4349
|
query: object({
|
|
4350
4350
|
symbol: string(),
|
|
4351
4351
|
end_datetime: o,
|
|
@@ -4389,7 +4389,7 @@ const y = object({
|
|
|
4389
4389
|
)
|
|
4390
4390
|
})
|
|
4391
4391
|
})
|
|
4392
|
-
},
|
|
4392
|
+
}, M = {
|
|
4393
4393
|
query: object({
|
|
4394
4394
|
datetime: o.optional(),
|
|
4395
4395
|
timezone: a.optional()
|
|
@@ -4397,20 +4397,20 @@ const y = object({
|
|
|
4397
4397
|
response: t.extend({
|
|
4398
4398
|
data: r.nullable()
|
|
4399
4399
|
})
|
|
4400
|
-
},
|
|
4400
|
+
}, Ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4401
4401
|
__proto__: null,
|
|
4402
|
-
getGrowwHistoricalCandles:
|
|
4403
|
-
getGrowwNiftyQuote:
|
|
4402
|
+
getGrowwHistoricalCandles: P,
|
|
4403
|
+
getGrowwNiftyQuote: M,
|
|
4404
4404
|
getGrowwNiftyQuoteTimeline: A,
|
|
4405
|
-
getGrowwQuote:
|
|
4406
|
-
getGrowwQuoteTimeline:
|
|
4407
|
-
getGrowwToken:
|
|
4405
|
+
getGrowwQuote: O,
|
|
4406
|
+
getGrowwQuoteTimeline: z,
|
|
4407
|
+
getGrowwToken: q,
|
|
4408
4408
|
growwHistoricalCandlesSchema: y
|
|
4409
4409
|
}, Symbol.toStringTag, { value: "Module" })), j = object({
|
|
4410
4410
|
name: string(),
|
|
4411
4411
|
price: number$1(),
|
|
4412
4412
|
nseSymbol: string()
|
|
4413
|
-
}),
|
|
4413
|
+
}), D = {
|
|
4414
4414
|
query: object({
|
|
4415
4415
|
type: _enum(["top-gainers", "volume-shockers"]),
|
|
4416
4416
|
datetime: o.optional(),
|
|
@@ -4420,9 +4420,9 @@ const y = object({
|
|
|
4420
4420
|
response: t.extend({
|
|
4421
4421
|
data: array(j).nullable()
|
|
4422
4422
|
})
|
|
4423
|
-
},
|
|
4423
|
+
}, Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4424
4424
|
__proto__: null,
|
|
4425
|
-
getLists:
|
|
4425
|
+
getLists: D,
|
|
4426
4426
|
listSchema: j
|
|
4427
4427
|
}, Symbol.toStringTag, { value: "Module" })), C = {
|
|
4428
4428
|
query: object({
|
|
@@ -4449,7 +4449,7 @@ const y = object({
|
|
|
4449
4449
|
)
|
|
4450
4450
|
})
|
|
4451
4451
|
})
|
|
4452
|
-
},
|
|
4452
|
+
}, He = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4453
4453
|
__proto__: null,
|
|
4454
4454
|
getShortlistPersistence: C
|
|
4455
4455
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -4482,7 +4482,7 @@ const y = object({
|
|
|
4482
4482
|
})
|
|
4483
4483
|
})
|
|
4484
4484
|
});
|
|
4485
|
-
const
|
|
4485
|
+
const G = {
|
|
4486
4486
|
query: object({}),
|
|
4487
4487
|
response: t.extend({
|
|
4488
4488
|
data: object({
|
|
@@ -4496,10 +4496,10 @@ const E = {
|
|
|
4496
4496
|
)
|
|
4497
4497
|
})
|
|
4498
4498
|
})
|
|
4499
|
-
},
|
|
4499
|
+
}, E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4500
4500
|
__proto__: null,
|
|
4501
|
-
getAvailableDatetimes:
|
|
4502
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4501
|
+
getAvailableDatetimes: G
|
|
4502
|
+
}, Symbol.toStringTag, { value: "Module" })), I = {
|
|
4503
4503
|
query: object({
|
|
4504
4504
|
symbol: string(),
|
|
4505
4505
|
date: n,
|
|
@@ -4521,10 +4521,10 @@ const E = {
|
|
|
4521
4521
|
interval_in_minutes: number$1()
|
|
4522
4522
|
})
|
|
4523
4523
|
})
|
|
4524
|
-
},
|
|
4524
|
+
}, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4525
4525
|
__proto__: null,
|
|
4526
|
-
getCandles:
|
|
4527
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4526
|
+
getCandles: I
|
|
4527
|
+
}, Symbol.toStringTag, { value: "Module" })), L = {
|
|
4528
4528
|
query: object({
|
|
4529
4529
|
date: n,
|
|
4530
4530
|
type: _enum(t$1)
|
|
@@ -4544,10 +4544,10 @@ const E = {
|
|
|
4544
4544
|
)
|
|
4545
4545
|
})
|
|
4546
4546
|
})
|
|
4547
|
-
},
|
|
4547
|
+
}, N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4548
4548
|
__proto__: null,
|
|
4549
|
-
getDailyPersistentCompanies:
|
|
4550
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4549
|
+
getDailyPersistentCompanies: L
|
|
4550
|
+
}, Symbol.toStringTag, { value: "Module" })), $ = {
|
|
4551
4551
|
query: object({
|
|
4552
4552
|
date: n,
|
|
4553
4553
|
type: _enum(t$1)
|
|
@@ -4561,7 +4561,7 @@ const E = {
|
|
|
4561
4561
|
})
|
|
4562
4562
|
}, Q = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4563
4563
|
__proto__: null,
|
|
4564
|
-
getDailyUniqueCompanies:
|
|
4564
|
+
getDailyUniqueCompanies: $
|
|
4565
4565
|
}, Symbol.toStringTag, { value: "Module" })), U = object({
|
|
4566
4566
|
id: uuid(),
|
|
4567
4567
|
username: string()
|
|
@@ -4572,10 +4572,10 @@ const E = {
|
|
|
4572
4572
|
response: t.extend({
|
|
4573
4573
|
data: U
|
|
4574
4574
|
})
|
|
4575
|
-
},
|
|
4575
|
+
}, K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4576
4576
|
__proto__: null,
|
|
4577
4577
|
signIn: Y
|
|
4578
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4578
|
+
}, Symbol.toStringTag, { value: "Module" })), F = {
|
|
4579
4579
|
query: object({
|
|
4580
4580
|
symbol: string(),
|
|
4581
4581
|
date: n
|
|
@@ -4597,9 +4597,9 @@ const E = {
|
|
|
4597
4597
|
)
|
|
4598
4598
|
})
|
|
4599
4599
|
})
|
|
4600
|
-
},
|
|
4600
|
+
}, B = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4601
4601
|
__proto__: null,
|
|
4602
|
-
getQuoteTimeline:
|
|
4602
|
+
getQuoteTimeline: F
|
|
4603
4603
|
}, Symbol.toStringTag, { value: "Module" })), Z = object({
|
|
4604
4604
|
id: uuid(),
|
|
4605
4605
|
start_datetime: string(),
|
|
@@ -4763,15 +4763,45 @@ const E = {
|
|
|
4763
4763
|
__proto__: null,
|
|
4764
4764
|
getShortlists: me,
|
|
4765
4765
|
shortlistEntryWithMetricsSchema: h
|
|
4766
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4766
|
+
}, Symbol.toStringTag, { value: "Module" })), pe = {
|
|
4767
|
+
response: t.extend({
|
|
4768
|
+
data: object({
|
|
4769
|
+
hasGrowwApiKey: boolean(),
|
|
4770
|
+
hasGrowwApiSecret: boolean(),
|
|
4771
|
+
growwApiKeyMasked: string().nullable()
|
|
4772
|
+
})
|
|
4773
|
+
})
|
|
4774
|
+
}, ge = {
|
|
4775
|
+
body: object({
|
|
4776
|
+
growwApiKey: string().min(1, "Groww API key is required"),
|
|
4777
|
+
growwApiSecret: string().min(1, "Groww API secret is required")
|
|
4778
|
+
}),
|
|
4779
|
+
response: t.extend({
|
|
4780
|
+
data: object({
|
|
4781
|
+
success: boolean()
|
|
4782
|
+
})
|
|
4783
|
+
})
|
|
4784
|
+
}, _e = {
|
|
4785
|
+
response: t.extend({
|
|
4786
|
+
data: object({
|
|
4787
|
+
success: boolean()
|
|
4788
|
+
})
|
|
4789
|
+
})
|
|
4790
|
+
}, ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4767
4791
|
__proto__: null,
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4792
|
+
deleteGrowwCredentials: _e,
|
|
4793
|
+
getGrowwCredentials: pe,
|
|
4794
|
+
updateGrowwCredentials: ge
|
|
4795
|
+
}, Symbol.toStringTag, { value: "Module" })), $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4796
|
+
__proto__: null,
|
|
4797
|
+
v1_dashboard_auth_schemas: K,
|
|
4798
|
+
v1_dashboard_available_datetimes_schemas: E,
|
|
4799
|
+
v1_dashboard_candles_schemas: H,
|
|
4800
|
+
v1_dashboard_daily_persistent_companies_schemas: N,
|
|
4772
4801
|
v1_dashboard_daily_unique_companies_schemas: Q,
|
|
4773
|
-
v1_dashboard_quote_timeline_schemas:
|
|
4802
|
+
v1_dashboard_quote_timeline_schemas: B,
|
|
4774
4803
|
v1_dashboard_runs_schemas: ue,
|
|
4804
|
+
v1_dashboard_settings_schemas: ye,
|
|
4775
4805
|
v1_dashboard_shortlists_schemas: be
|
|
4776
4806
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4777
4807
|
({
|
|
@@ -6058,7 +6088,7 @@ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
|
6058
6088
|
}
|
|
6059
6089
|
}
|
|
6060
6090
|
function formatHeader(header) {
|
|
6061
|
-
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (
|
|
6091
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
6062
6092
|
return char.toUpperCase() + str;
|
|
6063
6093
|
});
|
|
6064
6094
|
}
|
|
@@ -8250,12 +8280,15 @@ class RateLimiter {
|
|
|
8250
8280
|
}
|
|
8251
8281
|
}
|
|
8252
8282
|
const limiters = /* @__PURE__ */ new Map();
|
|
8253
|
-
limiters.set(
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8283
|
+
limiters.set(
|
|
8284
|
+
"groww",
|
|
8285
|
+
new RateLimiter({
|
|
8286
|
+
maxPerSecond: 10,
|
|
8287
|
+
maxPerMinute: 300,
|
|
8288
|
+
maxConcurrency: 7,
|
|
8289
|
+
requestTimeoutMs: 3e4
|
|
8290
|
+
})
|
|
8291
|
+
);
|
|
8259
8292
|
const growwRateLimiter = limiters.get("groww");
|
|
8260
8293
|
dayjs.extend(utc);
|
|
8261
8294
|
dayjs.extend(timezone);
|
|
@@ -8272,7 +8305,7 @@ const fetchCandles = ({
|
|
|
8272
8305
|
);
|
|
8273
8306
|
}
|
|
8274
8307
|
try {
|
|
8275
|
-
const validatedParams =
|
|
8308
|
+
const validatedParams = Ee.getGrowwHistoricalCandles.query.parse(params);
|
|
8276
8309
|
const headers = {
|
|
8277
8310
|
Authorization: `Bearer ${developerToken}`
|
|
8278
8311
|
};
|
|
@@ -8321,7 +8354,7 @@ const fetchQuote = ({
|
|
|
8321
8354
|
);
|
|
8322
8355
|
}
|
|
8323
8356
|
try {
|
|
8324
|
-
const validatedParams =
|
|
8357
|
+
const validatedParams = Ee.getGrowwQuote.query.parse(params);
|
|
8325
8358
|
const headers = {
|
|
8326
8359
|
Authorization: `Bearer ${developerToken}`
|
|
8327
8360
|
};
|
|
@@ -8361,7 +8394,7 @@ const fetchQuoteTimeline = ({
|
|
|
8361
8394
|
throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
|
|
8362
8395
|
}
|
|
8363
8396
|
try {
|
|
8364
|
-
const validatedParams =
|
|
8397
|
+
const validatedParams = Ee.getGrowwQuoteTimeline.query.parse({
|
|
8365
8398
|
symbol,
|
|
8366
8399
|
end_datetime
|
|
8367
8400
|
});
|
|
@@ -8408,7 +8441,7 @@ const fetchShortlist = ({
|
|
|
8408
8441
|
);
|
|
8409
8442
|
}
|
|
8410
8443
|
try {
|
|
8411
|
-
const validatedParams =
|
|
8444
|
+
const validatedParams = Ie.getLists.query.parse(queryParams);
|
|
8412
8445
|
const headers = {
|
|
8413
8446
|
Authorization: `Bearer ${developerToken}`
|
|
8414
8447
|
};
|
|
@@ -8452,7 +8485,7 @@ const fetchShortlistPersistence = ({
|
|
|
8452
8485
|
);
|
|
8453
8486
|
}
|
|
8454
8487
|
try {
|
|
8455
|
-
const validatedParams =
|
|
8488
|
+
const validatedParams = He.getShortlistPersistence.query.parse(queryParams);
|
|
8456
8489
|
const headers = {
|
|
8457
8490
|
Authorization: `Bearer ${developerToken}`
|
|
8458
8491
|
};
|
|
@@ -8496,7 +8529,7 @@ const fetchNiftyQuote = ({
|
|
|
8496
8529
|
throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
|
|
8497
8530
|
}
|
|
8498
8531
|
try {
|
|
8499
|
-
const validatedParams =
|
|
8532
|
+
const validatedParams = Ee.getGrowwNiftyQuote.query.parse(params);
|
|
8500
8533
|
const headers = {
|
|
8501
8534
|
Authorization: `Bearer ${developerToken}`
|
|
8502
8535
|
};
|
|
@@ -8538,7 +8571,7 @@ const fetchNiftyQuoteTimeline = ({
|
|
|
8538
8571
|
throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
|
|
8539
8572
|
}
|
|
8540
8573
|
try {
|
|
8541
|
-
const validatedParams =
|
|
8574
|
+
const validatedParams = Ee.getGrowwNiftyQuoteTimeline.query.parse({
|
|
8542
8575
|
end_datetime
|
|
8543
8576
|
});
|
|
8544
8577
|
const headers = {
|
|
@@ -8727,7 +8760,7 @@ const placeOrder = ({ runId, apiClient }) => async (data) => {
|
|
|
8727
8760
|
try {
|
|
8728
8761
|
await retryWithBackoff(
|
|
8729
8762
|
async () => {
|
|
8730
|
-
const validatedData =
|
|
8763
|
+
const validatedData = $e.v1_dashboard_runs_schemas.createOrder.body.parse(data);
|
|
8731
8764
|
await apiClient.post(`/v1/dashboard/runs/${runId}/orders`, validatedData);
|
|
8732
8765
|
logger.debug(`Order persisted for ${data.nseSymbol} in runId: ${runId}`);
|
|
8733
8766
|
},
|