@ganaka/sdk 1.4.1 → 1.6.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.js CHANGED
@@ -8,9 +8,9 @@ function _mergeNamespaces(n2, m2) {
8
8
  if (typeof e !== "string" && !Array.isArray(e)) {
9
9
  for (const k2 in e) {
10
10
  if (k2 !== "default" && !(k2 in n2)) {
11
- const d2 = Object.getOwnPropertyDescriptor(e, k2);
12
- if (d2) {
13
- Object.defineProperty(n2, k2, d2.get ? d2 : {
11
+ const d = Object.getOwnPropertyDescriptor(e, k2);
12
+ if (d) {
13
+ Object.defineProperty(n2, k2, d.get ? d : {
14
14
  enumerable: true,
15
15
  get: () => e[k2]
16
16
  });
@@ -88,8 +88,8 @@ function config(newConfig) {
88
88
  return globalConfig;
89
89
  }
90
90
  function getEnumValues(entries) {
91
- const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
92
- const values = Object.entries(entries).filter(([k2, _2]) => numericValues.indexOf(+k2) === -1).map(([_2, v2]) => v2);
91
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
92
+ const values = Object.entries(entries).filter(([k2, _2]) => numericValues.indexOf(+k2) === -1).map(([_2, v]) => v);
93
93
  return values;
94
94
  }
95
95
  function jsonStringifyReplacer(_2, value) {
@@ -145,9 +145,9 @@ function defineLazy(object2, key, getter) {
145
145
  }
146
146
  return value;
147
147
  },
148
- set(v2) {
148
+ set(v) {
149
149
  Object.defineProperty(object2, key, {
150
- value: v2
150
+ value: v
151
151
  // configurable: true,
152
152
  });
153
153
  },
@@ -1227,10 +1227,10 @@ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
1227
1227
  v7: 7,
1228
1228
  v8: 8
1229
1229
  };
1230
- const v2 = versionMap[def.version];
1231
- if (v2 === void 0)
1230
+ const v = versionMap[def.version];
1231
+ if (v === void 0)
1232
1232
  throw new Error(`Invalid UUID version: "${def.version}"`);
1233
- def.pattern ?? (def.pattern = uuid$1(v2));
1233
+ def.pattern ?? (def.pattern = uuid$1(v));
1234
1234
  } else
1235
1235
  def.pattern ?? (def.pattern = uuid$1());
1236
1236
  $ZodStringFormat.init(inst, def);
@@ -1707,8 +1707,8 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1707
1707
  const field = shape[key]._zod;
1708
1708
  if (field.values) {
1709
1709
  propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1710
- for (const v2 of field.values)
1711
- propValues[key].add(v2);
1710
+ for (const v of field.values)
1711
+ propValues[key].add(v);
1712
1712
  }
1713
1713
  }
1714
1714
  return propValues;
@@ -2191,8 +2191,8 @@ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) =>
2191
2191
  const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
2192
2192
  $ZodType.init(inst, def);
2193
2193
  defineLazy(inst._zod, "values", () => {
2194
- const v2 = def.innerType._zod.values;
2195
- return v2 ? new Set([...v2].filter((x2) => x2 !== void 0)) : void 0;
2194
+ const v = def.innerType._zod.values;
2195
+ return v ? new Set([...v].filter((x2) => x2 !== void 0)) : void 0;
2196
2196
  });
2197
2197
  inst._zod.parse = (payload, ctx) => {
2198
2198
  const result = def.innerType._zod.run(payload, ctx);
@@ -3262,9 +3262,9 @@ const dateProcessor = (_schema, ctx, _json, _params) => {
3262
3262
  const enumProcessor = (schema, _ctx, json, _params) => {
3263
3263
  const def = schema._zod.def;
3264
3264
  const values = getEnumValues(def.entries);
3265
- if (values.every((v2) => typeof v2 === "number"))
3265
+ if (values.every((v) => typeof v === "number"))
3266
3266
  json.type = "number";
3267
- if (values.every((v2) => typeof v2 === "string"))
3267
+ if (values.every((v) => typeof v === "string"))
3268
3268
  json.type = "string";
3269
3269
  json.enum = values;
3270
3270
  };
@@ -3303,11 +3303,11 @@ const objectProcessor = (schema, ctx, _json, params) => {
3303
3303
  }
3304
3304
  const allKeys = new Set(Object.keys(shape));
3305
3305
  const requiredKeys = new Set([...allKeys].filter((key) => {
3306
- const v2 = def.shape[key]._zod;
3306
+ const v = def.shape[key]._zod;
3307
3307
  if (ctx.io === "input") {
3308
- return v2.optin === void 0;
3308
+ return v.optin === void 0;
3309
3309
  } else {
3310
- return v2.optout === void 0;
3310
+ return v.optout === void 0;
3311
3311
  }
3312
3312
  }));
3313
3313
  if (requiredKeys.size > 0) {
@@ -3938,7 +3938,7 @@ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
3938
3938
  };
3939
3939
  });
3940
3940
  function _enum(values, params) {
3941
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
3941
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
3942
3942
  return new ZodEnum({
3943
3943
  type: "enum",
3944
3944
  entries,
@@ -4109,8 +4109,11 @@ function number(params) {
4109
4109
  const t$1 = [
4110
4110
  "TOP_GAINERS",
4111
4111
  "VOLUME_SHOCKERS"
4112
+ ], o$1 = [
4113
+ "FULL",
4114
+ "TOP_5"
4112
4115
  ];
4113
- const _ = object({
4116
+ const S = object({
4114
4117
  average_price: number$1().nullable(),
4115
4118
  bid_quantity: number$1().nullable(),
4116
4119
  bid_price: number$1().nullable(),
@@ -4158,13 +4161,13 @@ const _ = object({
4158
4161
  week_52_low: number$1().nullable()
4159
4162
  }), a = object({
4160
4163
  status: _enum(["SUCCESS", "FAILURE"]),
4161
- payload: _
4162
- }), y = object({
4164
+ payload: S
4165
+ }), f = object({
4163
4166
  nseSymbol: string(),
4164
4167
  name: string(),
4165
4168
  price: number$1(),
4166
4169
  quoteData: a.nullable().optional()
4167
- }), t = object({
4170
+ }), m = _enum(o$1), t = object({
4168
4171
  statusCode: number$1(),
4169
4172
  message: string(),
4170
4173
  data: unknown()
@@ -4174,7 +4177,7 @@ object({
4174
4177
  statusCode: number$1(),
4175
4178
  message: string()
4176
4179
  });
4177
- const c = [
4180
+ const b = [
4178
4181
  "1minute",
4179
4182
  "2minute",
4180
4183
  "3minute",
@@ -4222,12 +4225,12 @@ const c = [
4222
4225
  {
4223
4226
  message: "timezone must be a valid IANA identifier or UTC offset"
4224
4227
  }
4225
- ), d = object({
4228
+ ), p = object({
4226
4229
  nseSymbol: string(),
4227
4230
  name: string(),
4228
4231
  price: number$1(),
4229
4232
  quoteData: a.nullable().optional()
4230
- }), m = _enum(["TOP_GAINERS", "VOLUME_SHOCKERS"]), b = object({
4233
+ }), c = _enum(["TOP_GAINERS", "VOLUME_SHOCKERS"]), g = _enum(o$1), _ = object({
4231
4234
  nseSymbol: string(),
4232
4235
  quoteData: a
4233
4236
  });
@@ -4236,8 +4239,9 @@ const c = [
4236
4239
  data: object({
4237
4240
  timestamp: n,
4238
4241
  timezone: o.optional(),
4239
- shortlistType: m,
4240
- entries: array(d)
4242
+ shortlistType: c,
4243
+ entries: array(p),
4244
+ scope: g.optional()
4241
4245
  })
4242
4246
  }),
4243
4247
  response: t.extend({
@@ -4245,7 +4249,7 @@ const c = [
4245
4249
  id: string(),
4246
4250
  timestamp: string(),
4247
4251
  // Format: YYYY-MM-DDTHH:mm:ss (UTC)
4248
- shortlistType: m,
4252
+ shortlistType: c,
4249
4253
  entriesCount: number$1()
4250
4254
  })
4251
4255
  })
@@ -4255,7 +4259,7 @@ const c = [
4255
4259
  data: object({
4256
4260
  timestamp: n,
4257
4261
  timezone: o.optional(),
4258
- quotes: array(b)
4262
+ quotes: array(_)
4259
4263
  })
4260
4264
  }),
4261
4265
  response: t.extend({
@@ -4284,7 +4288,7 @@ const c = [
4284
4288
  })
4285
4289
  })
4286
4290
  });
4287
- const p = object({
4291
+ const y = object({
4288
4292
  status: _enum(["SUCCESS", "FAILURE"]),
4289
4293
  payload: object({
4290
4294
  /**
@@ -4296,18 +4300,18 @@ const p = object({
4296
4300
  end_time: string(),
4297
4301
  interval_in_minutes: number$1()
4298
4302
  })
4299
- }), v = {
4303
+ }), x = {
4300
4304
  query: object({
4301
4305
  symbol: string(),
4302
- interval: _enum(c),
4306
+ interval: _enum(b),
4303
4307
  start_datetime: n,
4304
4308
  end_datetime: n,
4305
4309
  timezone: o.optional()
4306
4310
  }),
4307
4311
  response: t.extend({
4308
- data: p
4312
+ data: y
4309
4313
  })
4310
- }, f = {
4314
+ }, q = {
4311
4315
  query: object({
4312
4316
  symbol: string(),
4313
4317
  exchange: _enum(["NSE", "BSE"]).optional(),
@@ -4318,11 +4322,11 @@ const p = object({
4318
4322
  response: t.extend({
4319
4323
  data: a.nullable()
4320
4324
  })
4321
- }, T = {
4325
+ }, O = {
4322
4326
  response: t.extend({
4323
4327
  data: string()
4324
4328
  })
4325
- }, x = {
4329
+ }, w = {
4326
4330
  query: object({
4327
4331
  symbol: string(),
4328
4332
  end_datetime: n,
@@ -4345,7 +4349,28 @@ const p = object({
4345
4349
  )
4346
4350
  })
4347
4351
  })
4348
- }, P = {
4352
+ }, z = {
4353
+ query: object({
4354
+ end_datetime: n,
4355
+ timezone: o.optional()
4356
+ }),
4357
+ response: t.extend({
4358
+ data: object({
4359
+ niftyTimeline: array(
4360
+ object({
4361
+ id: string(),
4362
+ timestamp: string(),
4363
+ // Format: YYYY-MM-DDTHH:mm:ss (UTC)
4364
+ quoteData: a,
4365
+ createdAt: string(),
4366
+ // Format: YYYY-MM-DDTHH:mm:ss (UTC)
4367
+ updatedAt: string()
4368
+ // Format: YYYY-MM-DDTHH:mm:ss (UTC)
4369
+ })
4370
+ )
4371
+ })
4372
+ })
4373
+ }, M = {
4349
4374
  query: object({
4350
4375
  datetime: n.optional(),
4351
4376
  timezone: o.optional()
@@ -4353,37 +4378,40 @@ const p = object({
4353
4378
  response: t.extend({
4354
4379
  data: a.nullable()
4355
4380
  })
4356
- }, je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4381
+ }, Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4357
4382
  __proto__: null,
4358
- getGrowwHistoricalCandles: v,
4359
- getGrowwNiftyQuote: P,
4360
- getGrowwQuote: f,
4361
- getGrowwQuoteTimeline: x,
4362
- getGrowwToken: T,
4363
- growwHistoricalCandlesSchema: p
4364
- }, Symbol.toStringTag, { value: "Module" })), g = object({
4383
+ getGrowwHistoricalCandles: x,
4384
+ getGrowwNiftyQuote: M,
4385
+ getGrowwNiftyQuoteTimeline: z,
4386
+ getGrowwQuote: q,
4387
+ getGrowwQuoteTimeline: w,
4388
+ getGrowwToken: O,
4389
+ growwHistoricalCandlesSchema: y
4390
+ }, Symbol.toStringTag, { value: "Module" })), h = object({
4365
4391
  name: string(),
4366
4392
  price: number$1(),
4367
4393
  nseSymbol: string()
4368
- }), O = {
4394
+ }), D = {
4369
4395
  query: object({
4370
4396
  type: _enum(["top-gainers", "volume-shockers"]),
4371
4397
  datetime: n.optional(),
4372
- timezone: o.optional()
4398
+ timezone: o.optional(),
4399
+ scope: m.optional()
4373
4400
  }),
4374
4401
  response: t.extend({
4375
- data: array(g).nullable()
4402
+ data: array(h).nullable()
4376
4403
  })
4377
- }, he = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4404
+ }, Pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4378
4405
  __proto__: null,
4379
- getLists: O,
4380
- listSchema: g
4381
- }, Symbol.toStringTag, { value: "Module" })), q = {
4406
+ getLists: D,
4407
+ listSchema: h
4408
+ }, Symbol.toStringTag, { value: "Module" })), A = {
4382
4409
  query: object({
4383
4410
  type: _enum(["top-gainers", "volume-shockers"]),
4384
4411
  start_datetime: n,
4385
4412
  end_datetime: n,
4386
- timezone: o.optional()
4413
+ timezone: o.optional(),
4414
+ scope: m.optional()
4387
4415
  }),
4388
4416
  response: t.extend({
4389
4417
  data: object({
@@ -4402,10 +4430,10 @@ const p = object({
4402
4430
  )
4403
4431
  })
4404
4432
  })
4405
- }, Se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4433
+ }, xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4406
4434
  __proto__: null,
4407
- getShortlistPersistence: q
4408
- }, Symbol.toStringTag, { value: "Module" })), z = {
4435
+ getShortlistPersistence: A
4436
+ }, Symbol.toStringTag, { value: "Module" })), C = {
4409
4437
  query: object({}),
4410
4438
  response: t.extend({
4411
4439
  data: object({
@@ -4419,14 +4447,14 @@ const p = object({
4419
4447
  )
4420
4448
  })
4421
4449
  })
4422
- }, w = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4450
+ }, R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4423
4451
  __proto__: null,
4424
- getAvailableDatetimes: z
4425
- }, Symbol.toStringTag, { value: "Module" })), D = {
4452
+ getAvailableDatetimes: C
4453
+ }, Symbol.toStringTag, { value: "Module" })), k = {
4426
4454
  query: object({
4427
4455
  symbol: string(),
4428
4456
  date: i,
4429
- interval: _enum(c).optional()
4457
+ interval: _enum(b).optional()
4430
4458
  }),
4431
4459
  response: t.extend({
4432
4460
  data: object({
@@ -4444,10 +4472,10 @@ const p = object({
4444
4472
  interval_in_minutes: number$1()
4445
4473
  })
4446
4474
  })
4447
- }, C = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4475
+ }, E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4448
4476
  __proto__: null,
4449
- getCandles: D
4450
- }, Symbol.toStringTag, { value: "Module" })), M = {
4477
+ getCandles: k
4478
+ }, Symbol.toStringTag, { value: "Module" })), L = {
4451
4479
  query: object({
4452
4480
  date: i,
4453
4481
  type: _enum(t$1)
@@ -4467,10 +4495,10 @@ const p = object({
4467
4495
  )
4468
4496
  })
4469
4497
  })
4470
- }, R = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4498
+ }, I = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4471
4499
  __proto__: null,
4472
- getDailyPersistentCompanies: M
4473
- }, Symbol.toStringTag, { value: "Module" })), A = {
4500
+ getDailyPersistentCompanies: L
4501
+ }, Symbol.toStringTag, { value: "Module" })), N = {
4474
4502
  query: object({
4475
4503
  date: i,
4476
4504
  type: _enum(t$1)
@@ -4482,23 +4510,23 @@ const p = object({
4482
4510
  uniqueCount: number$1()
4483
4511
  })
4484
4512
  })
4485
- }, k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4513
+ }, G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4486
4514
  __proto__: null,
4487
- getDailyUniqueCompanies: A
4488
- }, Symbol.toStringTag, { value: "Module" })), E = object({
4515
+ getDailyUniqueCompanies: N
4516
+ }, Symbol.toStringTag, { value: "Module" })), Q = object({
4489
4517
  id: uuid(),
4490
4518
  username: string()
4491
- }), I = {
4519
+ }), U = {
4492
4520
  body: object({
4493
4521
  developerToken: string().nonempty("Developer token is required")
4494
4522
  }),
4495
4523
  response: t.extend({
4496
- data: E
4524
+ data: Q
4497
4525
  })
4498
- }, L = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4526
+ }, H = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4499
4527
  __proto__: null,
4500
- signIn: I
4501
- }, Symbol.toStringTag, { value: "Module" })), N = {
4528
+ signIn: U
4529
+ }, Symbol.toStringTag, { value: "Module" })), Y = {
4502
4530
  query: object({
4503
4531
  symbol: string(),
4504
4532
  date: i
@@ -4520,10 +4548,10 @@ const p = object({
4520
4548
  )
4521
4549
  })
4522
4550
  })
4523
- }, G = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4551
+ }, $ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4524
4552
  __proto__: null,
4525
- getQuoteTimeline: N
4526
- }, Symbol.toStringTag, { value: "Module" })), U = object({
4553
+ getQuoteTimeline: Y
4554
+ }, Symbol.toStringTag, { value: "Module" })), F = object({
4527
4555
  id: uuid(),
4528
4556
  start_datetime: string(),
4529
4557
  end_datetime: string(),
@@ -4531,15 +4559,15 @@ const p = object({
4531
4559
  orderCount: number$1(),
4532
4560
  name: string().nullable().optional(),
4533
4561
  tags: array(string()).optional()
4534
- }), Q = record(
4562
+ }), B = record(
4535
4563
  string(),
4536
4564
  // date string (YYYY-MM-DD)
4537
- array(U)
4538
- ), Y = {
4565
+ array(F)
4566
+ ), K = {
4539
4567
  response: t.extend({
4540
- data: Q
4568
+ data: B
4541
4569
  })
4542
- }, H = object({
4570
+ }, Z = object({
4543
4571
  id: uuid(),
4544
4572
  nseSymbol: string(),
4545
4573
  entryPrice: number(),
@@ -4558,7 +4586,7 @@ const p = object({
4558
4586
  stopLossHit: boolean().optional(),
4559
4587
  stopLossTimestamp: string().optional(),
4560
4588
  timeToStopLossMinutes: number$1().optional()
4561
- }), $ = {
4589
+ }), V = {
4562
4590
  params: object({
4563
4591
  runId: uuid()
4564
4592
  }),
@@ -4566,46 +4594,46 @@ const p = object({
4566
4594
  targetGainPercentage: number().optional()
4567
4595
  }),
4568
4596
  response: t.extend({
4569
- data: array(H)
4597
+ data: array(Z)
4570
4598
  })
4571
- }, F = object({
4599
+ }, W = object({
4572
4600
  start_datetime: n,
4573
4601
  end_datetime: n,
4574
4602
  timezone: o.optional(),
4575
4603
  name: string().optional(),
4576
4604
  tags: array(string().min(1).max(50)).optional()
4577
- }), B = object({
4605
+ }), J = object({
4578
4606
  id: uuid(),
4579
4607
  start_datetime: n,
4580
4608
  end_datetime: n,
4581
4609
  completed: boolean(),
4582
4610
  name: string().nullable().optional(),
4583
4611
  tags: array(string()).optional()
4584
- }), K = {
4585
- body: F,
4612
+ }), X = {
4613
+ body: W,
4586
4614
  response: t.extend({
4587
- data: B
4615
+ data: J
4588
4616
  })
4589
- }, Z = object({
4617
+ }, ee = object({
4590
4618
  completed: boolean().optional(),
4591
4619
  name: string().nullable().optional(),
4592
4620
  tags: array(string().min(1).max(50)).optional()
4593
- }), V = object({
4621
+ }), te = object({
4594
4622
  id: uuid(),
4595
4623
  start_datetime: string(),
4596
4624
  end_datetime: string(),
4597
4625
  completed: boolean(),
4598
4626
  name: string().nullable().optional(),
4599
4627
  tags: array(string()).optional()
4600
- }), J = {
4628
+ }), ne = {
4601
4629
  params: object({
4602
4630
  runId: uuid()
4603
4631
  }),
4604
- body: Z,
4632
+ body: ee,
4605
4633
  response: t.extend({
4606
- data: V
4634
+ data: te
4607
4635
  })
4608
- }, W = {
4636
+ }, oe = {
4609
4637
  params: object({
4610
4638
  runId: uuid()
4611
4639
  }),
@@ -4614,14 +4642,14 @@ const p = object({
4614
4642
  id: uuid()
4615
4643
  })
4616
4644
  })
4617
- }, X = object({
4645
+ }, ae = object({
4618
4646
  nseSymbol: string(),
4619
4647
  entryPrice: number(),
4620
4648
  stopLossPrice: number(),
4621
4649
  takeProfitPrice: number(),
4622
4650
  datetime: n,
4623
4651
  timezone: o.optional()
4624
- }), ee = object({
4652
+ }), re = object({
4625
4653
  id: uuid(),
4626
4654
  nseSymbol: string(),
4627
4655
  entryPrice: number(),
@@ -4629,32 +4657,47 @@ const p = object({
4629
4657
  takeProfitPrice: number(),
4630
4658
  datetime: string(),
4631
4659
  runId: uuid()
4632
- }), te = {
4660
+ }), se = {
4633
4661
  params: object({
4634
4662
  runId: uuid()
4635
4663
  }),
4636
- body: X,
4664
+ body: ae,
4637
4665
  response: t.extend({
4638
- data: ee
4666
+ data: re
4639
4667
  })
4640
- }, ne = {
4668
+ }, ie = {
4641
4669
  response: t.extend({
4642
4670
  data: array(string())
4643
4671
  })
4644
- }, oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4672
+ }, le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4645
4673
  __proto__: null,
4646
- createOrder: te,
4647
- createRun: K,
4648
- deleteRun: W,
4649
- getRunOrders: $,
4650
- getRunTags: ne,
4651
- getRuns: Y,
4652
- updateRun: J
4653
- }, Symbol.toStringTag, { value: "Module" })), ae = {
4674
+ createOrder: se,
4675
+ createRun: X,
4676
+ deleteRun: oe,
4677
+ getRunOrders: V,
4678
+ getRunTags: ie,
4679
+ getRuns: K,
4680
+ updateRun: ne
4681
+ }, Symbol.toStringTag, { value: "Module" })), j = f.extend({
4682
+ // Target and stop loss prices
4683
+ targetPrice: number$1().optional(),
4684
+ stopLossPrice: number$1().optional(),
4685
+ // Trade outcome
4686
+ targetAchieved: boolean().optional(),
4687
+ stopLossHit: boolean().optional(),
4688
+ // Timing information
4689
+ timeToTargetMinutes: number$1().optional(),
4690
+ timeToStopLossMinutes: number$1().optional(),
4691
+ targetTimestamp: string().optional(),
4692
+ stopLossTimestamp: string().optional()
4693
+ }), ue = {
4654
4694
  query: object({
4655
4695
  datetime: n,
4656
4696
  timezone: o.optional(),
4657
- type: _enum(t$1)
4697
+ type: _enum(t$1),
4698
+ scope: m.optional(),
4699
+ takeProfitPercentage: number().min(0).optional().default(2),
4700
+ stopLossPercentage: number().min(0).max(100).optional().default(1.5)
4658
4701
  }),
4659
4702
  response: t.extend({
4660
4703
  data: object({
@@ -4663,23 +4706,24 @@ const p = object({
4663
4706
  timestamp: string(),
4664
4707
  // Format: YYYY-MM-DDTHH:mm:ss (UTC)
4665
4708
  shortlistType: _enum(t$1),
4666
- entries: array(y)
4709
+ entries: array(j)
4667
4710
  }).nullable()
4668
4711
  })
4669
4712
  })
4670
- }, re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4713
+ }, ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4671
4714
  __proto__: null,
4672
- getShortlists: ae
4673
- }, Symbol.toStringTag, { value: "Module" })), ve = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4715
+ getShortlists: ue,
4716
+ shortlistEntryWithMetricsSchema: j
4717
+ }, Symbol.toStringTag, { value: "Module" })), qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4674
4718
  __proto__: null,
4675
- v1_dashboard_auth_schemas: L,
4676
- v1_dashboard_available_datetimes_schemas: w,
4677
- v1_dashboard_candles_schemas: C,
4678
- v1_dashboard_daily_persistent_companies_schemas: R,
4679
- v1_dashboard_daily_unique_companies_schemas: k,
4680
- v1_dashboard_quote_timeline_schemas: G,
4681
- v1_dashboard_runs_schemas: oe,
4682
- v1_dashboard_shortlists_schemas: re
4719
+ v1_dashboard_auth_schemas: H,
4720
+ v1_dashboard_available_datetimes_schemas: R,
4721
+ v1_dashboard_candles_schemas: E,
4722
+ v1_dashboard_daily_persistent_companies_schemas: I,
4723
+ v1_dashboard_daily_unique_companies_schemas: G,
4724
+ v1_dashboard_quote_timeline_schemas: $,
4725
+ v1_dashboard_runs_schemas: le,
4726
+ v1_dashboard_shortlists_schemas: ce
4683
4727
  }, Symbol.toStringTag, { value: "Module" }));
4684
4728
  ({
4685
4729
  response: t.extend({
@@ -4763,8 +4807,8 @@ function getAugmentedNamespace(n2) {
4763
4807
  } else a2 = {};
4764
4808
  Object.defineProperty(a2, "__esModule", { value: true });
4765
4809
  Object.keys(n2).forEach(function(k2) {
4766
- var d2 = Object.getOwnPropertyDescriptor(n2, k2);
4767
- Object.defineProperty(a2, k2, d2.get ? d2 : {
4810
+ var d = Object.getOwnPropertyDescriptor(n2, k2);
4811
+ Object.defineProperty(a2, k2, d.get ? d : {
4768
4812
  enumerable: true,
4769
4813
  get: function() {
4770
4814
  return n2[k2];
@@ -4819,10 +4863,10 @@ var utc$1 = { exports: {} };
4819
4863
  var o3 = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
4820
4864
  return (r2 = this.local().add(u2 + o3, t2)).$offset = u2, r2.$x.$localOffset = o3, r2;
4821
4865
  };
4822
- var h = u.format;
4866
+ var h2 = u.format;
4823
4867
  u.format = function(t3) {
4824
4868
  var i3 = t3 || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
4825
- return h.call(this, i3);
4869
+ return h2.call(this, i3);
4826
4870
  }, u.valueOf = function() {
4827
4871
  var t3 = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
4828
4872
  return this.$d.valueOf() - 6e4 * t3;
@@ -4868,8 +4912,8 @@ var timezone$1 = { exports: {} };
4868
4912
  var f3 = i3[u2], s2 = f3.type, m2 = f3.value, c2 = t2[s2];
4869
4913
  c2 >= 0 && (r2[c2] = parseInt(m2, 10));
4870
4914
  }
4871
- var d2 = r2[3], l2 = 24 === d2 ? 0 : d2, h = r2[0] + "-" + r2[1] + "-" + r2[2] + " " + l2 + ":" + r2[4] + ":" + r2[5] + ":000", v2 = +e2;
4872
- return (o2.utc(h).valueOf() - (v2 -= v2 % 1e3)) / 6e4;
4915
+ var d = r2[3], l2 = 24 === d ? 0 : d, h2 = r2[0] + "-" + r2[1] + "-" + r2[2] + " " + l2 + ":" + r2[4] + ":" + r2[5] + ":000", v = +e2;
4916
+ return (o2.utc(h2).valueOf() - (v -= v % 1e3)) / 6e4;
4873
4917
  }, f2 = i2.prototype;
4874
4918
  f2.tz = function(t3, e2) {
4875
4919
  void 0 === t3 && (t3 = r);
@@ -4899,8 +4943,8 @@ var timezone$1 = { exports: {} };
4899
4943
  if (e3 === o3) return [i4, e3];
4900
4944
  var r2 = u(i4 -= 60 * (o3 - e3) * 1e3, n4);
4901
4945
  return o3 === r2 ? [i4, o3] : [t4 - 60 * Math.min(o3, r2) * 1e3, Math.max(o3, r2)];
4902
- }(o2.utc(t3, i3).valueOf(), f3, a3), m2 = s2[0], c2 = s2[1], d2 = o2(m2).utcOffset(c2);
4903
- return d2.$x.$timezone = a3, d2;
4946
+ }(o2.utc(t3, i3).valueOf(), f3, a3), m2 = s2[0], c2 = s2[1], d = o2(m2).utcOffset(c2);
4947
+ return d.$x.$timezone = a3, d;
4904
4948
  }, o2.tz.guess = function() {
4905
4949
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
4906
4950
  }, o2.tz.setDefault = function(t3) {
@@ -5601,9 +5645,9 @@ class InterceptorManager {
5601
5645
  * @returns {void}
5602
5646
  */
5603
5647
  forEach(fn) {
5604
- utils$1.forEach(this.handlers, function forEachHandler(h) {
5605
- if (h !== null) {
5606
- fn(h);
5648
+ utils$1.forEach(this.handlers, function forEachHandler(h2) {
5649
+ if (h2 !== null) {
5650
+ fn(h2);
5607
5651
  }
5608
5652
  });
5609
5653
  }
@@ -7968,7 +8012,7 @@ const fetchCandles = ({
7968
8012
  );
7969
8013
  }
7970
8014
  try {
7971
- const validatedParams = je.getGrowwHistoricalCandles.query.parse(params);
8015
+ const validatedParams = Te.getGrowwHistoricalCandles.query.parse(params);
7972
8016
  const headers = {
7973
8017
  Authorization: `Bearer ${developerToken}`
7974
8018
  };
@@ -7981,7 +8025,7 @@ const fetchCandles = ({
7981
8025
  if (currentTimezone) {
7982
8026
  headers["X-Current-Timezone"] = currentTimezone;
7983
8027
  }
7984
- const response = await axios.get(`${apiDomain}/v1/developer/groww/historical-candles`, {
8028
+ const response = await axios.get(`${apiDomain}/v1/developer/historical-candles`, {
7985
8029
  params: validatedParams,
7986
8030
  headers
7987
8031
  });
@@ -8012,7 +8056,7 @@ const fetchQuote = ({
8012
8056
  );
8013
8057
  }
8014
8058
  try {
8015
- const validatedParams = je.getGrowwQuote.query.parse(params);
8059
+ const validatedParams = Te.getGrowwQuote.query.parse(params);
8016
8060
  const headers = {
8017
8061
  Authorization: `Bearer ${developerToken}`
8018
8062
  };
@@ -8025,7 +8069,7 @@ const fetchQuote = ({
8025
8069
  if (currentTimezone) {
8026
8070
  headers["X-Current-Timezone"] = currentTimezone;
8027
8071
  }
8028
- const response = await axios.get(`${apiDomain}/v1/developer/groww/quote`, {
8072
+ const response = await axios.get(`${apiDomain}/v1/developer/quote`, {
8029
8073
  params: validatedParams,
8030
8074
  headers
8031
8075
  });
@@ -8052,7 +8096,7 @@ const fetchQuoteTimeline = ({
8052
8096
  throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
8053
8097
  }
8054
8098
  try {
8055
- const validatedParams = je.getGrowwQuoteTimeline.query.parse({
8099
+ const validatedParams = Te.getGrowwQuoteTimeline.query.parse({
8056
8100
  symbol,
8057
8101
  end_datetime
8058
8102
  });
@@ -8068,7 +8112,7 @@ const fetchQuoteTimeline = ({
8068
8112
  if (currentTimezone) {
8069
8113
  headers["X-Current-Timezone"] = currentTimezone;
8070
8114
  }
8071
- const response = await axios.get(`${apiDomain}/v1/developer/groww/quote-timeline`, {
8115
+ const response = await axios.get(`${apiDomain}/v1/developer/quote-timeline`, {
8072
8116
  params: validatedParams,
8073
8117
  headers
8074
8118
  });
@@ -8099,7 +8143,7 @@ const fetchShortlist = ({
8099
8143
  );
8100
8144
  }
8101
8145
  try {
8102
- const validatedParams = he.getLists.query.parse(queryParams);
8146
+ const validatedParams = Pe.getLists.query.parse(queryParams);
8103
8147
  const headers = {
8104
8148
  Authorization: `Bearer ${developerToken}`
8105
8149
  };
@@ -8143,7 +8187,7 @@ const fetchShortlistPersistence = ({
8143
8187
  );
8144
8188
  }
8145
8189
  try {
8146
- const validatedParams = Se.getShortlistPersistence.query.parse(queryParams);
8190
+ const validatedParams = xe.getShortlistPersistence.query.parse(queryParams);
8147
8191
  const headers = {
8148
8192
  Authorization: `Bearer ${developerToken}`
8149
8193
  };
@@ -8187,7 +8231,7 @@ const fetchNiftyQuote = ({
8187
8231
  throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
8188
8232
  }
8189
8233
  try {
8190
- const validatedParams = je.getGrowwNiftyQuote.query.parse(params);
8234
+ const validatedParams = Te.getGrowwNiftyQuote.query.parse(params);
8191
8235
  const headers = {
8192
8236
  Authorization: `Bearer ${developerToken}`
8193
8237
  };
@@ -8200,7 +8244,7 @@ const fetchNiftyQuote = ({
8200
8244
  if (currentTimezone) {
8201
8245
  headers["X-Current-Timezone"] = currentTimezone;
8202
8246
  }
8203
- const response = await axios.get(`${apiDomain}/v1/developer/groww/nifty`, {
8247
+ const response = await axios.get(`${apiDomain}/v1/developer/nifty`, {
8204
8248
  params: validatedParams,
8205
8249
  headers
8206
8250
  });
@@ -8216,6 +8260,50 @@ const fetchNiftyQuote = ({
8216
8260
  throw error;
8217
8261
  }
8218
8262
  };
8263
+ dayjs.extend(utc);
8264
+ dayjs.extend(timezone);
8265
+ const fetchNiftyQuoteTimeline = ({
8266
+ developerToken,
8267
+ apiDomain,
8268
+ runId,
8269
+ currentTimestamp,
8270
+ currentTimezone = "Asia/Kolkata"
8271
+ }) => async (end_datetime) => {
8272
+ if (!developerToken) {
8273
+ throw new Error("Developer token not found. Please set DEVELOPER_KEY environment variable.");
8274
+ }
8275
+ try {
8276
+ const validatedParams = Te.getGrowwNiftyQuoteTimeline.query.parse({
8277
+ end_datetime
8278
+ });
8279
+ const headers = {
8280
+ Authorization: `Bearer ${developerToken}`
8281
+ };
8282
+ if (runId) {
8283
+ headers["X-Run-Id"] = runId;
8284
+ }
8285
+ if (currentTimestamp) {
8286
+ headers["X-Current-Timestamp"] = currentTimestamp;
8287
+ }
8288
+ if (currentTimezone) {
8289
+ headers["X-Current-Timezone"] = currentTimezone;
8290
+ }
8291
+ const response = await axios.get(`${apiDomain}/v1/developer/nifty-timeline`, {
8292
+ params: validatedParams,
8293
+ headers
8294
+ });
8295
+ return response.data.data.niftyTimeline;
8296
+ } catch (error) {
8297
+ if (axios.isAxiosError(error)) {
8298
+ logger.error(`Error fetching NIFTY timeline: ${error.message}`);
8299
+ throw new Error(
8300
+ `Failed to fetch NIFTY timeline: ${error.response?.data?.message || error.message}`
8301
+ );
8302
+ }
8303
+ logger.error(`Unexpected error fetching NIFTY timeline: ${error}`);
8304
+ throw error;
8305
+ }
8306
+ };
8219
8307
  function isRetryableError(error) {
8220
8308
  if (axios.isAxiosError(error)) {
8221
8309
  const axiosError = error;
@@ -8294,7 +8382,7 @@ const placeOrder = ({ runId, apiClient }) => async (data) => {
8294
8382
  try {
8295
8383
  await retryWithBackoff(
8296
8384
  async () => {
8297
- const validatedData = ve.v1_dashboard_runs_schemas.createOrder.body.parse(data);
8385
+ const validatedData = qe.v1_dashboard_runs_schemas.createOrder.body.parse(data);
8298
8386
  await apiClient.post(`/v1/dashboard/runs/${runId}/orders`, validatedData);
8299
8387
  logger.debug(`Order persisted for ${data.nseSymbol} in runId: ${runId}`);
8300
8388
  },
@@ -8411,9 +8499,9 @@ var calendar$1 = { exports: {} };
8411
8499
  module2.exports = t2();
8412
8500
  }(commonjsGlobal, function() {
8413
8501
  return function(e, t2, a2) {
8414
- var n2 = "h:mm A", d2 = { lastDay: "[Yesterday at] " + n2, sameDay: "[Today at] " + n2, nextDay: "[Tomorrow at] " + n2, nextWeek: "dddd [at] " + n2, lastWeek: "[Last] dddd [at] " + n2, sameElse: "MM/DD/YYYY" };
8502
+ var n2 = "h:mm A", d = { lastDay: "[Yesterday at] " + n2, sameDay: "[Today at] " + n2, nextDay: "[Tomorrow at] " + n2, nextWeek: "dddd [at] " + n2, lastWeek: "[Last] dddd [at] " + n2, sameElse: "MM/DD/YYYY" };
8415
8503
  t2.prototype.calendar = function(e2, t3) {
8416
- var n3 = t3 || this.$locale().calendar || d2, o2 = a2(e2 || void 0).startOf("d"), s = this.diff(o2, "d", true), i2 = "sameElse", f2 = s < -6 ? i2 : s < -1 ? "lastWeek" : s < 0 ? "lastDay" : s < 1 ? "sameDay" : s < 2 ? "nextDay" : s < 7 ? "nextWeek" : i2, l2 = n3[f2] || d2[f2];
8504
+ var n3 = t3 || this.$locale().calendar || d, o2 = a2(e2 || void 0).startOf("d"), s = this.diff(o2, "d", true), i2 = "sameElse", f2 = s < -6 ? i2 : s < -1 ? "lastWeek" : s < 0 ? "lastDay" : s < 1 ? "sameDay" : s < 2 ? "nextDay" : s < 7 ? "nextWeek" : i2, l2 = n3[f2] || d[f2];
8417
8505
  return "function" == typeof l2 ? l2.call(this, a2()) : this.format(l2);
8418
8506
  };
8419
8507
  };
@@ -8432,15 +8520,15 @@ var relativeTime$1 = { exports: {} };
8432
8520
  function i2(r2, e2, t3, o3) {
8433
8521
  return n2.fromToBase(r2, e2, t3, o3);
8434
8522
  }
8435
- t2.en.relativeTime = o2, n2.fromToBase = function(e2, n3, i3, d3, u) {
8436
- for (var f2, a2, s, l2 = i3.$locale().relativeTime || o2, h = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m2 = h.length, c2 = 0; c2 < m2; c2 += 1) {
8437
- var y2 = h[c2];
8438
- y2.d && (f2 = d3 ? t2(e2).diff(i3, y2.d, true) : i3.diff(e2, y2.d, true));
8523
+ t2.en.relativeTime = o2, n2.fromToBase = function(e2, n3, i3, d2, u) {
8524
+ for (var f2, a2, s, l2 = i3.$locale().relativeTime || o2, h2 = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m2 = h2.length, c2 = 0; c2 < m2; c2 += 1) {
8525
+ var y2 = h2[c2];
8526
+ y2.d && (f2 = d2 ? t2(e2).diff(i3, y2.d, true) : i3.diff(e2, y2.d, true));
8439
8527
  var p2 = (r.rounding || Math.round)(Math.abs(f2));
8440
8528
  if (s = f2 > 0, p2 <= y2.r || !y2.r) {
8441
- p2 <= 1 && c2 > 0 && (y2 = h[c2 - 1]);
8442
- var v2 = l2[y2.l];
8443
- u && (p2 = u("" + p2)), a2 = "string" == typeof v2 ? v2.replace("%d", p2) : v2(p2, n3, y2.l, s);
8529
+ p2 <= 1 && c2 > 0 && (y2 = h2[c2 - 1]);
8530
+ var v = l2[y2.l];
8531
+ u && (p2 = u("" + p2)), a2 = "string" == typeof v ? v.replace("%d", p2) : v(p2, n3, y2.l, s);
8444
8532
  break;
8445
8533
  }
8446
8534
  }
@@ -8452,13 +8540,13 @@ var relativeTime$1 = { exports: {} };
8452
8540
  }, n2.from = function(r2, e2) {
8453
8541
  return i2(r2, e2, this);
8454
8542
  };
8455
- var d2 = function(r2) {
8543
+ var d = function(r2) {
8456
8544
  return r2.$u ? t2.utc() : t2();
8457
8545
  };
8458
8546
  n2.toNow = function(r2) {
8459
- return this.to(d2(this), r2);
8547
+ return this.to(d(this), r2);
8460
8548
  }, n2.fromNow = function(r2) {
8461
- return this.from(d2(this), r2);
8549
+ return this.from(d(this), r2);
8462
8550
  };
8463
8551
  };
8464
8552
  });
@@ -8626,6 +8714,13 @@ async function ganaka({
8626
8714
  currentTimestamp,
8627
8715
  currentTimezone: "Asia/Kolkata"
8628
8716
  }),
8717
+ fetchNiftyQuoteTimeline: fetchNiftyQuoteTimeline({
8718
+ developerToken,
8719
+ apiDomain,
8720
+ runId,
8721
+ currentTimestamp,
8722
+ currentTimezone: "Asia/Kolkata"
8723
+ }),
8629
8724
  fetchQuoteTimeline: fetchQuoteTimeline({
8630
8725
  developerToken,
8631
8726
  apiDomain,
@@ -8674,6 +8769,6 @@ async function ganaka({
8674
8769
  }
8675
8770
  }
8676
8771
  exports.ganaka = ganaka;
8677
- exports.growwQuotePayloadSchema = _;
8772
+ exports.growwQuotePayloadSchema = S;
8678
8773
  exports.growwQuoteSchema = a;
8679
8774
  //# sourceMappingURL=index.js.map