@rivascva/dt-idl 1.0.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.
@@ -0,0 +1,366 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+
7
+ export interface paths {
8
+ "/stocks/{symbol}": {
9
+ /** @description Gets the full quote for the given stock symbol */
10
+ get: operations["getStock"];
11
+ };
12
+ "/stocks/{symbol}/history": {
13
+ /** @description Gets the price history chart for the given stock symbol */
14
+ get: operations["getStockHistory"];
15
+ };
16
+ "/stocks/by-symbols/{symbols}": {
17
+ /** @description Gets the simple quotes for the given stock symbols */
18
+ get: operations["getStocksBySymbols"];
19
+ };
20
+ "/stocks/by-exchange/{exchange}": {
21
+ /** @description Gets the simple quotes for the given stock exchange */
22
+ get: operations["getStocksByExchange"];
23
+ };
24
+ "/stocks/search": {
25
+ /** @description Gets the simple quotes that fuzzy match the search query */
26
+ get: operations["searchStocks"];
27
+ };
28
+ "/news": {
29
+ /** @description Gets the latest news articles */
30
+ get: operations["getNews"];
31
+ };
32
+ "/news/by-symbols/{symbols}": {
33
+ /** @description Gets the latest stock news articles for the given stock symbols */
34
+ get: operations["getNewsBySymbols"];
35
+ };
36
+ }
37
+
38
+ export type webhooks = Record<string, never>;
39
+
40
+ export interface components {
41
+ schemas: {
42
+ /** @description A simple stock quote */
43
+ SimpleQuote: {
44
+ /** @example AAPL */
45
+ symbol: string;
46
+ /** @example Apple Inc */
47
+ name: string;
48
+ /**
49
+ * Format: double
50
+ * @example 182.25
51
+ */
52
+ price: number;
53
+ /**
54
+ * Format: double
55
+ * @example 1.25
56
+ */
57
+ percentChange: number;
58
+ };
59
+ /** @description A full stock quote */
60
+ FullQuote: components["schemas"]["SimpleQuote"] & {
61
+ /**
62
+ * Format: double
63
+ * @example 180.75
64
+ */
65
+ previousClose: number;
66
+ /**
67
+ * Format: double
68
+ * @example 180.75
69
+ */
70
+ open: number;
71
+ /**
72
+ * Format: double
73
+ * @example 178.25
74
+ */
75
+ dayLow: number;
76
+ /**
77
+ * Format: double
78
+ * @example 185.75
79
+ */
80
+ dayHigh: number;
81
+ /**
82
+ * Format: double
83
+ * @example 165.25
84
+ */
85
+ weekLow52: number;
86
+ /**
87
+ * Format: double
88
+ * @example 192.75
89
+ */
90
+ weekHigh52: number;
91
+ /**
92
+ * Format: int64
93
+ * @example 164000000
94
+ */
95
+ volume: number;
96
+ /**
97
+ * Format: int64
98
+ * @example 62000000
99
+ */
100
+ averageVolume: number;
101
+ /**
102
+ * Format: int64
103
+ * @example 28000000000
104
+ */
105
+ marketCap: number;
106
+ /**
107
+ * Format: double
108
+ * @example 28.25
109
+ */
110
+ pe: number;
111
+ /**
112
+ * Format: double
113
+ * @example 6.75
114
+ */
115
+ eps: number;
116
+ /** @example Apple designs and manufactures smartphones. */
117
+ description: string;
118
+ /** @example Timothy Cook */
119
+ ceo: string;
120
+ /** @example Technology */
121
+ sector: string;
122
+ /** @example Consumer Electronics */
123
+ industry: string;
124
+ /** @example Cupertino */
125
+ city: string;
126
+ /** @example California */
127
+ state: string;
128
+ /** @example USA */
129
+ country: string;
130
+ };
131
+ /** @description A stock history chart entry */
132
+ HistoryChartEntry: {
133
+ /** @example "2024-12-24T02:30:00.000Z" */
134
+ date: string;
135
+ /**
136
+ * Format: double
137
+ * @example 175.25
138
+ */
139
+ open: number;
140
+ /**
141
+ * Format: double
142
+ * @example 172.75
143
+ */
144
+ low: number;
145
+ /**
146
+ * Format: double
147
+ * @example 185.25
148
+ */
149
+ high: number;
150
+ /**
151
+ * Format: double
152
+ * @example 180.75
153
+ */
154
+ close: number;
155
+ };
156
+ /** @description A news article */
157
+ NewsArticle: {
158
+ /** @example Apple Watches Recalled */
159
+ title: string;
160
+ /** @example Apple Watches are being recalled worldwide */
161
+ description: string;
162
+ /**
163
+ * Format: int64
164
+ * @example 1709500000000
165
+ */
166
+ date: number;
167
+ /** @example https://news.com/articles/abc */
168
+ link: string;
169
+ /** @example https://news.com/articles/abc/image.png */
170
+ thumbnail: string;
171
+ };
172
+ /** @description A stock news article */
173
+ StockNewsArticle: components["schemas"]["NewsArticle"] & {
174
+ /** @example AAPL */
175
+ symbol: string;
176
+ };
177
+ /** @description A generic error */
178
+ Error: {
179
+ /**
180
+ * Format: int64
181
+ * @example 500
182
+ */
183
+ status: number;
184
+ /** @example ERROR */
185
+ code: components["schemas"]["ErrorCode"];
186
+ /** @example Error */
187
+ message: string;
188
+ };
189
+ /** @enum {string} */
190
+ ErrorCode: "ERROR";
191
+ /** @enum {string} */
192
+ HistoryTimeframe: "MIN5" | "MIN15" | "MIN30" | "HOUR1" | "HOUR4" | "DAY1";
193
+ };
194
+ responses: {
195
+ /** @description The resource was not found */
196
+ NotFound: {
197
+ content: {
198
+ "application/json": components["schemas"]["Error"];
199
+ };
200
+ };
201
+ /** @description There was an internal server error */
202
+ InternalServerError: {
203
+ content: {
204
+ "application/json": components["schemas"]["Error"];
205
+ };
206
+ };
207
+ };
208
+ parameters: never;
209
+ requestBodies: never;
210
+ headers: never;
211
+ pathItems: never;
212
+ }
213
+
214
+ export type $defs = Record<string, never>;
215
+
216
+ export type external = Record<string, never>;
217
+
218
+ export interface operations {
219
+
220
+ /** @description Gets the full quote for the given stock symbol */
221
+ getStock: {
222
+ parameters: {
223
+ path: {
224
+ /** @description The stock symbol */
225
+ symbol: string;
226
+ };
227
+ };
228
+ responses: {
229
+ /** @description Success */
230
+ 200: {
231
+ content: {
232
+ "application/json": components["schemas"]["FullQuote"];
233
+ };
234
+ };
235
+ 404: components["responses"]["NotFound"];
236
+ 500: components["responses"]["InternalServerError"];
237
+ };
238
+ };
239
+ /** @description Gets the price history chart for the given stock symbol */
240
+ getStockHistory: {
241
+ parameters: {
242
+ query: {
243
+ /** @description The stock history timeframe */
244
+ timeframe: components["schemas"]["HistoryTimeframe"];
245
+ /** @description The stock history from date */
246
+ from: string;
247
+ /** @description The stock history to date */
248
+ to: string;
249
+ };
250
+ path: {
251
+ /** @description The stock symbol */
252
+ symbol: string;
253
+ };
254
+ };
255
+ responses: {
256
+ /** @description Success */
257
+ 200: {
258
+ content: {
259
+ "application/json": components["schemas"]["HistoryChartEntry"][];
260
+ };
261
+ };
262
+ 404: components["responses"]["NotFound"];
263
+ 500: components["responses"]["InternalServerError"];
264
+ };
265
+ };
266
+ /** @description Gets the simple quotes for the given stock symbols */
267
+ getStocksBySymbols: {
268
+ parameters: {
269
+ path: {
270
+ /** @description The stock symbols */
271
+ symbols: string;
272
+ };
273
+ };
274
+ responses: {
275
+ /** @description Success */
276
+ 200: {
277
+ content: {
278
+ "application/json": components["schemas"]["SimpleQuote"][];
279
+ };
280
+ };
281
+ 404: components["responses"]["NotFound"];
282
+ 500: components["responses"]["InternalServerError"];
283
+ };
284
+ };
285
+ /** @description Gets the simple quotes for the given stock exchange */
286
+ getStocksByExchange: {
287
+ parameters: {
288
+ path: {
289
+ /** @description The stock exchange */
290
+ exchange: string;
291
+ };
292
+ };
293
+ responses: {
294
+ /** @description Success */
295
+ 200: {
296
+ content: {
297
+ "application/json": components["schemas"]["SimpleQuote"][];
298
+ };
299
+ };
300
+ 404: components["responses"]["NotFound"];
301
+ 500: components["responses"]["InternalServerError"];
302
+ };
303
+ };
304
+ /** @description Gets the simple quotes that fuzzy match the search query */
305
+ searchStocks: {
306
+ parameters: {
307
+ query: {
308
+ /** @description The search query */
309
+ query: string;
310
+ /** @description The maximum number of search results */
311
+ limit?: number;
312
+ };
313
+ };
314
+ responses: {
315
+ /** @description Success */
316
+ 200: {
317
+ content: {
318
+ "application/json": components["schemas"]["SimpleQuote"][];
319
+ };
320
+ };
321
+ 404: components["responses"]["NotFound"];
322
+ 500: components["responses"]["InternalServerError"];
323
+ };
324
+ };
325
+ /** @description Gets the latest news articles */
326
+ getNews: {
327
+ parameters: {
328
+ query?: {
329
+ /** @description The maximum number of articles */
330
+ limit?: number;
331
+ };
332
+ };
333
+ responses: {
334
+ /** @description Success */
335
+ 200: {
336
+ content: {
337
+ "application/json": components["schemas"]["NewsArticle"][];
338
+ };
339
+ };
340
+ 500: components["responses"]["InternalServerError"];
341
+ };
342
+ };
343
+ /** @description Gets the latest stock news articles for the given stock symbols */
344
+ getNewsBySymbols: {
345
+ parameters: {
346
+ query?: {
347
+ /** @description The maximum number of articles */
348
+ limit?: number;
349
+ };
350
+ path: {
351
+ /** @description The stock symbols */
352
+ symbols: string;
353
+ };
354
+ };
355
+ responses: {
356
+ /** @description Success */
357
+ 200: {
358
+ content: {
359
+ "application/json": components["schemas"]["StockNewsArticle"][];
360
+ };
361
+ };
362
+ 404: components["responses"]["NotFound"];
363
+ 500: components["responses"]["InternalServerError"];
364
+ };
365
+ };
366
+ }
@@ -0,0 +1,309 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+
6
+
7
+ export interface paths {
8
+ "/users": {
9
+ /** @description Gets all users */
10
+ get: operations["getUsers"];
11
+ /** @description Adds a new user */
12
+ post: operations["addUser"];
13
+ };
14
+ "/users/{userId}": {
15
+ /** @description Gets a user */
16
+ get: operations["getUser"];
17
+ /** @description Updates an existing user */
18
+ put: operations["updateUser"];
19
+ };
20
+ "/users/{userId}/portfolios": {
21
+ /** @description Gets all portfolios of a user */
22
+ get: operations["getUserPortfolios"];
23
+ };
24
+ "/orders": {
25
+ /** @description Add a new order */
26
+ post: operations["addOrder"];
27
+ };
28
+ }
29
+
30
+ export type webhooks = Record<string, never>;
31
+
32
+ export interface components {
33
+ schemas: {
34
+ /** @description A user payload */
35
+ UserPayload: {
36
+ /** @example sam.smith@example.com */
37
+ email: string;
38
+ /** @example Sam Smith */
39
+ name: string;
40
+ };
41
+ /** @description A user */
42
+ User: components["schemas"]["UserPayload"] & {
43
+ /** @example 123456 */
44
+ id: string;
45
+ /**
46
+ * Format: int64
47
+ * @example 1713398544000
48
+ */
49
+ dateCreated: number;
50
+ /**
51
+ * Format: int64
52
+ * @example 1713398544000
53
+ */
54
+ dateUpdated: number;
55
+ };
56
+ /** @description A trading portfolio */
57
+ Portfolio: {
58
+ /** @example 123456 */
59
+ id: string;
60
+ /** @example 123456 */
61
+ userId: string;
62
+ /** @example PERSONAL */
63
+ type: components["schemas"]["PortfolioType"];
64
+ /**
65
+ * Format: double
66
+ * @example 10500.25
67
+ */
68
+ cash: number;
69
+ holdings: components["schemas"]["Holding"][];
70
+ /**
71
+ * Format: int64
72
+ * @example 1713398544000
73
+ */
74
+ dateCreated: number;
75
+ /**
76
+ * Format: int64
77
+ * @example 1713398544000
78
+ */
79
+ dateUpdated: number;
80
+ };
81
+ /** @description An active stock holding */
82
+ Holding: {
83
+ /** @example 123456 */
84
+ id: string;
85
+ /** @example AAPL */
86
+ symbol: string;
87
+ /**
88
+ * Format: double
89
+ * @example 182.25
90
+ */
91
+ averagePrice: number;
92
+ /**
93
+ * Format: int64
94
+ * @example 10
95
+ */
96
+ quantity: number;
97
+ /**
98
+ * Format: int64
99
+ * @example 1713398544000
100
+ */
101
+ dateCreated: number;
102
+ /**
103
+ * Format: int64
104
+ * @example 1713398544000
105
+ */
106
+ dateUpdated: number;
107
+ };
108
+ /** @description A trade order payload */
109
+ OrderPayload: {
110
+ /** @example 123456 */
111
+ portfolioId: string;
112
+ /** @example BUY */
113
+ type: components["schemas"]["OrderType"];
114
+ /** @example AAPL */
115
+ symbol: string;
116
+ /**
117
+ * Format: double
118
+ * @example 182.25
119
+ */
120
+ targetPrice: number;
121
+ /**
122
+ * Format: int64
123
+ * @example 10
124
+ */
125
+ quantity: number;
126
+ };
127
+ /** @description A trade order */
128
+ Order: components["schemas"]["OrderPayload"] & {
129
+ /** @example 123456 */
130
+ id: string;
131
+ /**
132
+ * Format: double
133
+ * @example 182.25
134
+ */
135
+ actualPrice: number;
136
+ /**
137
+ * Format: int64
138
+ * @example 1713398544000
139
+ */
140
+ dateCreated: number;
141
+ };
142
+ /** @description A generic error */
143
+ Error: {
144
+ /**
145
+ * Format: int64
146
+ * @example 500
147
+ */
148
+ status: number;
149
+ /** @example ERROR */
150
+ code: components["schemas"]["ErrorCode"];
151
+ /** @example Error */
152
+ message: string;
153
+ };
154
+ /** @enum {string} */
155
+ ErrorCode: "ERROR" | "NOT_ENOUGH_CASH" | "NOT_ENOUGH_SHARES" | "REQS_NOT_MET";
156
+ /** @enum {string} */
157
+ PortfolioType: "PERSONAL" | "COMPETITIVE";
158
+ /** @enum {string} */
159
+ OrderType: "BUY_MARKET" | "BUY_LIMIT" | "BUY_STOP" | "SELL_MARKET" | "SELL_LIMIT" | "SELL_STOP";
160
+ };
161
+ responses: {
162
+ /** @description The resource was not found */
163
+ NotFound: {
164
+ content: {
165
+ "application/json": components["schemas"]["Error"];
166
+ };
167
+ };
168
+ /** @description Invalid request payload */
169
+ BadRequest: {
170
+ content: {
171
+ "application/json": components["schemas"]["Error"];
172
+ };
173
+ };
174
+ /** @description There was an internal server error */
175
+ InternalServerError: {
176
+ content: {
177
+ "application/json": components["schemas"]["Error"];
178
+ };
179
+ };
180
+ };
181
+ parameters: never;
182
+ requestBodies: never;
183
+ headers: never;
184
+ pathItems: never;
185
+ }
186
+
187
+ export type $defs = Record<string, never>;
188
+
189
+ export type external = Record<string, never>;
190
+
191
+ export interface operations {
192
+
193
+ /** @description Gets all users */
194
+ getUsers: {
195
+ responses: {
196
+ /** @description Success */
197
+ 200: {
198
+ content: {
199
+ "application/json": components["schemas"]["User"][];
200
+ };
201
+ };
202
+ 404: components["responses"]["NotFound"];
203
+ 500: components["responses"]["InternalServerError"];
204
+ };
205
+ };
206
+ /** @description Adds a new user */
207
+ addUser: {
208
+ /** @description The request body to add a user */
209
+ requestBody: {
210
+ content: {
211
+ "application/json": components["schemas"]["UserPayload"];
212
+ };
213
+ };
214
+ responses: {
215
+ /** @description Added */
216
+ 201: {
217
+ content: {
218
+ "application/json": components["schemas"]["User"];
219
+ };
220
+ };
221
+ 400: components["responses"]["BadRequest"];
222
+ 500: components["responses"]["InternalServerError"];
223
+ };
224
+ };
225
+ /** @description Gets a user */
226
+ getUser: {
227
+ parameters: {
228
+ path: {
229
+ /** @description The user id */
230
+ userId: string;
231
+ };
232
+ };
233
+ responses: {
234
+ /** @description Success */
235
+ 200: {
236
+ content: {
237
+ "application/json": components["schemas"]["User"];
238
+ };
239
+ };
240
+ 404: components["responses"]["NotFound"];
241
+ 500: components["responses"]["InternalServerError"];
242
+ };
243
+ };
244
+ /** @description Updates an existing user */
245
+ updateUser: {
246
+ parameters: {
247
+ path: {
248
+ /** @description The user id */
249
+ userId: string;
250
+ };
251
+ };
252
+ /** @description The request body to updated a user */
253
+ requestBody: {
254
+ content: {
255
+ "application/json": components["schemas"]["UserPayload"];
256
+ };
257
+ };
258
+ responses: {
259
+ /** @description Success */
260
+ 200: {
261
+ content: {
262
+ "application/json": components["schemas"]["User"];
263
+ };
264
+ };
265
+ 400: components["responses"]["BadRequest"];
266
+ 404: components["responses"]["NotFound"];
267
+ 500: components["responses"]["InternalServerError"];
268
+ };
269
+ };
270
+ /** @description Gets all portfolios of a user */
271
+ getUserPortfolios: {
272
+ parameters: {
273
+ path: {
274
+ /** @description The user id */
275
+ userId: string;
276
+ };
277
+ };
278
+ responses: {
279
+ /** @description Success */
280
+ 200: {
281
+ content: {
282
+ "application/json": components["schemas"]["Portfolio"][];
283
+ };
284
+ };
285
+ 404: components["responses"]["NotFound"];
286
+ 500: components["responses"]["InternalServerError"];
287
+ };
288
+ };
289
+ /** @description Add a new order */
290
+ addOrder: {
291
+ /** @description The request body to add an order */
292
+ requestBody: {
293
+ content: {
294
+ "application/json": components["schemas"]["OrderPayload"];
295
+ };
296
+ };
297
+ responses: {
298
+ /** @description Added */
299
+ 201: {
300
+ content: {
301
+ "application/json": components["schemas"]["Order"];
302
+ };
303
+ };
304
+ 400: components["responses"]["BadRequest"];
305
+ 404: components["responses"]["NotFound"];
306
+ 500: components["responses"]["InternalServerError"];
307
+ };
308
+ };
309
+ }
@@ -0,0 +1 @@
1
+ export * from './types';
@@ -0,0 +1,11 @@
1
+ import { components as MarketServiceComponents } from '@ts/services/dt-market-service';
2
+ import { components as TradeServiceComponents } from '@ts/services/dt-trade-service';
3
+
4
+ // Market Service Types
5
+ export type SimpleQuotes = MarketServiceComponents['schemas']['SimpleQuote'];
6
+ export type FullQuotes = MarketServiceComponents['schemas']['FullQuote'];
7
+ export type MarketServiceError = MarketServiceComponents['schemas']['Error'];
8
+
9
+ // Trade Service Types
10
+ export type User = TradeServiceComponents['schemas']['User'];
11
+ export type TradeSErviceError = TradeServiceComponents['schemas']['Error'];
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "moduleResolution": "Node10",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "noUncheckedIndexedAccess": true,
11
+ "baseUrl": ".",
12
+ "paths": {
13
+ "@ts/*": [
14
+ "ts/*"
15
+ ]
16
+ }
17
+ },
18
+ "include": [
19
+ "ts/**/*",
20
+ "rollup.config.ts"
21
+ ]
22
+ }