@gainsnetwork/sdk 1.8.6 → 1.8.7
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/lib/markets/commodities.js +1 -1
- package/lib/markets/forex.js +4 -2
- package/lib/markets/indices.js +1 -1
- package/lib/markets/schedules/builders.d.ts +1 -1
- package/lib/markets/schedules/builders.js +83 -28
- package/lib/markets/schedules/checkers.js +2 -2
- package/lib/markets/schedules/holidays.js +31 -6
- package/lib/markets/stocks.js +1 -1
- package/lib/trade/fees/borrowingV2/fetcher.d.ts +1 -0
- package/package.json +1 -1
- package/lib/contracts/types/generated/GFarmTradingStorageV5.d.ts +0 -1911
- package/lib/contracts/types/generated/GFarmTradingStorageV5.js +0 -2
- package/lib/contracts/types/generated/GNSBorrowingFees.d.ts +0 -1067
- package/lib/contracts/types/generated/GNSBorrowingFees.js +0 -2
- package/lib/contracts/types/generated/GNSBorrowingFeesV6_3_2.d.ts +0 -979
- package/lib/contracts/types/generated/GNSBorrowingFeesV6_3_2.js +0 -2
- package/lib/contracts/types/generated/GNSBorrowingFeesV6_4.d.ts +0 -1058
- package/lib/contracts/types/generated/GNSBorrowingFeesV6_4.js +0 -2
- package/lib/contracts/types/generated/GNSNftRewardsV6.d.ts +0 -533
- package/lib/contracts/types/generated/GNSNftRewardsV6.js +0 -2
- package/lib/contracts/types/generated/GNSNftRewardsV6_3_1.d.ts +0 -613
- package/lib/contracts/types/generated/GNSNftRewardsV6_3_1.js +0 -2
- package/lib/contracts/types/generated/GNSPairInfosV6_1.d.ts +0 -911
- package/lib/contracts/types/generated/GNSPairInfosV6_1.js +0 -2
- package/lib/contracts/types/generated/GNSPairsStorageV6.d.ts +0 -660
- package/lib/contracts/types/generated/GNSPairsStorageV6.js +0 -2
- package/lib/contracts/types/generated/GNSTrading.d.ts +0 -758
- package/lib/contracts/types/generated/GNSTrading.js +0 -2
- package/lib/contracts/types/generated/GNSTradingCallbacks.d.ts +0 -875
- package/lib/contracts/types/generated/GNSTradingCallbacks.js +0 -2
- package/lib/contracts/types/generated/GNSTradingCallbacksV6_3_2.d.ts +0 -806
- package/lib/contracts/types/generated/GNSTradingCallbacksV6_3_2.js +0 -2
- package/lib/contracts/types/generated/GNSTradingCallbacksV6_4.d.ts +0 -821
- package/lib/contracts/types/generated/GNSTradingCallbacksV6_4.js +0 -2
- package/lib/contracts/types/generated/GNSTradingStorage.d.ts +0 -1387
- package/lib/contracts/types/generated/GNSTradingStorage.js +0 -2
- package/lib/contracts/types/generated/GTokenV6_3_2.d.ts +0 -1838
- package/lib/contracts/types/generated/GTokenV6_3_2.js +0 -2
- package/lib/contracts/types/generated/factories/GFarmTradingStorageV5__factory.d.ts +0 -83
- package/lib/contracts/types/generated/factories/GFarmTradingStorageV5__factory.js +0 -2691
- package/lib/contracts/types/generated/factories/GNSBorrowingFeesV6_3_2__factory.d.ts +0 -88
- package/lib/contracts/types/generated/factories/GNSBorrowingFeesV6_3_2__factory.js +0 -1654
- package/lib/contracts/types/generated/factories/GNSBorrowingFeesV6_4__factory.d.ts +0 -113
- package/lib/contracts/types/generated/factories/GNSBorrowingFeesV6_4__factory.js +0 -1742
- package/lib/contracts/types/generated/factories/GNSBorrowingFees__factory.d.ts +0 -124
- package/lib/contracts/types/generated/factories/GNSBorrowingFees__factory.js +0 -1784
- package/lib/contracts/types/generated/factories/GNSNftRewardsV6_3_1__factory.d.ts +0 -100
- package/lib/contracts/types/generated/factories/GNSNftRewardsV6_3_1__factory.js +0 -1116
- package/lib/contracts/types/generated/factories/GNSNftRewardsV6__factory.d.ts +0 -100
- package/lib/contracts/types/generated/factories/GNSNftRewardsV6__factory.js +0 -1003
- package/lib/contracts/types/generated/factories/GNSPairInfosV6_1__factory.d.ts +0 -98
- package/lib/contracts/types/generated/factories/GNSPairInfosV6_1__factory.js +0 -1485
- package/lib/contracts/types/generated/factories/GNSPairsStorageV6__factory.d.ts +0 -117
- package/lib/contracts/types/generated/factories/GNSPairsStorageV6__factory.js +0 -1265
- package/lib/contracts/types/generated/factories/GNSTradingCallbacksV6_3_2__factory.d.ts +0 -82
- package/lib/contracts/types/generated/factories/GNSTradingCallbacksV6_3_2__factory.js +0 -1273
- package/lib/contracts/types/generated/factories/GNSTradingCallbacksV6_4__factory.d.ts +0 -82
- package/lib/contracts/types/generated/factories/GNSTradingCallbacksV6_4__factory.js +0 -1326
- package/lib/contracts/types/generated/factories/GNSTradingCallbacks__factory.d.ts +0 -113
- package/lib/contracts/types/generated/factories/GNSTradingCallbacks__factory.js +0 -1428
- package/lib/contracts/types/generated/factories/GNSTradingStorage__factory.d.ts +0 -96
- package/lib/contracts/types/generated/factories/GNSTradingStorage__factory.js +0 -2241
- package/lib/contracts/types/generated/factories/GNSTrading__factory.d.ts +0 -95
- package/lib/contracts/types/generated/factories/GNSTrading__factory.js +0 -1071
- package/lib/contracts/types/generated/factories/GTokenV6_3_2__factory.d.ts +0 -110
- package/lib/contracts/types/generated/factories/GTokenV6_3_2__factory.js +0 -2682
- package/lib/markets/oi/fetcher.d.ts +0 -58
- package/lib/markets/oi/fetcher.js +0 -181
- package/lib/markets/oi/validation.d.ts +0 -80
- package/lib/markets/oi/validation.js +0 -172
- package/lib/pricing/depthBands/converter.d.ts +0 -65
- package/lib/pricing/depthBands/converter.js +0 -155
- package/lib/pricing/depthBands/decoder.d.ts +0 -32
- package/lib/pricing/depthBands/decoder.js +0 -109
- package/lib/pricing/depthBands/encoder.d.ts +0 -19
- package/lib/pricing/depthBands/encoder.js +0 -105
- package/lib/pricing/depthBands/index.d.ts +0 -8
- package/lib/pricing/depthBands/index.js +0 -26
- package/lib/pricing/depthBands/types.d.ts +0 -49
- package/lib/pricing/depthBands/types.js +0 -10
- package/lib/pricing/depthBands/validator.d.ts +0 -22
- package/lib/pricing/depthBands/validator.js +0 -113
- package/lib/trade/effectiveLeverage/builder.d.ts +0 -23
- package/lib/trade/effectiveLeverage/builder.js +0 -30
- package/lib/trade/fees/holdingFees/index.d.ts +0 -46
- package/lib/trade/fees/holdingFees/index.js +0 -105
- package/lib/trade/fees/holdingFees/types.d.ts +0 -23
- package/lib/trade/fees/holdingFees/types.js +0 -5
- package/lib/trade/fees/trading/holdingFees.d.ts +0 -28
- package/lib/trade/fees/trading/holdingFees.js +0 -66
- package/lib/trade/fees/trading/holdingFeesStructured.d.ts +0 -28
- package/lib/trade/fees/trading/holdingFeesStructured.js +0 -66
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isCommoditiesOpen = void 0;
|
|
4
4
|
// @ts-ignore-file
|
|
5
5
|
const schedules_1 = require("./schedules");
|
|
6
|
-
const isCommoditiesOpen = (dateToCheck) => (0, schedules_1.isOpenAt)(
|
|
6
|
+
const isCommoditiesOpen = (dateToCheck) => (0, schedules_1.isOpenAt)("commodities", dateToCheck);
|
|
7
7
|
exports.isCommoditiesOpen = isCommoditiesOpen;
|
package/lib/markets/forex.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isForexLowLiquidity = exports.isForexOpen = void 0;
|
|
4
4
|
const schedules_1 = require("./schedules");
|
|
5
|
-
const isForexOpen = (dateToCheck) => (0, schedules_1.isOpenAt)(
|
|
5
|
+
const isForexOpen = (dateToCheck) => (0, schedules_1.isOpenAt)("forex", dateToCheck);
|
|
6
6
|
exports.isForexOpen = isForexOpen;
|
|
7
|
-
const isForexLowLiquidity = (timestampToCheck, pair) => (0, schedules_1.isLowLiquidityAt)(
|
|
7
|
+
const isForexLowLiquidity = (timestampToCheck, pair) => (0, schedules_1.isLowLiquidityAt)("forex", new Date(timestampToCheck), pair?.groupIndex !== undefined
|
|
8
|
+
? { pairGroupIndex: +pair.groupIndex }
|
|
9
|
+
: undefined);
|
|
8
10
|
exports.isForexLowLiquidity = isForexLowLiquidity;
|
package/lib/markets/indices.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isIndicesOpen = void 0;
|
|
4
4
|
const schedules_1 = require("./schedules");
|
|
5
|
-
const isIndicesOpen = (dateToCheck) => (0, schedules_1.isOpenAt)(
|
|
5
|
+
const isIndicesOpen = (dateToCheck) => (0, schedules_1.isOpenAt)("indices", dateToCheck);
|
|
6
6
|
exports.isIndicesOpen = isIndicesOpen;
|
|
@@ -4,7 +4,7 @@ exports.buildCommoditiesWeeklySchedule = exports.buildIndicesWeeklySchedule = ex
|
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
5
|
const types_1 = require("./types");
|
|
6
6
|
const holidays_1 = require("./holidays");
|
|
7
|
-
const ET = luxon_1.IANAZone.create(
|
|
7
|
+
const ET = luxon_1.IANAZone.create("America/New_York");
|
|
8
8
|
const emptyWeekly = () => ({
|
|
9
9
|
monday: [],
|
|
10
10
|
tuesday: [],
|
|
@@ -25,37 +25,75 @@ const buildForexWeeklySchedule = (currentDate = new Date(), opts) => {
|
|
|
25
25
|
const openHour = isInDST ? 16 : 17; // Monday open
|
|
26
26
|
const closeHour = isInDST ? 16 : 17; // Friday close
|
|
27
27
|
// Open windows (ET): Sun 16/17:00 -> 24:00, Mon-Thu 0-24, Fri 0 -> 16/17:00
|
|
28
|
-
add(open, types_1.WeekDay.Sunday, {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
add(open, types_1.WeekDay.
|
|
33
|
-
|
|
28
|
+
add(open, types_1.WeekDay.Sunday, {
|
|
29
|
+
start: { hour: openHour, minute: 0 },
|
|
30
|
+
end: { hour: 24, minute: 0 },
|
|
31
|
+
});
|
|
32
|
+
add(open, types_1.WeekDay.Monday, {
|
|
33
|
+
start: { hour: 0, minute: 0 },
|
|
34
|
+
end: { hour: 24, minute: 0 },
|
|
35
|
+
});
|
|
36
|
+
add(open, types_1.WeekDay.Tuesday, {
|
|
37
|
+
start: { hour: 0, minute: 0 },
|
|
38
|
+
end: { hour: 24, minute: 0 },
|
|
39
|
+
});
|
|
40
|
+
add(open, types_1.WeekDay.Wednesday, {
|
|
41
|
+
start: { hour: 0, minute: 0 },
|
|
42
|
+
end: { hour: 24, minute: 0 },
|
|
43
|
+
});
|
|
44
|
+
add(open, types_1.WeekDay.Thursday, {
|
|
45
|
+
start: { hour: 0, minute: 0 },
|
|
46
|
+
end: { hour: 24, minute: 0 },
|
|
47
|
+
});
|
|
48
|
+
add(open, types_1.WeekDay.Friday, {
|
|
49
|
+
start: { hour: 0, minute: 0 },
|
|
50
|
+
end: { hour: closeHour, minute: 0 },
|
|
51
|
+
});
|
|
34
52
|
// Low-liquidity windows (ET)
|
|
35
53
|
const extendedGroups = [8, 9];
|
|
36
|
-
const useExtended = opts?.pairGroupIndex !== undefined &&
|
|
37
|
-
|
|
54
|
+
const useExtended = opts?.pairGroupIndex !== undefined &&
|
|
55
|
+
extendedGroups.includes(+opts.pairGroupIndex);
|
|
56
|
+
const llStartHour = isInDST ? (useExtended ? 14 : 15) : useExtended ? 15 : 16;
|
|
38
57
|
const llStartMinute = 45;
|
|
39
|
-
const llEndHour = isInDST ? (useExtended ? 21 : 19) :
|
|
58
|
+
const llEndHour = isInDST ? (useExtended ? 21 : 19) : useExtended ? 22 : 20;
|
|
40
59
|
const llEndMinute = 0;
|
|
41
|
-
for (const d of [
|
|
42
|
-
|
|
60
|
+
for (const d of [
|
|
61
|
+
types_1.WeekDay.Sunday,
|
|
62
|
+
types_1.WeekDay.Monday,
|
|
63
|
+
types_1.WeekDay.Tuesday,
|
|
64
|
+
types_1.WeekDay.Wednesday,
|
|
65
|
+
types_1.WeekDay.Thursday,
|
|
66
|
+
types_1.WeekDay.Friday,
|
|
67
|
+
]) {
|
|
68
|
+
add(lowLiq, d, {
|
|
69
|
+
start: { hour: llStartHour, minute: llStartMinute },
|
|
70
|
+
end: { hour: llEndHour, minute: llEndMinute },
|
|
71
|
+
});
|
|
43
72
|
}
|
|
44
|
-
const holidays = (0, holidays_1.getHolidaysInCurrentWeek)(
|
|
73
|
+
const holidays = (0, holidays_1.getHolidaysInCurrentWeek)("forex", currentDate);
|
|
45
74
|
const summary = isInDST
|
|
46
|
-
?
|
|
47
|
-
:
|
|
75
|
+
? "Sunday 4:00 pm - Friday 4:00 pm ET (Closed weekends & holidays)"
|
|
76
|
+
: "Sunday 5:00 pm - Friday 5:00 pm ET (Closed weekends & holidays)";
|
|
48
77
|
return { open, lowLiq, holidays, summary };
|
|
49
78
|
};
|
|
50
79
|
exports.buildForexWeeklySchedule = buildForexWeeklySchedule;
|
|
51
80
|
const buildStocksWeeklySchedule = (currentDate = new Date()) => {
|
|
52
81
|
const open = emptyWeekly();
|
|
53
82
|
const lowLiq = emptyWeekly();
|
|
54
|
-
for (const d of [
|
|
55
|
-
|
|
83
|
+
for (const d of [
|
|
84
|
+
types_1.WeekDay.Monday,
|
|
85
|
+
types_1.WeekDay.Tuesday,
|
|
86
|
+
types_1.WeekDay.Wednesday,
|
|
87
|
+
types_1.WeekDay.Thursday,
|
|
88
|
+
types_1.WeekDay.Friday,
|
|
89
|
+
]) {
|
|
90
|
+
add(open, d, {
|
|
91
|
+
start: { hour: 9, minute: 35 },
|
|
92
|
+
end: { hour: 16, minute: 0 },
|
|
93
|
+
});
|
|
56
94
|
}
|
|
57
|
-
const holidays = (0, holidays_1.getHolidaysInCurrentWeek)(
|
|
58
|
-
const summary =
|
|
95
|
+
const holidays = (0, holidays_1.getHolidaysInCurrentWeek)("stocks", currentDate);
|
|
96
|
+
const summary = "Monday - Friday: 9:35 am - 4:00 pm ET (Closed weekends & holidays)";
|
|
59
97
|
return { open, lowLiq, holidays, summary };
|
|
60
98
|
};
|
|
61
99
|
exports.buildStocksWeeklySchedule = buildStocksWeeklySchedule;
|
|
@@ -64,18 +102,35 @@ exports.buildIndicesWeeklySchedule = buildIndicesWeeklySchedule;
|
|
|
64
102
|
const buildCommoditiesWeeklySchedule = (currentDate = new Date()) => {
|
|
65
103
|
const open = emptyWeekly();
|
|
66
104
|
const lowLiq = emptyWeekly();
|
|
67
|
-
// Sunday: 18:
|
|
68
|
-
add(open, types_1.WeekDay.Sunday, {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
105
|
+
// Sunday: 18:10 -> 24:00
|
|
106
|
+
add(open, types_1.WeekDay.Sunday, {
|
|
107
|
+
start: { hour: 18, minute: 10 },
|
|
108
|
+
end: { hour: 24, minute: 0 },
|
|
109
|
+
});
|
|
110
|
+
// Mon-Thu: 0:00 -> 17:00 and 18:10 -> 24:00 (break represented by the gap)
|
|
111
|
+
for (const d of [
|
|
112
|
+
types_1.WeekDay.Monday,
|
|
113
|
+
types_1.WeekDay.Tuesday,
|
|
114
|
+
types_1.WeekDay.Wednesday,
|
|
115
|
+
types_1.WeekDay.Thursday,
|
|
116
|
+
]) {
|
|
117
|
+
add(open, d, {
|
|
118
|
+
start: { hour: 0, minute: 0 },
|
|
119
|
+
end: { hour: 17, minute: 0 },
|
|
120
|
+
});
|
|
121
|
+
add(open, d, {
|
|
122
|
+
start: { hour: 18, minute: 10 },
|
|
123
|
+
end: { hour: 24, minute: 0 },
|
|
124
|
+
});
|
|
73
125
|
}
|
|
74
126
|
// Friday: 0:00 -> 17:00
|
|
75
|
-
add(open, types_1.WeekDay.Friday, {
|
|
127
|
+
add(open, types_1.WeekDay.Friday, {
|
|
128
|
+
start: { hour: 0, minute: 0 },
|
|
129
|
+
end: { hour: 17, minute: 0 },
|
|
130
|
+
});
|
|
76
131
|
// Saturday: closed (no windows)
|
|
77
|
-
const holidays = (0, holidays_1.getHolidaysInCurrentWeek)(
|
|
78
|
-
const summary = `Sunday 6:
|
|
132
|
+
const holidays = (0, holidays_1.getHolidaysInCurrentWeek)("commodities", currentDate);
|
|
133
|
+
const summary = `Sunday 6:10 pm - Friday 5:00 pm ET (Daily break: 5:00 pm - 6:10 pm ET)`;
|
|
79
134
|
return { open, lowLiq, holidays, summary };
|
|
80
135
|
};
|
|
81
136
|
exports.buildCommoditiesWeeklySchedule = buildCommoditiesWeeklySchedule;
|
|
@@ -23,7 +23,7 @@ const isOpenAt = (market, date, opts) => {
|
|
|
23
23
|
if (holiday) {
|
|
24
24
|
return inInAnyWindow(mm, holiday.openWindows);
|
|
25
25
|
}
|
|
26
|
-
return inInAnyWindow(mm,
|
|
26
|
+
return inInAnyWindow(mm, schedule.open[dayKey]);
|
|
27
27
|
};
|
|
28
28
|
exports.isOpenAt = isOpenAt;
|
|
29
29
|
const isLowLiquidityAt = (market, date, opts) => {
|
|
@@ -31,6 +31,6 @@ const isLowLiquidityAt = (market, date, opts) => {
|
|
|
31
31
|
const schedule = (0, index_1.getWeeklySchedule)(market, date, opts);
|
|
32
32
|
const dayKey = weekdayKey(dt.weekday);
|
|
33
33
|
const mm = dt.hour * 60 + dt.minute;
|
|
34
|
-
return inInAnyWindow(mm,
|
|
34
|
+
return inInAnyWindow(mm, schedule.lowLiq[dayKey]);
|
|
35
35
|
};
|
|
36
36
|
exports.isLowLiquidityAt = isLowLiquidityAt;
|
|
@@ -4,7 +4,18 @@ exports.getHolidaysInCurrentWeek = exports.getHolidays = void 0;
|
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
5
|
const ET = luxon_1.IANAZone.create("America/New_York");
|
|
6
6
|
const full = (year, month, day, name) => ({ year, month, day, name, openWindows: [] });
|
|
7
|
-
const partial = (year, month, day, name, startH, startM, endH, endM) => ({
|
|
7
|
+
const partial = (year, month, day, name, startH, startM, endH, endM) => ({
|
|
8
|
+
year,
|
|
9
|
+
month,
|
|
10
|
+
day,
|
|
11
|
+
name,
|
|
12
|
+
openWindows: [
|
|
13
|
+
{
|
|
14
|
+
start: { hour: startH, minute: startM },
|
|
15
|
+
end: { hour: endH, minute: endM },
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
});
|
|
8
19
|
// Shared holidays
|
|
9
20
|
const HOLIDAYS = [
|
|
10
21
|
// 2025
|
|
@@ -19,17 +30,18 @@ const HOLIDAYS = [
|
|
|
19
30
|
// 2026
|
|
20
31
|
full(2026, 1, 1, "New Year's Day"),
|
|
21
32
|
full(2026, 1, 19, "Martin Luther King Jr. Day"),
|
|
22
|
-
full(2026, 2, 16, "Presidents' Day"),
|
|
23
33
|
full(2026, 4, 3, "Good Friday"),
|
|
24
34
|
];
|
|
25
35
|
// Market-specific holiday overrides
|
|
26
36
|
const HOLIDAYS_OVERRIDES = {
|
|
27
37
|
stocks: [
|
|
28
38
|
partial(2025, 12, 24, "Christmas Eve", 9, 30, 13, 0),
|
|
39
|
+
full(2026, 2, 16, "Presidents' Day"),
|
|
29
40
|
],
|
|
30
41
|
indices: [
|
|
31
42
|
partial(2025, 12, 24, "Christmas Eve", 9, 30, 12, 15),
|
|
32
43
|
partial(2025, 12, 31, "New Year's Eve", 0, 0, 16, 0),
|
|
44
|
+
full(2026, 2, 16, "Presidents' Day"),
|
|
33
45
|
],
|
|
34
46
|
commodities: [
|
|
35
47
|
// MLK Jr. Day: Open until 1 PM ET, closed from 1-6 PM ET, then reopens at 6 PM ET
|
|
@@ -40,11 +52,22 @@ const HOLIDAYS_OVERRIDES = {
|
|
|
40
52
|
name: "Martin Luther King Jr. Day",
|
|
41
53
|
openWindows: [
|
|
42
54
|
{ start: { hour: 0, minute: 0 }, end: { hour: 13, minute: 0 } },
|
|
43
|
-
{ start: { hour: 18, minute: 0 }, end: { hour: 24, minute: 0 } }
|
|
44
|
-
]
|
|
55
|
+
{ start: { hour: 18, minute: 0 }, end: { hour: 24, minute: 0 } },
|
|
56
|
+
],
|
|
45
57
|
},
|
|
46
58
|
partial(2025, 12, 24, "Christmas Eve", 0, 0, 12, 45),
|
|
47
59
|
partial(2025, 12, 31, "New Year's Eve", 0, 0, 16, 0),
|
|
60
|
+
// Presidents' Day: Open until 2:30 ET, closed from 2:30-6 PM ET, then reopens at 6 PM ET
|
|
61
|
+
{
|
|
62
|
+
year: 2026,
|
|
63
|
+
month: 2,
|
|
64
|
+
day: 16,
|
|
65
|
+
name: "Presidents' Day",
|
|
66
|
+
openWindows: [
|
|
67
|
+
{ start: { hour: 0, minute: 0 }, end: { hour: 14, minute: 30 } },
|
|
68
|
+
{ start: { hour: 18, minute: 0 }, end: { hour: 24, minute: 0 } },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
48
71
|
],
|
|
49
72
|
forex: [
|
|
50
73
|
partial(2025, 12, 24, "Christmas Eve", 0, 0, 12, 45),
|
|
@@ -58,7 +81,7 @@ const getHolidaysForYear = (market, year) => {
|
|
|
58
81
|
return [...filteredHolidays, ...holidayOverrides].sort((a, b) => a.month === b.month ? a.day - b.day : a.month - b.month);
|
|
59
82
|
};
|
|
60
83
|
const getHolidays = (market, startDate, days) => {
|
|
61
|
-
const start = luxon_1.DateTime.fromJSDate(startDate).setZone(ET).startOf(
|
|
84
|
+
const start = luxon_1.DateTime.fromJSDate(startDate).setZone(ET).startOf("day");
|
|
62
85
|
const end = start.plus({ days });
|
|
63
86
|
const years = [];
|
|
64
87
|
for (let year = start.year; year <= end.year; year++) {
|
|
@@ -71,7 +94,9 @@ const getHolidays = (market, startDate, days) => {
|
|
|
71
94
|
};
|
|
72
95
|
exports.getHolidays = getHolidays;
|
|
73
96
|
const getHolidaysInCurrentWeek = (market, currentDate) => {
|
|
74
|
-
const weekStart = luxon_1.DateTime.fromJSDate(currentDate)
|
|
97
|
+
const weekStart = luxon_1.DateTime.fromJSDate(currentDate)
|
|
98
|
+
.setZone(ET)
|
|
99
|
+
.startOf("week");
|
|
75
100
|
return (0, exports.getHolidays)(market, weekStart.toJSDate(), 7);
|
|
76
101
|
};
|
|
77
102
|
exports.getHolidaysInCurrentWeek = getHolidaysInCurrentWeek;
|
package/lib/markets/stocks.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.getUSMarketsNow = exports.isStocksOpen = void 0;
|
|
|
7
7
|
const luxon_1 = require("luxon");
|
|
8
8
|
const schedules_1 = require("./schedules");
|
|
9
9
|
const STOCKS_MARKETS_TIME_ZONE_IANA = luxon_1.IANAZone.create("America/New_York");
|
|
10
|
-
const isStocksOpen = (dateToCheck) => (0, schedules_1.isOpenAt)(
|
|
10
|
+
const isStocksOpen = (dateToCheck) => (0, schedules_1.isOpenAt)("stocks", dateToCheck);
|
|
11
11
|
exports.isStocksOpen = isStocksOpen;
|
|
12
12
|
const getUSMarketsNow = () => {
|
|
13
13
|
return luxon_1.DateTime.now().setZone(STOCKS_MARKETS_TIME_ZONE_IANA);
|