@discomedia/utils 1.0.18 → 1.0.19

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.
@@ -13,8 +13,6 @@ var require$$0$1 = require('buffer');
13
13
  var require$$0$4 = require('fs');
14
14
  var require$$1$1 = require('path');
15
15
  var require$$2$1 = require('os');
16
- var dateFns = require('date-fns');
17
- var dateFnsTz = require('date-fns-tz');
18
16
 
19
17
  var Types = /*#__PURE__*/Object.freeze({
20
18
  __proto__: null
@@ -13481,64 +13479,90 @@ const marketEarlyCloses = {
13481
13479
  },
13482
13480
  };
13483
13481
 
13484
- // market-time.ts - Refactored for better organization and usability
13485
- // ===== CONFIGURATION =====
13486
- /**
13487
- * Market configuration constants
13488
- */
13482
+ // Constants for NY market times (Eastern Time)
13489
13483
  const MARKET_CONFIG = {
13490
- TIMEZONE: 'America/New_York',
13484
+ UTC_OFFSET_STANDARD: -5, // EST
13485
+ UTC_OFFSET_DST: -4, // EDT
13491
13486
  TIMES: {
13492
- EXTENDED_START: { hour: 4, minute: 0 },
13493
13487
  MARKET_OPEN: { hour: 9, minute: 30 },
13494
13488
  MARKET_CLOSE: { hour: 16, minute: 0 },
13495
- EARLY_CLOSE: { hour: 13, minute: 0 },
13496
- EXTENDED_END: { hour: 20, minute: 0 },
13497
- EARLY_EXTENDED_END: { hour: 17, minute: 0 },
13498
- },
13489
+ EARLY_CLOSE: { hour: 13, minute: 0 }},
13499
13490
  };
13500
- // ===== MARKET CALENDAR SERVICE =====
13501
- /**
13502
- * Service for handling market calendar operations (holidays, early closes, market days)
13503
- */
13491
+ // Helper: Get NY offset for a given UTC date (DST rules for US)
13492
+ function getNYOffset(date) {
13493
+ // US DST starts 2nd Sunday in March, ends 1st Sunday in November
13494
+ const year = date.getUTCFullYear();
13495
+ const dstStart = getNthWeekdayOfMonth(year, 3, 0, 2); // March, Sunday, 2nd
13496
+ const dstEnd = getNthWeekdayOfMonth(year, 11, 0, 1); // November, Sunday, 1st
13497
+ const utcTime = date.getTime();
13498
+ if (utcTime >= dstStart.getTime() && utcTime < dstEnd.getTime()) {
13499
+ return MARKET_CONFIG.UTC_OFFSET_DST;
13500
+ }
13501
+ return MARKET_CONFIG.UTC_OFFSET_STANDARD;
13502
+ }
13503
+ // Helper: Get nth weekday of month in UTC
13504
+ function getNthWeekdayOfMonth(year, month, weekday, n) {
13505
+ let count = 0;
13506
+ for (let d = 1; d <= 31; d++) {
13507
+ const date = new Date(Date.UTC(year, month - 1, d));
13508
+ if (date.getUTCMonth() !== month - 1)
13509
+ break;
13510
+ if (date.getUTCDay() === weekday) {
13511
+ count++;
13512
+ if (count === n)
13513
+ return date;
13514
+ }
13515
+ }
13516
+ // fallback: last day of month
13517
+ return new Date(Date.UTC(year, month - 1, 28));
13518
+ }
13519
+ // Helper: Convert UTC date to NY time (returns new Date object)
13520
+ function toNYTime(date) {
13521
+ const offset = getNYOffset(date);
13522
+ // NY offset in hours
13523
+ const utcMillis = date.getTime();
13524
+ const nyMillis = utcMillis + offset * 60 * 60 * 1000;
13525
+ return new Date(nyMillis);
13526
+ }
13527
+ // Helper: Convert NY time to UTC (returns new Date object)
13528
+ function fromNYTime(date) {
13529
+ const offset = getNYOffset(date);
13530
+ const nyMillis = date.getTime();
13531
+ const utcMillis = nyMillis - offset * 60 * 60 * 1000;
13532
+ return new Date(utcMillis);
13533
+ }
13534
+ // Market calendar logic
13504
13535
  class MarketCalendar {
13505
- timezone;
13506
- constructor(timezone = MARKET_CONFIG.TIMEZONE) {
13507
- this.timezone = timezone;
13508
- }
13509
- /**
13510
- * Check if a date is a weekend
13511
- */
13512
13536
  isWeekend(date) {
13513
- const day = date.getDay();
13514
- return day === 0 || day === 6; // Sunday or Saturday
13537
+ const day = toNYTime(date).getUTCDay();
13538
+ return day === 0 || day === 6;
13515
13539
  }
13516
- /**
13517
- * Check if a date is a market holiday
13518
- */
13519
13540
  isHoliday(date) {
13520
- const formattedDate = dateFnsTz.formatInTimeZone(date, this.timezone, 'yyyy-MM-dd');
13521
- const year = dateFnsTz.toZonedTime(date, this.timezone).getFullYear();
13541
+ const nyDate = toNYTime(date);
13542
+ const year = nyDate.getUTCFullYear();
13543
+ const month = nyDate.getUTCMonth() + 1;
13544
+ const day = nyDate.getUTCDate();
13545
+ const formattedDate = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
13522
13546
  const yearHolidays = marketHolidays[year];
13523
13547
  if (!yearHolidays)
13524
13548
  return false;
13525
13549
  return Object.values(yearHolidays).some(holiday => holiday.date === formattedDate);
13526
13550
  }
13527
- /**
13528
- * Check if a date is an early close day
13529
- */
13530
13551
  isEarlyCloseDay(date) {
13531
- const formattedDate = dateFnsTz.formatInTimeZone(date, this.timezone, 'yyyy-MM-dd');
13532
- const year = dateFnsTz.toZonedTime(date, this.timezone).getFullYear();
13552
+ const nyDate = toNYTime(date);
13553
+ const year = nyDate.getUTCFullYear();
13554
+ const month = nyDate.getUTCMonth() + 1;
13555
+ const day = nyDate.getUTCDate();
13556
+ const formattedDate = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
13533
13557
  const yearEarlyCloses = marketEarlyCloses[year];
13534
13558
  return yearEarlyCloses && yearEarlyCloses[formattedDate] !== undefined;
13535
13559
  }
13536
- /**
13537
- * Get the early close time for a date (in minutes from midnight)
13538
- */
13539
13560
  getEarlyCloseTime(date) {
13540
- const formattedDate = dateFnsTz.formatInTimeZone(date, this.timezone, 'yyyy-MM-dd');
13541
- const year = dateFnsTz.toZonedTime(date, this.timezone).getFullYear();
13561
+ const nyDate = toNYTime(date);
13562
+ const year = nyDate.getUTCFullYear();
13563
+ const month = nyDate.getUTCMonth() + 1;
13564
+ const day = nyDate.getUTCDate();
13565
+ const formattedDate = `${year}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
13542
13566
  const yearEarlyCloses = marketEarlyCloses[year];
13543
13567
  if (yearEarlyCloses && yearEarlyCloses[formattedDate]) {
13544
13568
  const [hours, minutes] = yearEarlyCloses[formattedDate].time.split(':').map(Number);
@@ -13546,285 +13570,61 @@ class MarketCalendar {
13546
13570
  }
13547
13571
  return null;
13548
13572
  }
13549
- /**
13550
- * Check if a date is a market day (not weekend or holiday)
13551
- */
13552
13573
  isMarketDay(date) {
13553
13574
  return !this.isWeekend(date) && !this.isHoliday(date);
13554
13575
  }
13555
- /**
13556
- * Get the next market day from a given date
13557
- */
13558
13576
  getNextMarketDay(date) {
13559
- let nextDay = dateFns.add(date, { days: 1 });
13577
+ let nextDay = new Date(date.getTime() + 24 * 60 * 60 * 1000);
13560
13578
  while (!this.isMarketDay(nextDay)) {
13561
- nextDay = dateFns.add(nextDay, { days: 1 });
13579
+ nextDay = new Date(nextDay.getTime() + 24 * 60 * 60 * 1000);
13562
13580
  }
13563
13581
  return nextDay;
13564
13582
  }
13565
- /**
13566
- * Get the previous market day from a given date
13567
- */
13568
13583
  getPreviousMarketDay(date) {
13569
- let prevDay = dateFns.sub(date, { days: 1 });
13584
+ let prevDay = new Date(date.getTime() - 24 * 60 * 60 * 1000);
13570
13585
  while (!this.isMarketDay(prevDay)) {
13571
- prevDay = dateFns.sub(prevDay, { days: 1 });
13586
+ prevDay = new Date(prevDay.getTime() - 24 * 60 * 60 * 1000);
13572
13587
  }
13573
13588
  return prevDay;
13574
13589
  }
13575
13590
  }
13576
- // ===== TIME FORMATTER SERVICE =====
13577
- /**
13578
- * Service for formatting time outputs
13579
- */
13580
- class TimeFormatter {
13581
- timezone;
13582
- constructor(timezone = MARKET_CONFIG.TIMEZONE) {
13583
- this.timezone = timezone;
13584
- }
13585
- /**
13586
- * Format a date based on the output format
13587
- */
13588
- formatDate(date, outputFormat = 'iso') {
13589
- switch (outputFormat) {
13590
- case 'unix-seconds':
13591
- return Math.floor(date.getTime() / 1000);
13592
- case 'unix-ms':
13593
- return date.getTime();
13594
- case 'iso':
13595
- default:
13596
- return dateFnsTz.formatInTimeZone(date, this.timezone, "yyyy-MM-dd'T'HH:mm:ssXXX");
13597
- }
13598
- }
13599
- /**
13600
- * Get New York timezone offset
13601
- */
13602
- getNYTimeZone(date = new Date()) {
13603
- const dtf = new Intl.DateTimeFormat('en-US', {
13604
- timeZone: this.timezone,
13605
- timeZoneName: 'shortOffset',
13606
- });
13607
- const parts = dtf.formatToParts(date);
13608
- const tz = parts.find(p => p.type === 'timeZoneName')?.value;
13609
- if (!tz) {
13610
- throw new Error('Could not determine New York offset');
13611
- }
13612
- const shortOffset = tz.replace('GMT', '');
13613
- if (shortOffset === '-4') {
13614
- return '-04:00';
13615
- }
13616
- else if (shortOffset === '-5') {
13617
- return '-05:00';
13618
- }
13619
- else {
13620
- throw new Error(`Unexpected timezone offset: ${shortOffset}`);
13621
- }
13622
- }
13623
- /**
13624
- * Get trading date in YYYY-MM-DD format
13625
- */
13626
- getTradingDate(time) {
13627
- let date;
13628
- if (typeof time === 'number') {
13629
- date = new Date(time);
13630
- }
13631
- else if (typeof time === 'string') {
13632
- date = new Date(time);
13633
- }
13634
- else {
13635
- date = time;
13636
- }
13637
- return dateFnsTz.formatInTimeZone(date, this.timezone, 'yyyy-MM-dd');
13638
- }
13591
+ // Get last full trading date
13592
+ function getLastFullTradingDateImpl(currentDate = new Date()) {
13593
+ const calendar = new MarketCalendar();
13594
+ const nyDate = toNYTime(currentDate);
13595
+ const minutes = nyDate.getUTCHours() * 60 + nyDate.getUTCMinutes();
13596
+ const marketOpenMinutes = MARKET_CONFIG.TIMES.MARKET_OPEN.hour * 60 + MARKET_CONFIG.TIMES.MARKET_OPEN.minute;
13597
+ let marketCloseMinutes = MARKET_CONFIG.TIMES.MARKET_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.MARKET_CLOSE.minute;
13598
+ if (calendar.isEarlyCloseDay(currentDate)) {
13599
+ marketCloseMinutes = MARKET_CONFIG.TIMES.EARLY_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.EARLY_CLOSE.minute;
13600
+ }
13601
+ // If not a market day, or before open, or during market hours, return previous market day's close
13602
+ if (!calendar.isMarketDay(currentDate) || minutes < marketOpenMinutes || (minutes >= marketOpenMinutes && minutes < marketCloseMinutes)) {
13603
+ const prevMarketDay = calendar.getPreviousMarketDay(currentDate);
13604
+ let prevCloseMinutes = MARKET_CONFIG.TIMES.MARKET_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.MARKET_CLOSE.minute;
13605
+ if (calendar.isEarlyCloseDay(prevMarketDay)) {
13606
+ prevCloseMinutes = MARKET_CONFIG.TIMES.EARLY_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.EARLY_CLOSE.minute;
13607
+ }
13608
+ const year = prevMarketDay.getUTCFullYear();
13609
+ const month = prevMarketDay.getUTCMonth();
13610
+ const day = prevMarketDay.getUTCDate();
13611
+ const closeHour = Math.floor(prevCloseMinutes / 60);
13612
+ const closeMinute = prevCloseMinutes % 60;
13613
+ return fromNYTime(new Date(Date.UTC(year, month, day, closeHour, closeMinute, 0, 0)));
13614
+ }
13615
+ // After market close or after extended hours, return today's close
13616
+ const year = nyDate.getUTCFullYear();
13617
+ const month = nyDate.getUTCMonth();
13618
+ const day = nyDate.getUTCDate();
13619
+ const closeHour = Math.floor(marketCloseMinutes / 60);
13620
+ const closeMinute = marketCloseMinutes % 60;
13621
+ return fromNYTime(new Date(Date.UTC(year, month, day, closeHour, closeMinute, 0, 0)));
13639
13622
  }
13640
- // ===== MARKET TIME CALCULATOR =====
13641
13623
  /**
13642
- * Service for core market time calculations
13643
- */
13644
- class MarketTimeCalculator {
13645
- calendar;
13646
- timezone;
13647
- constructor(timezone = MARKET_CONFIG.TIMEZONE) {
13648
- this.timezone = timezone;
13649
- this.calendar = new MarketCalendar(timezone);
13650
- }
13651
- /**
13652
- * Get market open/close times for a date
13653
- */
13654
- getMarketTimes(date) {
13655
- const zonedDate = dateFnsTz.toZonedTime(date, this.timezone);
13656
- // Market closed on weekends and holidays
13657
- if (!this.calendar.isMarketDay(zonedDate)) {
13658
- return {
13659
- marketOpen: false,
13660
- open: null,
13661
- close: null,
13662
- openExt: null,
13663
- closeExt: null,
13664
- };
13665
- }
13666
- const dayStart = dateFns.startOfDay(zonedDate);
13667
- // Regular market times
13668
- const open = dateFnsTz.fromZonedTime(dateFns.set(dayStart, { hours: MARKET_CONFIG.TIMES.MARKET_OPEN.hour, minutes: MARKET_CONFIG.TIMES.MARKET_OPEN.minute }), this.timezone);
13669
- let close = dateFnsTz.fromZonedTime(dateFns.set(dayStart, { hours: MARKET_CONFIG.TIMES.MARKET_CLOSE.hour, minutes: MARKET_CONFIG.TIMES.MARKET_CLOSE.minute }), this.timezone);
13670
- // Extended hours
13671
- const openExt = dateFnsTz.fromZonedTime(dateFns.set(dayStart, { hours: MARKET_CONFIG.TIMES.EXTENDED_START.hour, minutes: MARKET_CONFIG.TIMES.EXTENDED_START.minute }), this.timezone);
13672
- let closeExt = dateFnsTz.fromZonedTime(dateFns.set(dayStart, { hours: MARKET_CONFIG.TIMES.EXTENDED_END.hour, minutes: MARKET_CONFIG.TIMES.EXTENDED_END.minute }), this.timezone);
13673
- // Handle early close days
13674
- if (this.calendar.isEarlyCloseDay(zonedDate)) {
13675
- close = dateFnsTz.fromZonedTime(dateFns.set(dayStart, { hours: MARKET_CONFIG.TIMES.EARLY_CLOSE.hour, minutes: MARKET_CONFIG.TIMES.EARLY_CLOSE.minute }), this.timezone);
13676
- closeExt = dateFnsTz.fromZonedTime(dateFns.set(dayStart, { hours: MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.hour, minutes: MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.minute }), this.timezone);
13677
- }
13678
- return {
13679
- marketOpen: true,
13680
- open,
13681
- close,
13682
- openExt,
13683
- closeExt,
13684
- };
13685
- }
13686
- /**
13687
- * Check if a time is within market hours based on intraday reporting mode
13688
- */
13689
- isWithinMarketHours(date, intradayReporting = 'market_hours') {
13690
- const zonedDate = dateFnsTz.toZonedTime(date, this.timezone);
13691
- // Not a market day
13692
- if (!this.calendar.isMarketDay(zonedDate)) {
13693
- return false;
13694
- }
13695
- const timeInMinutes = zonedDate.getHours() * 60 + zonedDate.getMinutes();
13696
- switch (intradayReporting) {
13697
- case 'extended_hours': {
13698
- const startMinutes = MARKET_CONFIG.TIMES.EXTENDED_START.hour * 60 + MARKET_CONFIG.TIMES.EXTENDED_START.minute;
13699
- let endMinutes = MARKET_CONFIG.TIMES.EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EXTENDED_END.minute;
13700
- // Handle early close
13701
- if (this.calendar.isEarlyCloseDay(zonedDate)) {
13702
- endMinutes = MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.minute;
13703
- }
13704
- return timeInMinutes >= startMinutes && timeInMinutes <= endMinutes;
13705
- }
13706
- case 'continuous':
13707
- return true;
13708
- default: {
13709
- // 'market_hours'
13710
- const startMinutes = MARKET_CONFIG.TIMES.MARKET_OPEN.hour * 60 + MARKET_CONFIG.TIMES.MARKET_OPEN.minute;
13711
- let endMinutes = MARKET_CONFIG.TIMES.MARKET_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.MARKET_CLOSE.minute;
13712
- // Handle early close
13713
- if (this.calendar.isEarlyCloseDay(zonedDate)) {
13714
- endMinutes = MARKET_CONFIG.TIMES.EARLY_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.EARLY_CLOSE.minute;
13715
- }
13716
- return timeInMinutes >= startMinutes && timeInMinutes <= endMinutes;
13717
- }
13718
- }
13719
- }
13720
- /**
13721
- * Get the last full trading date
13722
- */
13723
- getLastFullTradingDate(currentDate = new Date(), extendedHours = true) {
13724
- const nowET = dateFnsTz.toZonedTime(currentDate, this.timezone);
13725
- if (this.calendar.isMarketDay(nowET)) {
13726
- const timeInMinutes = nowET.getHours() * 60 + nowET.getMinutes();
13727
- let endMinutes;
13728
- if (extendedHours) {
13729
- endMinutes = MARKET_CONFIG.TIMES.EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EXTENDED_END.minute;
13730
- if (this.calendar.isEarlyCloseDay(nowET)) {
13731
- endMinutes = MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.hour * 60 + MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.minute;
13732
- }
13733
- }
13734
- else {
13735
- endMinutes = MARKET_CONFIG.TIMES.MARKET_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.MARKET_CLOSE.minute;
13736
- if (this.calendar.isEarlyCloseDay(nowET)) {
13737
- endMinutes = MARKET_CONFIG.TIMES.EARLY_CLOSE.hour * 60 + MARKET_CONFIG.TIMES.EARLY_CLOSE.minute;
13738
- }
13739
- }
13740
- if (timeInMinutes >= endMinutes) {
13741
- return dateFnsTz.fromZonedTime(dateFns.set(nowET, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }), this.timezone);
13742
- }
13743
- }
13744
- // Return the last completed trading day
13745
- const lastMarketDay = this.calendar.getPreviousMarketDay(nowET);
13746
- return dateFnsTz.fromZonedTime(dateFns.set(lastMarketDay, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }), this.timezone);
13747
- }
13748
- /**
13749
- * Get day boundaries based on intraday reporting mode
13750
- */
13751
- getDayBoundaries(date, intradayReporting = 'market_hours') {
13752
- const zonedDate = dateFnsTz.toZonedTime(date, this.timezone);
13753
- let start;
13754
- let end;
13755
- switch (intradayReporting) {
13756
- case 'extended_hours': {
13757
- start = dateFns.set(zonedDate, {
13758
- hours: MARKET_CONFIG.TIMES.EXTENDED_START.hour,
13759
- minutes: MARKET_CONFIG.TIMES.EXTENDED_START.minute,
13760
- seconds: 0,
13761
- milliseconds: 0,
13762
- });
13763
- end = dateFns.set(zonedDate, {
13764
- hours: MARKET_CONFIG.TIMES.EXTENDED_END.hour,
13765
- minutes: MARKET_CONFIG.TIMES.EXTENDED_END.minute,
13766
- seconds: 59,
13767
- milliseconds: 999,
13768
- });
13769
- // Handle early close
13770
- if (this.calendar.isEarlyCloseDay(zonedDate)) {
13771
- end = dateFns.set(zonedDate, {
13772
- hours: MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.hour,
13773
- minutes: MARKET_CONFIG.TIMES.EARLY_EXTENDED_END.minute,
13774
- seconds: 59,
13775
- milliseconds: 999,
13776
- });
13777
- }
13778
- break;
13779
- }
13780
- case 'continuous': {
13781
- start = dateFns.startOfDay(zonedDate);
13782
- end = dateFns.endOfDay(zonedDate);
13783
- break;
13784
- }
13785
- default: {
13786
- // 'market_hours'
13787
- start = dateFns.set(zonedDate, {
13788
- hours: MARKET_CONFIG.TIMES.MARKET_OPEN.hour,
13789
- minutes: MARKET_CONFIG.TIMES.MARKET_OPEN.minute,
13790
- seconds: 0,
13791
- milliseconds: 0,
13792
- });
13793
- end = dateFns.set(zonedDate, {
13794
- hours: MARKET_CONFIG.TIMES.MARKET_CLOSE.hour,
13795
- minutes: MARKET_CONFIG.TIMES.MARKET_CLOSE.minute,
13796
- seconds: 59,
13797
- milliseconds: 999,
13798
- });
13799
- // Handle early close
13800
- if (this.calendar.isEarlyCloseDay(zonedDate)) {
13801
- end = dateFns.set(zonedDate, {
13802
- hours: MARKET_CONFIG.TIMES.EARLY_CLOSE.hour,
13803
- minutes: MARKET_CONFIG.TIMES.EARLY_CLOSE.minute,
13804
- seconds: 59,
13805
- milliseconds: 999,
13806
- });
13807
- }
13808
- break;
13809
- }
13810
- }
13811
- return {
13812
- start: dateFnsTz.fromZonedTime(start, this.timezone),
13813
- end: dateFnsTz.fromZonedTime(end, this.timezone),
13814
- };
13815
- }
13816
- }
13817
- const marketTimeCalculator = new MarketTimeCalculator();
13818
- const timeFormatter = new TimeFormatter();
13819
- /**
13820
- * Get the last full trading date
13624
+ * Returns the last full trading date as a Date object.
13821
13625
  */
13822
13626
  function getLastFullTradingDate(currentDate = new Date()) {
13823
- const date = marketTimeCalculator.getLastFullTradingDate(currentDate);
13824
- return {
13825
- date,
13826
- YYYYMMDD: timeFormatter.getTradingDate(date),
13827
- };
13627
+ return getLastFullTradingDateImpl(currentDate);
13828
13628
  }
13829
13629
 
13830
13630
  const log = (message, options = { type: 'info' }) => {
@@ -14224,8 +14024,8 @@ class AlpacaMarketDataAPI extends require$$0$3.EventEmitter {
14224
14024
  const response = await this.getHistoricalBars({
14225
14025
  symbols: [symbol],
14226
14026
  timeframe: '1Day',
14227
- start: prevMarketDate.date.toISOString(),
14228
- end: prevMarketDate.date.toISOString(),
14027
+ start: prevMarketDate.toISOString(),
14028
+ end: prevMarketDate.toISOString(),
14229
14029
  limit: 1,
14230
14030
  });
14231
14031
  if (!response.bars[symbol] || response.bars[symbol].length === 0) {