@rivascva/dt-idl 1.1.192 → 1.1.194

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -142,6 +142,23 @@ interface paths$3 {
142
142
  patch?: never;
143
143
  trace?: never;
144
144
  };
145
+ "/stocks/splits": {
146
+ parameters: {
147
+ query?: never;
148
+ header?: never;
149
+ path?: never;
150
+ cookie?: never;
151
+ };
152
+ /** @description Gets the market stock splits */
153
+ get: operations$3["getStockSplits"];
154
+ put?: never;
155
+ post?: never;
156
+ delete?: never;
157
+ options?: never;
158
+ head?: never;
159
+ patch?: never;
160
+ trace?: never;
161
+ };
145
162
  "/stocks/search": {
146
163
  parameters: {
147
164
  query?: never;
@@ -295,6 +312,23 @@ interface components$3 {
295
312
  /** @example USA */
296
313
  country: string;
297
314
  };
315
+ /** @description An upcoming stock split */
316
+ StockSplit: {
317
+ /** @example AAPL */
318
+ symbol: string;
319
+ /** @example 2026-05-15 */
320
+ date: string;
321
+ /**
322
+ * Format: double
323
+ * @example 4
324
+ */
325
+ numerator: number;
326
+ /**
327
+ * Format: double
328
+ * @example 1
329
+ */
330
+ denominator: number;
331
+ };
298
332
  /** @description A stock history chart entry */
299
333
  StockHistoryEntry: {
300
334
  /** @example 2024-12-24T02:30:00Z */
@@ -614,6 +648,33 @@ interface operations$3 {
614
648
  500: components$3["responses"]["InternalServerError"];
615
649
  };
616
650
  };
651
+ getStockSplits: {
652
+ parameters: {
653
+ query: {
654
+ /** @description The stock split from date */
655
+ from: string;
656
+ /** @description The stock split to date */
657
+ to: string;
658
+ };
659
+ header?: never;
660
+ path?: never;
661
+ cookie?: never;
662
+ };
663
+ requestBody?: never;
664
+ responses: {
665
+ /** @description Success */
666
+ 200: {
667
+ headers: {
668
+ [name: string]: unknown;
669
+ };
670
+ content: {
671
+ "application/json": components$3["schemas"]["StockSplit"][];
672
+ };
673
+ };
674
+ 404: components$3["responses"]["NotFound"];
675
+ 500: components$3["responses"]["InternalServerError"];
676
+ };
677
+ };
617
678
  getSearchStocks: {
618
679
  parameters: {
619
680
  query: {
@@ -2135,6 +2196,8 @@ type GetSearchStocksQueryParams = operations$3['getSearchStocks']['parameters'][
2135
2196
  type GetStockHistoryQueryParams = operations$3['getStockHistory']['parameters']['query'];
2136
2197
  type MarketMetadata = MarketServiceSchemas['MarketMetadata'];
2137
2198
  type MarketHours = MarketServiceSchemas['MarketHours'];
2199
+ type StockSplit = MarketServiceSchemas['StockSplit'];
2200
+ type GetStockSplitsQueryParams = operations$3['getStockSplits']['parameters']['query'];
2138
2201
  type Portfolio = TradeServiceSchemas['Portfolio'];
2139
2202
  type PortfolioType = TradeServiceSchemas['PortfolioType'];
2140
2203
  type UpdatePortfolioPayload = TradeServiceSchemas['UpdatePortfolioPayload'];
@@ -2164,4 +2227,4 @@ type UploadImageResponse = AssetServiceSchemas['UploadImageResponse'];
2164
2227
  type DeleteImagePayload = AssetServiceSchemas['DeleteImagePayload'];
2165
2228
  type AssetServiceError = AssetServiceSchemas['Error'];
2166
2229
 
2167
- export { type AddOrderPayload, type AddUserPayload, type AssetServiceError, type DeleteImagePayload, type FullQuote, type GetIndexesQueryParams, type GetOrdersByPortfolioParams, type GetPortfolioHistoryParams, type GetSearchStocksQueryParams, type GetStockHistoryQueryParams, type GetStocksBySymbolsQueryParams, type Holding, type ImageType, type Index, type LoginWithFirebasePayload, type LogoutPayload, type MarketHours, type MarketMetadata, type MarketServiceError, type NewsArticle, type Order, type OrderType, type Portfolio, type PortfolioHistoryTimeframe, type PortfolioHistoryValue, type PortfolioType, type RefreshAccessTokenPayload, type SendPushNotificationPayload, type SignupWithFirebasePayload, type SimpleQuote, type SortField, type SortOrder, type StockHistoryEntry, type StockHistoryTimeframe, type StockNewsArticle, type SubmitUserFeedbackPayload, type TradeServiceError, type UpdatePortfolioPayload, type UpdateUserDevicePayload, type UpdateUserPayload, type UploadImagePayload, type UploadImageResponse, type User, type UserServiceError, createAssetServiceClient, createMarketServiceClient, createTradeServiceClient, createUserServiceClient, isAssetServiceError, isMarketServiceError, isTradeServiceError, isUserServiceError };
2230
+ export { type AddOrderPayload, type AddUserPayload, type AssetServiceError, type DeleteImagePayload, type FullQuote, type GetIndexesQueryParams, type GetOrdersByPortfolioParams, type GetPortfolioHistoryParams, type GetSearchStocksQueryParams, type GetStockHistoryQueryParams, type GetStockSplitsQueryParams, type GetStocksBySymbolsQueryParams, type Holding, type ImageType, type Index, type LoginWithFirebasePayload, type LogoutPayload, type MarketHours, type MarketMetadata, type MarketServiceError, type NewsArticle, type Order, type OrderType, type Portfolio, type PortfolioHistoryTimeframe, type PortfolioHistoryValue, type PortfolioType, type RefreshAccessTokenPayload, type SendPushNotificationPayload, type SignupWithFirebasePayload, type SimpleQuote, type SortField, type SortOrder, type StockHistoryEntry, type StockHistoryTimeframe, type StockNewsArticle, type StockSplit, type SubmitUserFeedbackPayload, type TradeServiceError, type UpdatePortfolioPayload, type UpdateUserDevicePayload, type UpdateUserPayload, type UploadImagePayload, type UploadImageResponse, type User, type UserServiceError, createAssetServiceClient, createMarketServiceClient, createTradeServiceClient, createUserServiceClient, isAssetServiceError, isMarketServiceError, isTradeServiceError, isUserServiceError };
@@ -79,6 +79,21 @@ Each service has a `.github/workflows/lambda-deploy.yaml` that triggers on:
79
79
 
80
80
  Services with asynchronous flows use a **matrix strategy** to deploy multiple Lambda functions from a single workflow run.
81
81
 
82
+ ### GitHub Access Token (`GH_ACCESS_TOKEN`)
83
+
84
+ Because `dt-idl` is a private repository, each service repo requires a **GitHub Personal Access Token** (stored as the `GH_ACCESS_TOKEN` secret) to interact with it. This token is used in two contexts:
85
+
86
+ 1. **Local / CI code generation (`make api` & `make clients`)**
87
+ Each service's Makefile pulls OpenAPI specs from `dt-idl` to generate API handler templates and typed clients. These commands fetch from the private `dt-idl` repo, which requires authenticated access via the token.
88
+ 2. **Lambda deploy workflow (private Go module resolution)**
89
+ During the build step, `go build` needs to download the private `dt-idl` Go modules (e.g., `github.com/RivasCVA/dt-idl/go/...`). The workflow configures Git to embed the token in HTTPS URLs. This allows `go build` to authenticate when fetching the private module.
90
+
91
+ **Generating the token:**
92
+
93
+ 1. Go to **GitHub > Settings > Developer settings > Personal access tokens > Fine-grained tokens**.
94
+ 2. Create a token scoped to the `dt-idl` repository with **Contents: Read** permission.
95
+ 3. Add it as a repository secret named `GH_ACCESS_TOKEN` in each service repo (**Settings > Secrets and variables > Actions**).
96
+
82
97
  ### Environment Variables
83
98
 
84
99
  Each service's environment variables are managed via **GitHub Settings > Secrets and Variables** in its respective repository. The deployment workflow reads these secrets/variables at deploy time and pushes them to the Lambda function configuration.
@@ -40,6 +40,106 @@ const (
40
40
  MarketCloseGracePeriod = 2 * time.Minute
41
41
  )
42
42
 
43
+ var (
44
+ // MarketHolidays is a map of future market holidays.
45
+ // The key is the date of the holiday in YYYY-MM-DD format (based on the timezone specified in MarketTimezone).
46
+ // The value is the information about the holiday.
47
+ MarketHolidays = map[string]MarketHolidayInfo{
48
+ "2026-01-01": {
49
+ Name: "New Year's Day",
50
+ CloseTime: "",
51
+ },
52
+ "2026-01-19": {
53
+ Name: "Martin Luther King, Jr. Day",
54
+ CloseTime: "",
55
+ },
56
+ "2026-02-16": {
57
+ Name: "Presidents' Day",
58
+ CloseTime: "",
59
+ },
60
+ "2026-04-03": {
61
+ Name: "Good Friday",
62
+ CloseTime: "",
63
+ },
64
+ "2026-05-25": {
65
+ Name: "Memorial Day",
66
+ CloseTime: "",
67
+ },
68
+ "2026-06-19": {
69
+ Name: "Juneteenth National Independence Day",
70
+ CloseTime: "",
71
+ },
72
+ "2026-07-03": {
73
+ Name: "Independence Day (Observed)",
74
+ CloseTime: "",
75
+ },
76
+ "2026-09-07": {
77
+ Name: "Labor Day",
78
+ CloseTime: "",
79
+ },
80
+ "2026-11-26": {
81
+ Name: "Thanksgiving Day",
82
+ CloseTime: "",
83
+ },
84
+ "2026-11-27": {
85
+ Name: "Friday after Thanksgiving",
86
+ CloseTime: "13:00",
87
+ },
88
+ "2026-12-24": {
89
+ Name: "Christmas Eve",
90
+ CloseTime: "13:00",
91
+ },
92
+ "2026-12-25": {
93
+ Name: "Christmas Day",
94
+ CloseTime: "",
95
+ },
96
+ "2027-01-01": {
97
+ Name: "New Year's Day",
98
+ CloseTime: "",
99
+ },
100
+ "2027-01-18": {
101
+ Name: "Martin Luther King, Jr. Day",
102
+ CloseTime: "",
103
+ },
104
+ "2027-02-15": {
105
+ Name: "Presidents' Day",
106
+ CloseTime: "",
107
+ },
108
+ "2027-03-26": {
109
+ Name: "Good Friday",
110
+ CloseTime: "",
111
+ },
112
+ "2027-05-31": {
113
+ Name: "Memorial Day",
114
+ CloseTime: "",
115
+ },
116
+ "2027-06-18": {
117
+ Name: "Juneteenth National Independence Day (Observed)",
118
+ CloseTime: "",
119
+ },
120
+ "2027-07-05": {
121
+ Name: "Independence Day (Observed)",
122
+ CloseTime: "",
123
+ },
124
+ "2027-09-06": {
125
+ Name: "Labor Day",
126
+ CloseTime: "",
127
+ },
128
+ "2027-11-25": {
129
+ Name: "Thanksgiving Day",
130
+ CloseTime: "",
131
+ },
132
+ "2027-11-26": {
133
+ Name: "Friday after Thanksgiving",
134
+ CloseTime: "13:00",
135
+ },
136
+ "2027-12-24": {
137
+ Name: "Christmas Day (Observed)",
138
+ CloseTime: "",
139
+ },
140
+ }
141
+ )
142
+
43
143
  var (
44
144
  // PortfolioDefaultCash is the default cash for new portfolios.
45
145
  PortfolioDefaultCash = float64(50000)
@@ -0,0 +1,12 @@
1
+ package models
2
+
3
+ // MarketHolidayInfo contains information about a market holiday.
4
+ type MarketHolidayInfo struct {
5
+ // Name is the name of the holiday.
6
+ Name string
7
+ // CloseTime is the time the market closes on the holiday in a 24-hour format (HH:mm).
8
+ // Based on the timezone specified in MarketTimezone.
9
+ // For some holidays, the market may simply close early.
10
+ // The value will be empty if the market closes the entire day.
11
+ CloseTime string
12
+ }
@@ -66,6 +66,25 @@ func isMarketHoursWithOpenAndCloseOffsets(now time.Time, openOffset time.Duratio
66
66
  return false, fmt.Errorf("unable to parse the close minute: %w", err)
67
67
  }
68
68
 
69
+ // check if on a market holiday
70
+ if holidayInfo, ok := models.MarketHolidays[now.Format("2006-01-02")]; ok {
71
+ if holidayInfo.CloseTime == "" {
72
+ // the market closes the entire day
73
+ return false, nil
74
+ } else {
75
+ // the market closes early, so set the close time to the holiday close time
76
+ holidayCloseTimeParts := strings.Split(holidayInfo.CloseTime, ":")
77
+ closeHour, err = strconv.Atoi(holidayCloseTimeParts[0])
78
+ if err != nil {
79
+ return false, fmt.Errorf("unable to parse the holiday close hour: %w", err)
80
+ }
81
+ closeMinute, err = strconv.Atoi(holidayCloseTimeParts[1])
82
+ if err != nil {
83
+ return false, fmt.Errorf("unable to parse the holiday close minute: %w", err)
84
+ }
85
+ }
86
+ }
87
+
69
88
  // create the open time with the offset
70
89
  openTime := time.Date(now.Year(), now.Month(), now.Day(), openHour, openMinute, 0, 0, loc)
71
90
  openWithOffset := openTime.Add(openOffset)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.192",
3
+ "version": "1.1.194",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -234,6 +234,41 @@ paths:
234
234
  500:
235
235
  $ref: '#/components/responses/InternalServerError'
236
236
 
237
+ /stocks/splits:
238
+ get:
239
+ description: Gets the market stock splits
240
+ operationId: getStockSplits
241
+ tags:
242
+ - Stocks
243
+ parameters:
244
+ - in: query
245
+ name: from
246
+ description: The stock split from date
247
+ required: true
248
+ schema:
249
+ type: string
250
+ example: 2026-05-01
251
+ - in: query
252
+ name: to
253
+ description: The stock split to date
254
+ required: true
255
+ schema:
256
+ type: string
257
+ example: 2026-05-31
258
+ responses:
259
+ 200:
260
+ description: Success
261
+ content:
262
+ application/json:
263
+ schema:
264
+ type: array
265
+ items:
266
+ $ref: '#/components/schemas/StockSplit'
267
+ 404:
268
+ $ref: '#/components/responses/NotFound'
269
+ 500:
270
+ $ref: '#/components/responses/InternalServerError'
271
+
237
272
  /stocks/search:
238
273
  get:
239
274
  description: Gets the simple quotes that fuzzy match the search query
@@ -459,6 +494,29 @@ components:
459
494
  - state
460
495
  - country
461
496
 
497
+ StockSplit:
498
+ description: An upcoming stock split
499
+ properties:
500
+ symbol:
501
+ type: string
502
+ example: AAPL
503
+ date:
504
+ type: string
505
+ example: 2026-05-15
506
+ numerator:
507
+ type: number
508
+ format: double
509
+ example: 4
510
+ denominator:
511
+ type: number
512
+ format: double
513
+ example: 1
514
+ required:
515
+ - symbol
516
+ - date
517
+ - numerator
518
+ - denominator
519
+
462
520
  StockHistoryEntry:
463
521
  description: A stock history chart entry
464
522
  properties:
@@ -140,6 +140,23 @@ export interface paths {
140
140
  patch?: never;
141
141
  trace?: never;
142
142
  };
143
+ "/stocks/splits": {
144
+ parameters: {
145
+ query?: never;
146
+ header?: never;
147
+ path?: never;
148
+ cookie?: never;
149
+ };
150
+ /** @description Gets the market stock splits */
151
+ get: operations["getStockSplits"];
152
+ put?: never;
153
+ post?: never;
154
+ delete?: never;
155
+ options?: never;
156
+ head?: never;
157
+ patch?: never;
158
+ trace?: never;
159
+ };
143
160
  "/stocks/search": {
144
161
  parameters: {
145
162
  query?: never;
@@ -294,6 +311,23 @@ export interface components {
294
311
  /** @example USA */
295
312
  country: string;
296
313
  };
314
+ /** @description An upcoming stock split */
315
+ StockSplit: {
316
+ /** @example AAPL */
317
+ symbol: string;
318
+ /** @example 2026-05-15 */
319
+ date: string;
320
+ /**
321
+ * Format: double
322
+ * @example 4
323
+ */
324
+ numerator: number;
325
+ /**
326
+ * Format: double
327
+ * @example 1
328
+ */
329
+ denominator: number;
330
+ };
297
331
  /** @description A stock history chart entry */
298
332
  StockHistoryEntry: {
299
333
  /** @example 2024-12-24T02:30:00Z */
@@ -614,6 +648,33 @@ export interface operations {
614
648
  500: components["responses"]["InternalServerError"];
615
649
  };
616
650
  };
651
+ getStockSplits: {
652
+ parameters: {
653
+ query: {
654
+ /** @description The stock split from date */
655
+ from: string;
656
+ /** @description The stock split to date */
657
+ to: string;
658
+ };
659
+ header?: never;
660
+ path?: never;
661
+ cookie?: never;
662
+ };
663
+ requestBody?: never;
664
+ responses: {
665
+ /** @description Success */
666
+ 200: {
667
+ headers: {
668
+ [name: string]: unknown;
669
+ };
670
+ content: {
671
+ "application/json": components["schemas"]["StockSplit"][];
672
+ };
673
+ };
674
+ 404: components["responses"]["NotFound"];
675
+ 500: components["responses"]["InternalServerError"];
676
+ };
677
+ };
617
678
  getSearchStocks: {
618
679
  parameters: {
619
680
  query: {
package/ts/types/types.ts CHANGED
@@ -31,6 +31,8 @@ export type GetSearchStocksQueryParams = MarketServiceOperations['getSearchStock
31
31
  export type GetStockHistoryQueryParams = MarketServiceOperations['getStockHistory']['parameters']['query'];
32
32
  export type MarketMetadata = MarketServiceSchemas['MarketMetadata'];
33
33
  export type MarketHours = MarketServiceSchemas['MarketHours'];
34
+ export type StockSplit = MarketServiceSchemas['StockSplit'];
35
+ export type GetStockSplitsQueryParams = MarketServiceOperations['getStockSplits']['parameters']['query'];
34
36
 
35
37
  // Trade Service Types
36
38
  export type Portfolio = TradeServiceSchemas['Portfolio'];