@ganaka/sdk 1.1.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 +84 -2
- package/dist/index.js +191 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +191 -92
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,8 @@ declare const createRun: {
|
|
|
49
49
|
start_datetime: z.ZodString;
|
|
50
50
|
end_datetime: z.ZodString;
|
|
51
51
|
timezone: z.ZodOptional<z.ZodString>;
|
|
52
|
+
name: z.ZodOptional<z.ZodString>;
|
|
53
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
54
|
}, z.core.$strip>;
|
|
53
55
|
response: z.ZodObject<{
|
|
54
56
|
statusCode: z.ZodNumber;
|
|
@@ -58,6 +60,8 @@ declare const createRun: {
|
|
|
58
60
|
start_datetime: z.ZodString;
|
|
59
61
|
end_datetime: z.ZodString;
|
|
60
62
|
completed: z.ZodBoolean;
|
|
63
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
64
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
65
|
}, z.core.$strip>;
|
|
62
66
|
}, z.core.$strip>;
|
|
63
67
|
};
|
|
@@ -127,9 +131,17 @@ declare const fetchShortlist: ({ developerToken, apiDomain, runId, currentTimest
|
|
|
127
131
|
currentTimezone?: string;
|
|
128
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>;
|
|
129
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
|
+
|
|
130
142
|
export declare type FetchShortlistResponse = Awaited<ReturnType<ReturnType<typeof fetchShortlist>>>;
|
|
131
143
|
|
|
132
|
-
export declare function ganaka<T>({ fn, startTime, endTime, intervalMinutes, deleteRunAfterCompletion, }: {
|
|
144
|
+
export declare function ganaka<T>({ fn, startTime, endTime, intervalMinutes, deleteRunAfterCompletion, name, tags, }: {
|
|
133
145
|
fn: (context: RunContext) => Promise<T>;
|
|
134
146
|
/** Start time in IST string format (YYYY-MM-DDTHH:mm:ss) */
|
|
135
147
|
startTime: string;
|
|
@@ -142,6 +154,14 @@ export declare function ganaka<T>({ fn, startTime, endTime, intervalMinutes, del
|
|
|
142
154
|
* @default false
|
|
143
155
|
*/
|
|
144
156
|
deleteRunAfterCompletion?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Optional name for the run
|
|
159
|
+
*/
|
|
160
|
+
name?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Optional array of tags to classify and group the run
|
|
163
|
+
*/
|
|
164
|
+
tags?: string[];
|
|
145
165
|
}): Promise<void>;
|
|
146
166
|
|
|
147
167
|
declare const getAvailableDatetimes: {
|
|
@@ -620,10 +640,52 @@ declare const getRuns: {
|
|
|
620
640
|
end_datetime: z.ZodString;
|
|
621
641
|
completed: z.ZodBoolean;
|
|
622
642
|
orderCount: z.ZodNumber;
|
|
643
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
644
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
623
645
|
}, z.core.$strip>>>;
|
|
624
646
|
}, z.core.$strip>;
|
|
625
647
|
};
|
|
626
648
|
|
|
649
|
+
declare const getRunTags: {
|
|
650
|
+
response: z.ZodObject<{
|
|
651
|
+
statusCode: z.ZodNumber;
|
|
652
|
+
message: z.ZodString;
|
|
653
|
+
data: z.ZodArray<z.ZodString>;
|
|
654
|
+
}, z.core.$strip>;
|
|
655
|
+
};
|
|
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
|
+
|
|
627
689
|
declare const getShortlists: {
|
|
628
690
|
query: z.ZodObject<{
|
|
629
691
|
datetime: z.ZodString;
|
|
@@ -829,6 +891,15 @@ export declare interface RunContext {
|
|
|
829
891
|
fetchNiftyQuote: ReturnType<typeof fetchNiftyQuote>;
|
|
830
892
|
fetchQuoteTimeline: ReturnType<typeof fetchQuoteTimeline>;
|
|
831
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>;
|
|
832
903
|
/**
|
|
833
904
|
* Current timestamp in IST string format (YYYY-MM-DDTHH:mm:ss)
|
|
834
905
|
* for every loop iteration
|
|
@@ -856,6 +927,8 @@ declare const updateRun: {
|
|
|
856
927
|
}, z.core.$strip>;
|
|
857
928
|
body: z.ZodObject<{
|
|
858
929
|
completed: z.ZodOptional<z.ZodBoolean>;
|
|
930
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
931
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
859
932
|
}, z.core.$strip>;
|
|
860
933
|
response: z.ZodObject<{
|
|
861
934
|
statusCode: z.ZodNumber;
|
|
@@ -865,6 +938,8 @@ declare const updateRun: {
|
|
|
865
938
|
start_datetime: z.ZodString;
|
|
866
939
|
end_datetime: z.ZodString;
|
|
867
940
|
completed: z.ZodBoolean;
|
|
941
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
942
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
868
943
|
}, z.core.$strip>;
|
|
869
944
|
}, z.core.$strip>;
|
|
870
945
|
};
|
|
@@ -912,7 +987,8 @@ declare namespace v1_dashboard_runs_schemas {
|
|
|
912
987
|
createRun,
|
|
913
988
|
updateRun,
|
|
914
989
|
deleteRun,
|
|
915
|
-
createOrder
|
|
990
|
+
createOrder,
|
|
991
|
+
getRunTags
|
|
916
992
|
}
|
|
917
993
|
}
|
|
918
994
|
|
|
@@ -953,4 +1029,10 @@ declare namespace v1_developer_lists_schemas {
|
|
|
953
1029
|
}
|
|
954
1030
|
}
|
|
955
1031
|
|
|
1032
|
+
declare namespace v1_developer_shortlist_persistence_schemas {
|
|
1033
|
+
export {
|
|
1034
|
+
getShortlistPersistence
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
|
|
956
1038
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -4110,7 +4110,7 @@ const t$1 = [
|
|
|
4110
4110
|
"TOP_GAINERS",
|
|
4111
4111
|
"VOLUME_SHOCKERS"
|
|
4112
4112
|
];
|
|
4113
|
-
const
|
|
4113
|
+
const _ = object({
|
|
4114
4114
|
average_price: number$1().nullable(),
|
|
4115
4115
|
bid_quantity: number$1().nullable(),
|
|
4116
4116
|
bid_price: number$1().nullable(),
|
|
@@ -4158,7 +4158,7 @@ const g = object({
|
|
|
4158
4158
|
week_52_low: number$1().nullable()
|
|
4159
4159
|
}), a = object({
|
|
4160
4160
|
status: _enum(["SUCCESS", "FAILURE"]),
|
|
4161
|
-
payload:
|
|
4161
|
+
payload: _
|
|
4162
4162
|
}), y = object({
|
|
4163
4163
|
nseSymbol: string(),
|
|
4164
4164
|
name: string(),
|
|
@@ -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(),
|
|
@@ -4322,7 +4322,7 @@ const p = object({
|
|
|
4322
4322
|
response: t.extend({
|
|
4323
4323
|
data: string()
|
|
4324
4324
|
})
|
|
4325
|
-
},
|
|
4325
|
+
}, x = {
|
|
4326
4326
|
query: object({
|
|
4327
4327
|
symbol: string(),
|
|
4328
4328
|
date: i
|
|
@@ -4344,7 +4344,7 @@ const p = object({
|
|
|
4344
4344
|
)
|
|
4345
4345
|
})
|
|
4346
4346
|
})
|
|
4347
|
-
},
|
|
4347
|
+
}, P = {
|
|
4348
4348
|
query: object({
|
|
4349
4349
|
datetime: n.optional(),
|
|
4350
4350
|
timezone: o.optional()
|
|
@@ -4352,32 +4352,59 @@ 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:
|
|
4358
|
-
getGrowwNiftyQuote:
|
|
4359
|
-
getGrowwQuote:
|
|
4360
|
-
getGrowwQuoteTimeline:
|
|
4357
|
+
getGrowwHistoricalCandles: v,
|
|
4358
|
+
getGrowwNiftyQuote: P,
|
|
4359
|
+
getGrowwQuote: f,
|
|
4360
|
+
getGrowwQuoteTimeline: x,
|
|
4361
4361
|
getGrowwToken: T,
|
|
4362
4362
|
growwHistoricalCandlesSchema: p
|
|
4363
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4363
|
+
}, Symbol.toStringTag, { value: "Module" })), g = 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(),
|
|
4371
4371
|
timezone: o.optional()
|
|
4372
4372
|
}),
|
|
4373
4373
|
response: t.extend({
|
|
4374
|
-
data: array(
|
|
4374
|
+
data: array(g).nullable()
|
|
4375
4375
|
})
|
|
4376
|
-
},
|
|
4376
|
+
}, he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4377
4377
|
__proto__: null,
|
|
4378
|
-
getLists:
|
|
4379
|
-
listSchema:
|
|
4380
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4378
|
+
getLists: O,
|
|
4379
|
+
listSchema: g
|
|
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,9 +4466,9 @@ const p = object({
|
|
|
4439
4466
|
)
|
|
4440
4467
|
})
|
|
4441
4468
|
})
|
|
4442
|
-
},
|
|
4469
|
+
}, R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4443
4470
|
__proto__: null,
|
|
4444
|
-
getDailyPersistentCompanies:
|
|
4471
|
+
getDailyPersistentCompanies: M
|
|
4445
4472
|
}, Symbol.toStringTag, { value: "Module" })), A = {
|
|
4446
4473
|
query: object({
|
|
4447
4474
|
date: i,
|
|
@@ -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
4486
|
getDailyUniqueCompanies: A
|
|
4460
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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,24 +4519,26 @@ 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(),
|
|
4502
4529
|
completed: boolean(),
|
|
4503
|
-
orderCount: number$1()
|
|
4504
|
-
|
|
4530
|
+
orderCount: number$1(),
|
|
4531
|
+
name: string().nullable().optional(),
|
|
4532
|
+
tags: array(string()).optional()
|
|
4533
|
+
}), Q = record(
|
|
4505
4534
|
string(),
|
|
4506
4535
|
// date string (YYYY-MM-DD)
|
|
4507
|
-
array(
|
|
4508
|
-
),
|
|
4536
|
+
array(U)
|
|
4537
|
+
), Y = {
|
|
4509
4538
|
response: t.extend({
|
|
4510
|
-
data:
|
|
4539
|
+
data: Q
|
|
4511
4540
|
})
|
|
4512
|
-
},
|
|
4541
|
+
}, H = object({
|
|
4513
4542
|
id: uuid(),
|
|
4514
4543
|
nseSymbol: string(),
|
|
4515
4544
|
entryPrice: number(),
|
|
@@ -4528,7 +4557,7 @@ const p = object({
|
|
|
4528
4557
|
stopLossHit: boolean().optional(),
|
|
4529
4558
|
stopLossTimestamp: string().optional(),
|
|
4530
4559
|
timeToStopLossMinutes: number$1().optional()
|
|
4531
|
-
}),
|
|
4560
|
+
}), $ = {
|
|
4532
4561
|
params: object({
|
|
4533
4562
|
runId: uuid()
|
|
4534
4563
|
}),
|
|
@@ -4536,38 +4565,46 @@ const p = object({
|
|
|
4536
4565
|
targetGainPercentage: number().optional()
|
|
4537
4566
|
}),
|
|
4538
4567
|
response: t.extend({
|
|
4539
|
-
data: array(
|
|
4568
|
+
data: array(H)
|
|
4540
4569
|
})
|
|
4541
|
-
},
|
|
4570
|
+
}, F = object({
|
|
4542
4571
|
start_datetime: n,
|
|
4543
4572
|
end_datetime: n,
|
|
4544
|
-
timezone: o.optional()
|
|
4545
|
-
|
|
4573
|
+
timezone: o.optional(),
|
|
4574
|
+
name: string().optional(),
|
|
4575
|
+
tags: array(string().min(1).max(50)).optional()
|
|
4576
|
+
}), B = object({
|
|
4546
4577
|
id: uuid(),
|
|
4547
4578
|
start_datetime: n,
|
|
4548
4579
|
end_datetime: n,
|
|
4549
|
-
completed: boolean()
|
|
4550
|
-
|
|
4551
|
-
|
|
4580
|
+
completed: boolean(),
|
|
4581
|
+
name: string().nullable().optional(),
|
|
4582
|
+
tags: array(string()).optional()
|
|
4583
|
+
}), K = {
|
|
4584
|
+
body: F,
|
|
4552
4585
|
response: t.extend({
|
|
4553
|
-
data:
|
|
4586
|
+
data: B
|
|
4554
4587
|
})
|
|
4555
|
-
},
|
|
4556
|
-
completed: boolean().optional()
|
|
4557
|
-
|
|
4588
|
+
}, Z = object({
|
|
4589
|
+
completed: boolean().optional(),
|
|
4590
|
+
name: string().nullable().optional(),
|
|
4591
|
+
tags: array(string().min(1).max(50)).optional()
|
|
4592
|
+
}), V = object({
|
|
4558
4593
|
id: uuid(),
|
|
4559
4594
|
start_datetime: string(),
|
|
4560
4595
|
end_datetime: string(),
|
|
4561
|
-
completed: boolean()
|
|
4562
|
-
|
|
4596
|
+
completed: boolean(),
|
|
4597
|
+
name: string().nullable().optional(),
|
|
4598
|
+
tags: array(string()).optional()
|
|
4599
|
+
}), J = {
|
|
4563
4600
|
params: object({
|
|
4564
4601
|
runId: uuid()
|
|
4565
4602
|
}),
|
|
4566
|
-
body:
|
|
4603
|
+
body: Z,
|
|
4567
4604
|
response: t.extend({
|
|
4568
|
-
data:
|
|
4605
|
+
data: V
|
|
4569
4606
|
})
|
|
4570
|
-
},
|
|
4607
|
+
}, W = {
|
|
4571
4608
|
params: object({
|
|
4572
4609
|
runId: uuid()
|
|
4573
4610
|
}),
|
|
@@ -4576,14 +4613,14 @@ const p = object({
|
|
|
4576
4613
|
id: uuid()
|
|
4577
4614
|
})
|
|
4578
4615
|
})
|
|
4579
|
-
},
|
|
4616
|
+
}, X = object({
|
|
4580
4617
|
nseSymbol: string(),
|
|
4581
4618
|
entryPrice: number(),
|
|
4582
4619
|
stopLossPrice: number(),
|
|
4583
4620
|
takeProfitPrice: number(),
|
|
4584
4621
|
datetime: n,
|
|
4585
4622
|
timezone: o.optional()
|
|
4586
|
-
}),
|
|
4623
|
+
}), ee = object({
|
|
4587
4624
|
id: uuid(),
|
|
4588
4625
|
nseSymbol: string(),
|
|
4589
4626
|
entryPrice: number(),
|
|
@@ -4591,23 +4628,28 @@ const p = object({
|
|
|
4591
4628
|
takeProfitPrice: number(),
|
|
4592
4629
|
datetime: string(),
|
|
4593
4630
|
runId: uuid()
|
|
4594
|
-
}),
|
|
4631
|
+
}), te = {
|
|
4595
4632
|
params: object({
|
|
4596
4633
|
runId: uuid()
|
|
4597
4634
|
}),
|
|
4598
|
-
body:
|
|
4635
|
+
body: X,
|
|
4636
|
+
response: t.extend({
|
|
4637
|
+
data: ee
|
|
4638
|
+
})
|
|
4639
|
+
}, ne = {
|
|
4599
4640
|
response: t.extend({
|
|
4600
|
-
data:
|
|
4641
|
+
data: array(string())
|
|
4601
4642
|
})
|
|
4602
|
-
},
|
|
4643
|
+
}, oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4603
4644
|
__proto__: null,
|
|
4604
|
-
createOrder:
|
|
4605
|
-
createRun:
|
|
4606
|
-
deleteRun:
|
|
4607
|
-
getRunOrders:
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
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 = {
|
|
4611
4653
|
query: object({
|
|
4612
4654
|
datetime: n,
|
|
4613
4655
|
timezone: o.optional(),
|
|
@@ -4624,19 +4666,19 @@ const p = object({
|
|
|
4624
4666
|
}).nullable()
|
|
4625
4667
|
})
|
|
4626
4668
|
})
|
|
4627
|
-
},
|
|
4669
|
+
}, re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4628
4670
|
__proto__: null,
|
|
4629
|
-
getShortlists:
|
|
4630
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4671
|
+
getShortlists: ae
|
|
4672
|
+
}, Symbol.toStringTag, { value: "Module" })), ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4631
4673
|
__proto__: null,
|
|
4632
|
-
v1_dashboard_auth_schemas:
|
|
4633
|
-
v1_dashboard_available_datetimes_schemas:
|
|
4634
|
-
v1_dashboard_candles_schemas:
|
|
4635
|
-
v1_dashboard_daily_persistent_companies_schemas:
|
|
4636
|
-
v1_dashboard_daily_unique_companies_schemas:
|
|
4637
|
-
v1_dashboard_quote_timeline_schemas:
|
|
4638
|
-
v1_dashboard_runs_schemas:
|
|
4639
|
-
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
|
|
4640
4682
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4641
4683
|
({
|
|
4642
4684
|
response: t.extend({
|
|
@@ -7925,7 +7967,7 @@ const fetchCandles = ({
|
|
|
7925
7967
|
);
|
|
7926
7968
|
}
|
|
7927
7969
|
try {
|
|
7928
|
-
const validatedParams =
|
|
7970
|
+
const validatedParams = je.getGrowwHistoricalCandles.query.parse(params);
|
|
7929
7971
|
const headers = {
|
|
7930
7972
|
Authorization: `Bearer ${developerToken}`
|
|
7931
7973
|
};
|
|
@@ -7969,7 +8011,7 @@ const fetchQuote = ({
|
|
|
7969
8011
|
);
|
|
7970
8012
|
}
|
|
7971
8013
|
try {
|
|
7972
|
-
const validatedParams =
|
|
8014
|
+
const validatedParams = je.getGrowwQuote.query.parse(params);
|
|
7973
8015
|
const headers = {
|
|
7974
8016
|
Authorization: `Bearer ${developerToken}`
|
|
7975
8017
|
};
|
|
@@ -8009,7 +8051,7 @@ const fetchQuoteTimeline = ({
|
|
|
8009
8051
|
throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
|
|
8010
8052
|
}
|
|
8011
8053
|
try {
|
|
8012
|
-
const validatedParams =
|
|
8054
|
+
const validatedParams = je.getGrowwQuoteTimeline.query.parse({
|
|
8013
8055
|
symbol,
|
|
8014
8056
|
date: date2
|
|
8015
8057
|
});
|
|
@@ -8056,7 +8098,7 @@ const fetchShortlist = ({
|
|
|
8056
8098
|
);
|
|
8057
8099
|
}
|
|
8058
8100
|
try {
|
|
8059
|
-
const validatedParams =
|
|
8101
|
+
const validatedParams = he.getLists.query.parse(queryParams);
|
|
8060
8102
|
const headers = {
|
|
8061
8103
|
Authorization: `Bearer ${developerToken}`
|
|
8062
8104
|
};
|
|
@@ -8087,6 +8129,52 @@ const fetchShortlist = ({
|
|
|
8087
8129
|
};
|
|
8088
8130
|
dayjs.extend(utc);
|
|
8089
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);
|
|
8090
8178
|
const fetchNiftyQuote = ({
|
|
8091
8179
|
developerToken,
|
|
8092
8180
|
apiDomain,
|
|
@@ -8098,7 +8186,7 @@ const fetchNiftyQuote = ({
|
|
|
8098
8186
|
throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
|
|
8099
8187
|
}
|
|
8100
8188
|
try {
|
|
8101
|
-
const validatedParams =
|
|
8189
|
+
const validatedParams = je.getGrowwNiftyQuote.query.parse(params);
|
|
8102
8190
|
const headers = {
|
|
8103
8191
|
Authorization: `Bearer ${developerToken}`
|
|
8104
8192
|
};
|
|
@@ -8205,7 +8293,7 @@ const placeOrder = ({ runId, apiClient }) => async (data) => {
|
|
|
8205
8293
|
try {
|
|
8206
8294
|
await retryWithBackoff(
|
|
8207
8295
|
async () => {
|
|
8208
|
-
const validatedData =
|
|
8296
|
+
const validatedData = ve.v1_dashboard_runs_schemas.createOrder.body.parse(data);
|
|
8209
8297
|
await apiClient.post(`/v1/dashboard/runs/${runId}/orders`, validatedData);
|
|
8210
8298
|
logger.debug(`Order persisted for ${data.nseSymbol} in runId: ${runId}`);
|
|
8211
8299
|
},
|
|
@@ -8464,7 +8552,9 @@ async function ganaka({
|
|
|
8464
8552
|
startTime,
|
|
8465
8553
|
endTime,
|
|
8466
8554
|
intervalMinutes = 1,
|
|
8467
|
-
deleteRunAfterCompletion = false
|
|
8555
|
+
deleteRunAfterCompletion = false,
|
|
8556
|
+
name,
|
|
8557
|
+
tags
|
|
8468
8558
|
}) {
|
|
8469
8559
|
const developerToken = process.env.DEVELOPER_KEY;
|
|
8470
8560
|
const apiDomain = process.env.API_DOMAIN || "https://api.ganaka.live";
|
|
@@ -8483,7 +8573,9 @@ async function ganaka({
|
|
|
8483
8573
|
const createRunBody = {
|
|
8484
8574
|
start_datetime: startTime,
|
|
8485
8575
|
end_datetime: endTime,
|
|
8486
|
-
timezone: "Asia/Kolkata"
|
|
8576
|
+
timezone: "Asia/Kolkata",
|
|
8577
|
+
...name !== void 0 && { name },
|
|
8578
|
+
...tags !== void 0 && { tags }
|
|
8487
8579
|
};
|
|
8488
8580
|
try {
|
|
8489
8581
|
const createRunResponse = await apiClient.post("/v1/dashboard/runs", createRunBody);
|
|
@@ -8547,6 +8639,13 @@ async function ganaka({
|
|
|
8547
8639
|
currentTimestamp,
|
|
8548
8640
|
currentTimezone: "Asia/Kolkata"
|
|
8549
8641
|
}),
|
|
8642
|
+
fetchShortlistPersistence: fetchShortlistPersistence({
|
|
8643
|
+
developerToken,
|
|
8644
|
+
apiDomain,
|
|
8645
|
+
runId,
|
|
8646
|
+
currentTimestamp,
|
|
8647
|
+
currentTimezone: "Asia/Kolkata"
|
|
8648
|
+
}),
|
|
8550
8649
|
currentTimestamp
|
|
8551
8650
|
});
|
|
8552
8651
|
}
|
|
@@ -8574,6 +8673,6 @@ async function ganaka({
|
|
|
8574
8673
|
}
|
|
8575
8674
|
}
|
|
8576
8675
|
exports.ganaka = ganaka;
|
|
8577
|
-
exports.growwQuotePayloadSchema =
|
|
8676
|
+
exports.growwQuotePayloadSchema = _;
|
|
8578
8677
|
exports.growwQuoteSchema = a;
|
|
8579
8678
|
//# sourceMappingURL=index.js.map
|