@ganaka/sdk 1.2.0 → 1.3.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/dist/index.d.ts +55 -0
- package/dist/index.js +159 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +159 -79
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -131,6 +131,14 @@ declare const fetchShortlist: ({ developerToken, apiDomain, runId, currentTimest
|
|
|
131
131
|
currentTimezone?: string;
|
|
132
132
|
}) => (queryParams: default_2.infer<typeof v1_developer_lists_schemas.getLists.query>) => Promise<default_2.infer<typeof v1_developer_lists_schemas.getLists.response>["data"] | null>;
|
|
133
133
|
|
|
134
|
+
declare const fetchShortlistPersistence: ({ developerToken, apiDomain, runId, currentTimestamp, currentTimezone, }: {
|
|
135
|
+
developerToken: string;
|
|
136
|
+
apiDomain: string;
|
|
137
|
+
runId: string | null;
|
|
138
|
+
currentTimestamp: string;
|
|
139
|
+
currentTimezone?: string;
|
|
140
|
+
}) => (queryParams: default_2.infer<typeof v1_developer_shortlist_persistence_schemas.getShortlistPersistence.query>) => Promise<default_2.infer<typeof v1_developer_shortlist_persistence_schemas.getShortlistPersistence.response>["data"] | null>;
|
|
141
|
+
|
|
134
142
|
export declare type FetchShortlistResponse = Awaited<ReturnType<ReturnType<typeof fetchShortlist>>>;
|
|
135
143
|
|
|
136
144
|
export declare function ganaka<T>({ fn, startTime, endTime, intervalMinutes, deleteRunAfterCompletion, name, tags, }: {
|
|
@@ -646,6 +654,38 @@ declare const getRunTags: {
|
|
|
646
654
|
}, z.core.$strip>;
|
|
647
655
|
};
|
|
648
656
|
|
|
657
|
+
declare const getShortlistPersistence: {
|
|
658
|
+
query: z.ZodObject<{
|
|
659
|
+
type: z.ZodEnum<{
|
|
660
|
+
"top-gainers": "top-gainers";
|
|
661
|
+
"volume-shockers": "volume-shockers";
|
|
662
|
+
}>;
|
|
663
|
+
start_datetime: z.ZodString;
|
|
664
|
+
end_datetime: z.ZodString;
|
|
665
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
666
|
+
}, z.core.$strip>;
|
|
667
|
+
response: z.ZodObject<{
|
|
668
|
+
statusCode: z.ZodNumber;
|
|
669
|
+
message: z.ZodString;
|
|
670
|
+
data: z.ZodObject<{
|
|
671
|
+
start_datetime: z.ZodString;
|
|
672
|
+
end_datetime: z.ZodString;
|
|
673
|
+
type: z.ZodEnum<{
|
|
674
|
+
"top-gainers": "top-gainers";
|
|
675
|
+
"volume-shockers": "volume-shockers";
|
|
676
|
+
}>;
|
|
677
|
+
totalSnapshots: z.ZodNumber;
|
|
678
|
+
instruments: z.ZodArray<z.ZodObject<{
|
|
679
|
+
nseSymbol: z.ZodString;
|
|
680
|
+
name: z.ZodString;
|
|
681
|
+
appearanceCount: z.ZodNumber;
|
|
682
|
+
totalSnapshots: z.ZodNumber;
|
|
683
|
+
percentage: z.ZodNumber;
|
|
684
|
+
}, z.core.$strip>>;
|
|
685
|
+
}, z.core.$strip>;
|
|
686
|
+
}, z.core.$strip>;
|
|
687
|
+
};
|
|
688
|
+
|
|
649
689
|
declare const getShortlists: {
|
|
650
690
|
query: z.ZodObject<{
|
|
651
691
|
datetime: z.ZodString;
|
|
@@ -851,6 +891,15 @@ export declare interface RunContext {
|
|
|
851
891
|
fetchNiftyQuote: ReturnType<typeof fetchNiftyQuote>;
|
|
852
892
|
fetchQuoteTimeline: ReturnType<typeof fetchQuoteTimeline>;
|
|
853
893
|
fetchShortlist: ReturnType<typeof fetchShortlist>;
|
|
894
|
+
/**
|
|
895
|
+
* Given a shortlist type and a start and end datetime,
|
|
896
|
+
* returns the list of instruments that appeared in the shortlist during the time range
|
|
897
|
+
* in descending order of appearance count
|
|
898
|
+
*
|
|
899
|
+
* This helps identify the stocks that have been consistently appearing in the shortlist
|
|
900
|
+
* over a given period of time.
|
|
901
|
+
*/
|
|
902
|
+
fetchShortlistPersistence: ReturnType<typeof fetchShortlistPersistence>;
|
|
854
903
|
/**
|
|
855
904
|
* Current timestamp in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
856
905
|
* for every loop iteration
|
|
@@ -980,4 +1029,10 @@ declare namespace v1_developer_lists_schemas {
|
|
|
980
1029
|
}
|
|
981
1030
|
}
|
|
982
1031
|
|
|
1032
|
+
declare namespace v1_developer_shortlist_persistence_schemas {
|
|
1033
|
+
export {
|
|
1034
|
+
getShortlistPersistence
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
|
|
983
1038
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -4296,7 +4296,7 @@ const p = object({
|
|
|
4296
4296
|
end_time: string(),
|
|
4297
4297
|
interval_in_minutes: number$1()
|
|
4298
4298
|
})
|
|
4299
|
-
}),
|
|
4299
|
+
}), v = {
|
|
4300
4300
|
query: object({
|
|
4301
4301
|
symbol: string(),
|
|
4302
4302
|
interval: _enum(m),
|
|
@@ -4307,7 +4307,7 @@ const p = object({
|
|
|
4307
4307
|
response: t.extend({
|
|
4308
4308
|
data: p
|
|
4309
4309
|
})
|
|
4310
|
-
},
|
|
4310
|
+
}, f = {
|
|
4311
4311
|
query: object({
|
|
4312
4312
|
symbol: string(),
|
|
4313
4313
|
exchange: _enum(["NSE", "BSE"]).optional(),
|
|
@@ -4352,11 +4352,11 @@ const p = object({
|
|
|
4352
4352
|
response: t.extend({
|
|
4353
4353
|
data: a.nullable()
|
|
4354
4354
|
})
|
|
4355
|
-
},
|
|
4355
|
+
}, je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4356
4356
|
__proto__: null,
|
|
4357
|
-
getGrowwHistoricalCandles:
|
|
4357
|
+
getGrowwHistoricalCandles: v,
|
|
4358
4358
|
getGrowwNiftyQuote: P,
|
|
4359
|
-
getGrowwQuote:
|
|
4359
|
+
getGrowwQuote: f,
|
|
4360
4360
|
getGrowwQuoteTimeline: x,
|
|
4361
4361
|
getGrowwToken: T,
|
|
4362
4362
|
growwHistoricalCandlesSchema: p
|
|
@@ -4364,7 +4364,7 @@ const p = object({
|
|
|
4364
4364
|
name: string(),
|
|
4365
4365
|
price: number$1(),
|
|
4366
4366
|
nseSymbol: string()
|
|
4367
|
-
}),
|
|
4367
|
+
}), O = {
|
|
4368
4368
|
query: object({
|
|
4369
4369
|
type: _enum(["top-gainers", "volume-shockers"]),
|
|
4370
4370
|
datetime: n.optional(),
|
|
@@ -4373,11 +4373,38 @@ const p = object({
|
|
|
4373
4373
|
response: t.extend({
|
|
4374
4374
|
data: array(g).nullable()
|
|
4375
4375
|
})
|
|
4376
|
-
},
|
|
4376
|
+
}, he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4377
4377
|
__proto__: null,
|
|
4378
|
-
getLists:
|
|
4378
|
+
getLists: O,
|
|
4379
4379
|
listSchema: g
|
|
4380
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4380
|
+
}, Symbol.toStringTag, { value: "Module" })), q = {
|
|
4381
|
+
query: object({
|
|
4382
|
+
type: _enum(["top-gainers", "volume-shockers"]),
|
|
4383
|
+
start_datetime: n,
|
|
4384
|
+
end_datetime: n,
|
|
4385
|
+
timezone: o.optional()
|
|
4386
|
+
}),
|
|
4387
|
+
response: t.extend({
|
|
4388
|
+
data: object({
|
|
4389
|
+
start_datetime: string(),
|
|
4390
|
+
end_datetime: string(),
|
|
4391
|
+
type: _enum(["top-gainers", "volume-shockers"]),
|
|
4392
|
+
totalSnapshots: number$1(),
|
|
4393
|
+
instruments: array(
|
|
4394
|
+
object({
|
|
4395
|
+
nseSymbol: string(),
|
|
4396
|
+
name: string(),
|
|
4397
|
+
appearanceCount: number$1(),
|
|
4398
|
+
totalSnapshots: number$1(),
|
|
4399
|
+
percentage: number$1()
|
|
4400
|
+
})
|
|
4401
|
+
)
|
|
4402
|
+
})
|
|
4403
|
+
})
|
|
4404
|
+
}, Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4405
|
+
__proto__: null,
|
|
4406
|
+
getShortlistPersistence: q
|
|
4407
|
+
}, Symbol.toStringTag, { value: "Module" })), w = {
|
|
4381
4408
|
query: object({}),
|
|
4382
4409
|
response: t.extend({
|
|
4383
4410
|
data: object({
|
|
@@ -4391,10 +4418,10 @@ const p = object({
|
|
|
4391
4418
|
)
|
|
4392
4419
|
})
|
|
4393
4420
|
})
|
|
4394
|
-
},
|
|
4421
|
+
}, z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4395
4422
|
__proto__: null,
|
|
4396
|
-
getAvailableDatetimes:
|
|
4397
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4423
|
+
getAvailableDatetimes: w
|
|
4424
|
+
}, Symbol.toStringTag, { value: "Module" })), D = {
|
|
4398
4425
|
query: object({
|
|
4399
4426
|
symbol: string(),
|
|
4400
4427
|
date: i,
|
|
@@ -4416,10 +4443,10 @@ const p = object({
|
|
|
4416
4443
|
interval_in_minutes: number$1()
|
|
4417
4444
|
})
|
|
4418
4445
|
})
|
|
4419
|
-
},
|
|
4446
|
+
}, C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4420
4447
|
__proto__: null,
|
|
4421
|
-
getCandles:
|
|
4422
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4448
|
+
getCandles: D
|
|
4449
|
+
}, Symbol.toStringTag, { value: "Module" })), M = {
|
|
4423
4450
|
query: object({
|
|
4424
4451
|
date: i,
|
|
4425
4452
|
type: _enum(t$1)
|
|
@@ -4439,10 +4466,10 @@ const p = object({
|
|
|
4439
4466
|
)
|
|
4440
4467
|
})
|
|
4441
4468
|
})
|
|
4442
|
-
},
|
|
4469
|
+
}, R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4443
4470
|
__proto__: null,
|
|
4444
|
-
getDailyPersistentCompanies:
|
|
4445
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4471
|
+
getDailyPersistentCompanies: M
|
|
4472
|
+
}, Symbol.toStringTag, { value: "Module" })), A = {
|
|
4446
4473
|
query: object({
|
|
4447
4474
|
date: i,
|
|
4448
4475
|
type: _enum(t$1)
|
|
@@ -4454,23 +4481,23 @@ const p = object({
|
|
|
4454
4481
|
uniqueCount: number$1()
|
|
4455
4482
|
})
|
|
4456
4483
|
})
|
|
4457
|
-
},
|
|
4484
|
+
}, k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4458
4485
|
__proto__: null,
|
|
4459
|
-
getDailyUniqueCompanies:
|
|
4460
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4486
|
+
getDailyUniqueCompanies: A
|
|
4487
|
+
}, Symbol.toStringTag, { value: "Module" })), E = object({
|
|
4461
4488
|
id: uuid(),
|
|
4462
4489
|
username: string()
|
|
4463
|
-
}),
|
|
4490
|
+
}), I = {
|
|
4464
4491
|
body: object({
|
|
4465
4492
|
developerToken: string().nonempty("Developer token is required")
|
|
4466
4493
|
}),
|
|
4467
4494
|
response: t.extend({
|
|
4468
|
-
data:
|
|
4495
|
+
data: E
|
|
4469
4496
|
})
|
|
4470
|
-
},
|
|
4497
|
+
}, L = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4471
4498
|
__proto__: null,
|
|
4472
|
-
signIn:
|
|
4473
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4499
|
+
signIn: I
|
|
4500
|
+
}, Symbol.toStringTag, { value: "Module" })), N = {
|
|
4474
4501
|
query: object({
|
|
4475
4502
|
symbol: string(),
|
|
4476
4503
|
date: i
|
|
@@ -4492,10 +4519,10 @@ const p = object({
|
|
|
4492
4519
|
)
|
|
4493
4520
|
})
|
|
4494
4521
|
})
|
|
4495
|
-
},
|
|
4522
|
+
}, G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4496
4523
|
__proto__: null,
|
|
4497
|
-
getQuoteTimeline:
|
|
4498
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4524
|
+
getQuoteTimeline: N
|
|
4525
|
+
}, Symbol.toStringTag, { value: "Module" })), U = object({
|
|
4499
4526
|
id: uuid(),
|
|
4500
4527
|
start_datetime: string(),
|
|
4501
4528
|
end_datetime: string(),
|
|
@@ -4503,15 +4530,15 @@ const p = object({
|
|
|
4503
4530
|
orderCount: number$1(),
|
|
4504
4531
|
name: string().nullable().optional(),
|
|
4505
4532
|
tags: array(string()).optional()
|
|
4506
|
-
}),
|
|
4533
|
+
}), Q = record(
|
|
4507
4534
|
string(),
|
|
4508
4535
|
// date string (YYYY-MM-DD)
|
|
4509
|
-
array(
|
|
4510
|
-
),
|
|
4536
|
+
array(U)
|
|
4537
|
+
), Y = {
|
|
4511
4538
|
response: t.extend({
|
|
4512
|
-
data:
|
|
4539
|
+
data: Q
|
|
4513
4540
|
})
|
|
4514
|
-
},
|
|
4541
|
+
}, H = object({
|
|
4515
4542
|
id: uuid(),
|
|
4516
4543
|
nseSymbol: string(),
|
|
4517
4544
|
entryPrice: number(),
|
|
@@ -4530,7 +4557,7 @@ const p = object({
|
|
|
4530
4557
|
stopLossHit: boolean().optional(),
|
|
4531
4558
|
stopLossTimestamp: string().optional(),
|
|
4532
4559
|
timeToStopLossMinutes: number$1().optional()
|
|
4533
|
-
}),
|
|
4560
|
+
}), $ = {
|
|
4534
4561
|
params: object({
|
|
4535
4562
|
runId: uuid()
|
|
4536
4563
|
}),
|
|
@@ -4538,46 +4565,46 @@ const p = object({
|
|
|
4538
4565
|
targetGainPercentage: number().optional()
|
|
4539
4566
|
}),
|
|
4540
4567
|
response: t.extend({
|
|
4541
|
-
data: array(
|
|
4568
|
+
data: array(H)
|
|
4542
4569
|
})
|
|
4543
|
-
},
|
|
4570
|
+
}, F = object({
|
|
4544
4571
|
start_datetime: n,
|
|
4545
4572
|
end_datetime: n,
|
|
4546
4573
|
timezone: o.optional(),
|
|
4547
4574
|
name: string().optional(),
|
|
4548
4575
|
tags: array(string().min(1).max(50)).optional()
|
|
4549
|
-
}),
|
|
4576
|
+
}), B = object({
|
|
4550
4577
|
id: uuid(),
|
|
4551
4578
|
start_datetime: n,
|
|
4552
4579
|
end_datetime: n,
|
|
4553
4580
|
completed: boolean(),
|
|
4554
4581
|
name: string().nullable().optional(),
|
|
4555
4582
|
tags: array(string()).optional()
|
|
4556
|
-
}),
|
|
4557
|
-
body:
|
|
4583
|
+
}), K = {
|
|
4584
|
+
body: F,
|
|
4558
4585
|
response: t.extend({
|
|
4559
|
-
data:
|
|
4586
|
+
data: B
|
|
4560
4587
|
})
|
|
4561
|
-
},
|
|
4588
|
+
}, Z = object({
|
|
4562
4589
|
completed: boolean().optional(),
|
|
4563
4590
|
name: string().nullable().optional(),
|
|
4564
4591
|
tags: array(string().min(1).max(50)).optional()
|
|
4565
|
-
}),
|
|
4592
|
+
}), V = object({
|
|
4566
4593
|
id: uuid(),
|
|
4567
4594
|
start_datetime: string(),
|
|
4568
4595
|
end_datetime: string(),
|
|
4569
4596
|
completed: boolean(),
|
|
4570
4597
|
name: string().nullable().optional(),
|
|
4571
4598
|
tags: array(string()).optional()
|
|
4572
|
-
}),
|
|
4599
|
+
}), J = {
|
|
4573
4600
|
params: object({
|
|
4574
4601
|
runId: uuid()
|
|
4575
4602
|
}),
|
|
4576
|
-
body:
|
|
4603
|
+
body: Z,
|
|
4577
4604
|
response: t.extend({
|
|
4578
|
-
data:
|
|
4605
|
+
data: V
|
|
4579
4606
|
})
|
|
4580
|
-
},
|
|
4607
|
+
}, W = {
|
|
4581
4608
|
params: object({
|
|
4582
4609
|
runId: uuid()
|
|
4583
4610
|
}),
|
|
@@ -4586,14 +4613,14 @@ const p = object({
|
|
|
4586
4613
|
id: uuid()
|
|
4587
4614
|
})
|
|
4588
4615
|
})
|
|
4589
|
-
},
|
|
4616
|
+
}, X = object({
|
|
4590
4617
|
nseSymbol: string(),
|
|
4591
4618
|
entryPrice: number(),
|
|
4592
4619
|
stopLossPrice: number(),
|
|
4593
4620
|
takeProfitPrice: number(),
|
|
4594
4621
|
datetime: n,
|
|
4595
4622
|
timezone: o.optional()
|
|
4596
|
-
}),
|
|
4623
|
+
}), ee = object({
|
|
4597
4624
|
id: uuid(),
|
|
4598
4625
|
nseSymbol: string(),
|
|
4599
4626
|
entryPrice: number(),
|
|
@@ -4601,28 +4628,28 @@ const p = object({
|
|
|
4601
4628
|
takeProfitPrice: number(),
|
|
4602
4629
|
datetime: string(),
|
|
4603
4630
|
runId: uuid()
|
|
4604
|
-
}),
|
|
4631
|
+
}), te = {
|
|
4605
4632
|
params: object({
|
|
4606
4633
|
runId: uuid()
|
|
4607
4634
|
}),
|
|
4608
|
-
body:
|
|
4635
|
+
body: X,
|
|
4609
4636
|
response: t.extend({
|
|
4610
|
-
data:
|
|
4637
|
+
data: ee
|
|
4611
4638
|
})
|
|
4612
|
-
},
|
|
4639
|
+
}, ne = {
|
|
4613
4640
|
response: t.extend({
|
|
4614
4641
|
data: array(string())
|
|
4615
4642
|
})
|
|
4616
|
-
},
|
|
4643
|
+
}, oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4617
4644
|
__proto__: null,
|
|
4618
|
-
createOrder:
|
|
4619
|
-
createRun:
|
|
4620
|
-
deleteRun:
|
|
4621
|
-
getRunOrders:
|
|
4622
|
-
getRunTags:
|
|
4623
|
-
getRuns:
|
|
4624
|
-
updateRun:
|
|
4625
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4645
|
+
createOrder: te,
|
|
4646
|
+
createRun: K,
|
|
4647
|
+
deleteRun: W,
|
|
4648
|
+
getRunOrders: $,
|
|
4649
|
+
getRunTags: ne,
|
|
4650
|
+
getRuns: Y,
|
|
4651
|
+
updateRun: J
|
|
4652
|
+
}, Symbol.toStringTag, { value: "Module" })), ae = {
|
|
4626
4653
|
query: object({
|
|
4627
4654
|
datetime: n,
|
|
4628
4655
|
timezone: o.optional(),
|
|
@@ -4639,19 +4666,19 @@ const p = object({
|
|
|
4639
4666
|
}).nullable()
|
|
4640
4667
|
})
|
|
4641
4668
|
})
|
|
4642
|
-
},
|
|
4669
|
+
}, re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4643
4670
|
__proto__: null,
|
|
4644
|
-
getShortlists:
|
|
4645
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4671
|
+
getShortlists: ae
|
|
4672
|
+
}, Symbol.toStringTag, { value: "Module" })), ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4646
4673
|
__proto__: null,
|
|
4647
|
-
v1_dashboard_auth_schemas:
|
|
4648
|
-
v1_dashboard_available_datetimes_schemas:
|
|
4649
|
-
v1_dashboard_candles_schemas:
|
|
4650
|
-
v1_dashboard_daily_persistent_companies_schemas:
|
|
4651
|
-
v1_dashboard_daily_unique_companies_schemas:
|
|
4652
|
-
v1_dashboard_quote_timeline_schemas:
|
|
4653
|
-
v1_dashboard_runs_schemas:
|
|
4654
|
-
v1_dashboard_shortlists_schemas:
|
|
4674
|
+
v1_dashboard_auth_schemas: L,
|
|
4675
|
+
v1_dashboard_available_datetimes_schemas: z,
|
|
4676
|
+
v1_dashboard_candles_schemas: C,
|
|
4677
|
+
v1_dashboard_daily_persistent_companies_schemas: R,
|
|
4678
|
+
v1_dashboard_daily_unique_companies_schemas: k,
|
|
4679
|
+
v1_dashboard_quote_timeline_schemas: G,
|
|
4680
|
+
v1_dashboard_runs_schemas: oe,
|
|
4681
|
+
v1_dashboard_shortlists_schemas: re
|
|
4655
4682
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4656
4683
|
({
|
|
4657
4684
|
response: t.extend({
|
|
@@ -7940,7 +7967,7 @@ const fetchCandles = ({
|
|
|
7940
7967
|
);
|
|
7941
7968
|
}
|
|
7942
7969
|
try {
|
|
7943
|
-
const validatedParams =
|
|
7970
|
+
const validatedParams = je.getGrowwHistoricalCandles.query.parse(params);
|
|
7944
7971
|
const headers = {
|
|
7945
7972
|
Authorization: `Bearer ${developerToken}`
|
|
7946
7973
|
};
|
|
@@ -7984,7 +8011,7 @@ const fetchQuote = ({
|
|
|
7984
8011
|
);
|
|
7985
8012
|
}
|
|
7986
8013
|
try {
|
|
7987
|
-
const validatedParams =
|
|
8014
|
+
const validatedParams = je.getGrowwQuote.query.parse(params);
|
|
7988
8015
|
const headers = {
|
|
7989
8016
|
Authorization: `Bearer ${developerToken}`
|
|
7990
8017
|
};
|
|
@@ -8024,7 +8051,7 @@ const fetchQuoteTimeline = ({
|
|
|
8024
8051
|
throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
|
|
8025
8052
|
}
|
|
8026
8053
|
try {
|
|
8027
|
-
const validatedParams =
|
|
8054
|
+
const validatedParams = je.getGrowwQuoteTimeline.query.parse({
|
|
8028
8055
|
symbol,
|
|
8029
8056
|
date: date2
|
|
8030
8057
|
});
|
|
@@ -8071,7 +8098,7 @@ const fetchShortlist = ({
|
|
|
8071
8098
|
);
|
|
8072
8099
|
}
|
|
8073
8100
|
try {
|
|
8074
|
-
const validatedParams =
|
|
8101
|
+
const validatedParams = he.getLists.query.parse(queryParams);
|
|
8075
8102
|
const headers = {
|
|
8076
8103
|
Authorization: `Bearer ${developerToken}`
|
|
8077
8104
|
};
|
|
@@ -8102,6 +8129,52 @@ const fetchShortlist = ({
|
|
|
8102
8129
|
};
|
|
8103
8130
|
dayjs.extend(utc);
|
|
8104
8131
|
dayjs.extend(timezone);
|
|
8132
|
+
const fetchShortlistPersistence = ({
|
|
8133
|
+
developerToken,
|
|
8134
|
+
apiDomain,
|
|
8135
|
+
runId,
|
|
8136
|
+
currentTimestamp,
|
|
8137
|
+
currentTimezone = "Asia/Kolkata"
|
|
8138
|
+
}) => async (queryParams) => {
|
|
8139
|
+
if (!developerToken) {
|
|
8140
|
+
throw new Error(
|
|
8141
|
+
"Developer token not found. Please set DEVELOPER_TOKEN environment variable."
|
|
8142
|
+
);
|
|
8143
|
+
}
|
|
8144
|
+
try {
|
|
8145
|
+
const validatedParams = Se.getShortlistPersistence.query.parse(queryParams);
|
|
8146
|
+
const headers = {
|
|
8147
|
+
Authorization: `Bearer ${developerToken}`
|
|
8148
|
+
};
|
|
8149
|
+
if (runId) {
|
|
8150
|
+
headers["X-Run-Id"] = runId;
|
|
8151
|
+
}
|
|
8152
|
+
if (currentTimestamp) {
|
|
8153
|
+
headers["X-Current-Timestamp"] = currentTimestamp;
|
|
8154
|
+
}
|
|
8155
|
+
if (currentTimezone) {
|
|
8156
|
+
headers["X-Current-Timezone"] = currentTimezone;
|
|
8157
|
+
}
|
|
8158
|
+
const response = await axios.get(`${apiDomain}/v1/developer/shortlists/persistence`, {
|
|
8159
|
+
params: validatedParams,
|
|
8160
|
+
headers
|
|
8161
|
+
});
|
|
8162
|
+
return response.data.data;
|
|
8163
|
+
} catch (error) {
|
|
8164
|
+
if (axios.isAxiosError(error)) {
|
|
8165
|
+
logger.error(
|
|
8166
|
+
`Error fetching shortlist persistence for ${queryParams.type}: ${error.message}`
|
|
8167
|
+
);
|
|
8168
|
+
throw new Error(
|
|
8169
|
+
`Failed to fetch shortlist persistence: ${error.response?.data?.message || error.message}`
|
|
8170
|
+
);
|
|
8171
|
+
}
|
|
8172
|
+
logger.error(`Unexpected error fetching shortlist persistence: ${error}`);
|
|
8173
|
+
throw error;
|
|
8174
|
+
}
|
|
8175
|
+
};
|
|
8176
|
+
dayjs.extend(utc);
|
|
8177
|
+
dayjs.extend(timezone);
|
|
8105
8178
|
const fetchNiftyQuote = ({
|
|
8106
8179
|
developerToken,
|
|
8107
8180
|
apiDomain,
|
|
@@ -8113,7 +8186,7 @@ const fetchNiftyQuote = ({
|
|
|
8113
8186
|
throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
|
|
8114
8187
|
}
|
|
8115
8188
|
try {
|
|
8116
|
-
const validatedParams =
|
|
8189
|
+
const validatedParams = je.getGrowwNiftyQuote.query.parse(params);
|
|
8117
8190
|
const headers = {
|
|
8118
8191
|
Authorization: `Bearer ${developerToken}`
|
|
8119
8192
|
};
|
|
@@ -8220,7 +8293,7 @@ const placeOrder = ({ runId, apiClient }) => async (data) => {
|
|
|
8220
8293
|
try {
|
|
8221
8294
|
await retryWithBackoff(
|
|
8222
8295
|
async () => {
|
|
8223
|
-
const validatedData =
|
|
8296
|
+
const validatedData = ve.v1_dashboard_runs_schemas.createOrder.body.parse(data);
|
|
8224
8297
|
await apiClient.post(`/v1/dashboard/runs/${runId}/orders`, validatedData);
|
|
8225
8298
|
logger.debug(`Order persisted for ${data.nseSymbol} in runId: ${runId}`);
|
|
8226
8299
|
},
|
|
@@ -8566,6 +8639,13 @@ async function ganaka({
|
|
|
8566
8639
|
currentTimestamp,
|
|
8567
8640
|
currentTimezone: "Asia/Kolkata"
|
|
8568
8641
|
}),
|
|
8642
|
+
fetchShortlistPersistence: fetchShortlistPersistence({
|
|
8643
|
+
developerToken,
|
|
8644
|
+
apiDomain,
|
|
8645
|
+
runId,
|
|
8646
|
+
currentTimestamp,
|
|
8647
|
+
currentTimezone: "Asia/Kolkata"
|
|
8648
|
+
}),
|
|
8569
8649
|
currentTimestamp
|
|
8570
8650
|
});
|
|
8571
8651
|
}
|