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