@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.
- package/.eslintrc.json +35 -0
- package/.githooks/pre-commit-config.yaml +8 -0
- package/.githooks/pre-push-config.yaml +6 -0
- package/.github/workflows/publish.yaml +40 -0
- package/.prettierrc.json +5 -0
- package/.vscode/settings.json +10 -0
- package/Makefile +4 -0
- package/dist/index.cjs.js +464 -0
- package/dist/index.d.ts +690 -0
- package/dist/index.esm.js +461 -0
- package/package.json +39 -0
- package/rollup.config.ts +29 -0
- package/services/dt-market-service.yaml +474 -0
- package/services/dt-trade-service.yaml +388 -0
- package/ts/clients/clients.ts +10 -0
- package/ts/clients/index.ts +1 -0
- package/ts/index.ts +2 -0
- package/ts/services/dt-market-service.ts +366 -0
- package/ts/services/dt-trade-service.ts +309 -0
- package/ts/types/index.ts +1 -0
- package/ts/types/types.ts +11 -0
- package/tsconfig.json +22 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
openapi: 3.0.0
|
|
2
|
+
|
|
3
|
+
info:
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
title: Dream Trade Market Service
|
|
6
|
+
description: Fetch real-time data on the stock market.
|
|
7
|
+
|
|
8
|
+
servers:
|
|
9
|
+
- url: http://localhost:8080/v1
|
|
10
|
+
|
|
11
|
+
paths:
|
|
12
|
+
/stocks/{symbol}:
|
|
13
|
+
get:
|
|
14
|
+
description: Gets the full quote for the given stock symbol
|
|
15
|
+
operationId: getStock
|
|
16
|
+
tags:
|
|
17
|
+
- Stocks
|
|
18
|
+
parameters:
|
|
19
|
+
- in: path
|
|
20
|
+
name: symbol
|
|
21
|
+
description: The stock symbol
|
|
22
|
+
required: true
|
|
23
|
+
schema:
|
|
24
|
+
type: string
|
|
25
|
+
example: AAPL
|
|
26
|
+
responses:
|
|
27
|
+
200:
|
|
28
|
+
description: Success
|
|
29
|
+
content:
|
|
30
|
+
application/json:
|
|
31
|
+
schema:
|
|
32
|
+
type: object
|
|
33
|
+
$ref: "#/components/schemas/FullQuote"
|
|
34
|
+
404:
|
|
35
|
+
$ref: "#/components/responses/NotFound"
|
|
36
|
+
500:
|
|
37
|
+
$ref: "#/components/responses/InternalServerError"
|
|
38
|
+
|
|
39
|
+
/stocks/{symbol}/history:
|
|
40
|
+
get:
|
|
41
|
+
description: Gets the price history chart for the given stock symbol
|
|
42
|
+
operationId: getStockHistory
|
|
43
|
+
tags:
|
|
44
|
+
- Stocks
|
|
45
|
+
parameters:
|
|
46
|
+
- in: path
|
|
47
|
+
name: symbol
|
|
48
|
+
description: The stock symbol
|
|
49
|
+
required: true
|
|
50
|
+
schema:
|
|
51
|
+
type: string
|
|
52
|
+
example: AAPL
|
|
53
|
+
- in: query
|
|
54
|
+
name: timeframe
|
|
55
|
+
description: The stock history timeframe
|
|
56
|
+
required: true
|
|
57
|
+
schema:
|
|
58
|
+
$ref: "#/components/schemas/HistoryTimeframe"
|
|
59
|
+
example: MIN5
|
|
60
|
+
- in: query
|
|
61
|
+
name: from
|
|
62
|
+
description: The stock history from date
|
|
63
|
+
required: true
|
|
64
|
+
schema:
|
|
65
|
+
type: string
|
|
66
|
+
example: 2024-12-24
|
|
67
|
+
- in: query
|
|
68
|
+
name: to
|
|
69
|
+
description: The stock history to date
|
|
70
|
+
required: true
|
|
71
|
+
schema:
|
|
72
|
+
type: string
|
|
73
|
+
example: 2024-12-31
|
|
74
|
+
responses:
|
|
75
|
+
200:
|
|
76
|
+
description: Success
|
|
77
|
+
content:
|
|
78
|
+
application/json:
|
|
79
|
+
schema:
|
|
80
|
+
type: array
|
|
81
|
+
items:
|
|
82
|
+
$ref: "#/components/schemas/HistoryChartEntry"
|
|
83
|
+
404:
|
|
84
|
+
$ref: "#/components/responses/NotFound"
|
|
85
|
+
500:
|
|
86
|
+
$ref: "#/components/responses/InternalServerError"
|
|
87
|
+
|
|
88
|
+
/stocks/by-symbols/{symbols}:
|
|
89
|
+
get:
|
|
90
|
+
description: Gets the simple quotes for the given stock symbols
|
|
91
|
+
operationId: getStocksBySymbols
|
|
92
|
+
tags:
|
|
93
|
+
- Stocks
|
|
94
|
+
parameters:
|
|
95
|
+
- in: path
|
|
96
|
+
name: symbols
|
|
97
|
+
description: The stock symbols
|
|
98
|
+
required: true
|
|
99
|
+
schema:
|
|
100
|
+
type: string
|
|
101
|
+
example: AAPL,MSFT,AMZN
|
|
102
|
+
responses:
|
|
103
|
+
200:
|
|
104
|
+
description: Success
|
|
105
|
+
content:
|
|
106
|
+
application/json:
|
|
107
|
+
schema:
|
|
108
|
+
type: array
|
|
109
|
+
items:
|
|
110
|
+
$ref: "#/components/schemas/SimpleQuote"
|
|
111
|
+
404:
|
|
112
|
+
$ref: "#/components/responses/NotFound"
|
|
113
|
+
500:
|
|
114
|
+
$ref: "#/components/responses/InternalServerError"
|
|
115
|
+
|
|
116
|
+
/stocks/by-exchange/{exchange}:
|
|
117
|
+
get:
|
|
118
|
+
description: Gets the simple quotes for the given stock exchange
|
|
119
|
+
operationId: getStocksByExchange
|
|
120
|
+
tags:
|
|
121
|
+
- Stocks
|
|
122
|
+
parameters:
|
|
123
|
+
- in: path
|
|
124
|
+
name: exchange
|
|
125
|
+
description: The stock exchange
|
|
126
|
+
required: true
|
|
127
|
+
schema:
|
|
128
|
+
type: string
|
|
129
|
+
example: NYSE
|
|
130
|
+
responses:
|
|
131
|
+
200:
|
|
132
|
+
description: Success
|
|
133
|
+
content:
|
|
134
|
+
application/json:
|
|
135
|
+
schema:
|
|
136
|
+
type: array
|
|
137
|
+
items:
|
|
138
|
+
$ref: "#/components/schemas/SimpleQuote"
|
|
139
|
+
404:
|
|
140
|
+
$ref: "#/components/responses/NotFound"
|
|
141
|
+
500:
|
|
142
|
+
$ref: "#/components/responses/InternalServerError"
|
|
143
|
+
|
|
144
|
+
/stocks/search:
|
|
145
|
+
get:
|
|
146
|
+
description: Gets the simple quotes that fuzzy match the search query
|
|
147
|
+
operationId: searchStocks
|
|
148
|
+
tags:
|
|
149
|
+
- Stocks
|
|
150
|
+
parameters:
|
|
151
|
+
- in: query
|
|
152
|
+
name: query
|
|
153
|
+
description: The search query
|
|
154
|
+
required: true
|
|
155
|
+
schema:
|
|
156
|
+
type: string
|
|
157
|
+
example: Micro
|
|
158
|
+
- in: query
|
|
159
|
+
name: limit
|
|
160
|
+
description: The maximum number of search results
|
|
161
|
+
required: false
|
|
162
|
+
schema:
|
|
163
|
+
type: integer
|
|
164
|
+
format: int64
|
|
165
|
+
example: 10
|
|
166
|
+
default: 10
|
|
167
|
+
responses:
|
|
168
|
+
200:
|
|
169
|
+
description: Success
|
|
170
|
+
content:
|
|
171
|
+
application/json:
|
|
172
|
+
schema:
|
|
173
|
+
type: array
|
|
174
|
+
items:
|
|
175
|
+
$ref: "#/components/schemas/SimpleQuote"
|
|
176
|
+
404:
|
|
177
|
+
$ref: "#/components/responses/NotFound"
|
|
178
|
+
500:
|
|
179
|
+
$ref: "#/components/responses/InternalServerError"
|
|
180
|
+
|
|
181
|
+
/news:
|
|
182
|
+
get:
|
|
183
|
+
description: Gets the latest news articles
|
|
184
|
+
operationId: getNews
|
|
185
|
+
tags:
|
|
186
|
+
- News
|
|
187
|
+
parameters:
|
|
188
|
+
- in: query
|
|
189
|
+
name: limit
|
|
190
|
+
description: The maximum number of articles
|
|
191
|
+
required: false
|
|
192
|
+
schema:
|
|
193
|
+
type: integer
|
|
194
|
+
format: int64
|
|
195
|
+
example: 10
|
|
196
|
+
default: 10
|
|
197
|
+
responses:
|
|
198
|
+
200:
|
|
199
|
+
description: Success
|
|
200
|
+
content:
|
|
201
|
+
application/json:
|
|
202
|
+
schema:
|
|
203
|
+
type: array
|
|
204
|
+
items:
|
|
205
|
+
$ref: "#/components/schemas/NewsArticle"
|
|
206
|
+
500:
|
|
207
|
+
$ref: "#/components/responses/InternalServerError"
|
|
208
|
+
|
|
209
|
+
/news/by-symbols/{symbols}:
|
|
210
|
+
get:
|
|
211
|
+
description: Gets the latest stock news articles for the given stock symbols
|
|
212
|
+
operationId: getNewsBySymbols
|
|
213
|
+
tags:
|
|
214
|
+
- News
|
|
215
|
+
parameters:
|
|
216
|
+
- in: path
|
|
217
|
+
name: symbols
|
|
218
|
+
description: The stock symbols
|
|
219
|
+
required: true
|
|
220
|
+
schema:
|
|
221
|
+
type: string
|
|
222
|
+
example: AAPL,MSFT,AMZN
|
|
223
|
+
- in: query
|
|
224
|
+
name: limit
|
|
225
|
+
description: The maximum number of articles
|
|
226
|
+
required: false
|
|
227
|
+
schema:
|
|
228
|
+
type: integer
|
|
229
|
+
format: int64
|
|
230
|
+
example: 10
|
|
231
|
+
default: 10
|
|
232
|
+
responses:
|
|
233
|
+
200:
|
|
234
|
+
description: Success
|
|
235
|
+
content:
|
|
236
|
+
application/json:
|
|
237
|
+
schema:
|
|
238
|
+
type: array
|
|
239
|
+
items:
|
|
240
|
+
$ref: "#/components/schemas/StockNewsArticle"
|
|
241
|
+
404:
|
|
242
|
+
$ref: "#/components/responses/NotFound"
|
|
243
|
+
500:
|
|
244
|
+
$ref: "#/components/responses/InternalServerError"
|
|
245
|
+
|
|
246
|
+
components:
|
|
247
|
+
schemas:
|
|
248
|
+
SimpleQuote:
|
|
249
|
+
description: A simple stock quote
|
|
250
|
+
properties:
|
|
251
|
+
symbol:
|
|
252
|
+
type: string
|
|
253
|
+
example: AAPL
|
|
254
|
+
name:
|
|
255
|
+
type: string
|
|
256
|
+
example: Apple Inc
|
|
257
|
+
price:
|
|
258
|
+
type: number
|
|
259
|
+
format: double
|
|
260
|
+
example: 182.25
|
|
261
|
+
percentChange:
|
|
262
|
+
type: number
|
|
263
|
+
format: double
|
|
264
|
+
example: 1.25
|
|
265
|
+
required:
|
|
266
|
+
- symbol
|
|
267
|
+
- name
|
|
268
|
+
- price
|
|
269
|
+
- percentChange
|
|
270
|
+
|
|
271
|
+
FullQuote:
|
|
272
|
+
description: A full stock quote
|
|
273
|
+
allOf:
|
|
274
|
+
- $ref: "#/components/schemas/SimpleQuote"
|
|
275
|
+
- properties:
|
|
276
|
+
previousClose:
|
|
277
|
+
type: number
|
|
278
|
+
format: double
|
|
279
|
+
example: 180.75
|
|
280
|
+
open:
|
|
281
|
+
type: number
|
|
282
|
+
format: double
|
|
283
|
+
example: 180.75
|
|
284
|
+
dayLow:
|
|
285
|
+
type: number
|
|
286
|
+
format: double
|
|
287
|
+
example: 178.25
|
|
288
|
+
dayHigh:
|
|
289
|
+
type: number
|
|
290
|
+
format: double
|
|
291
|
+
example: 185.75
|
|
292
|
+
weekLow52:
|
|
293
|
+
type: number
|
|
294
|
+
format: double
|
|
295
|
+
example: 165.25
|
|
296
|
+
weekHigh52:
|
|
297
|
+
type: number
|
|
298
|
+
format: double
|
|
299
|
+
example: 192.75
|
|
300
|
+
volume:
|
|
301
|
+
type: integer
|
|
302
|
+
format: int64
|
|
303
|
+
example: 164000000
|
|
304
|
+
averageVolume:
|
|
305
|
+
type: integer
|
|
306
|
+
format: int64
|
|
307
|
+
example: 62000000
|
|
308
|
+
marketCap:
|
|
309
|
+
type: integer
|
|
310
|
+
format: int64
|
|
311
|
+
example: 28000000000
|
|
312
|
+
pe:
|
|
313
|
+
type: number
|
|
314
|
+
format: double
|
|
315
|
+
example: 28.25
|
|
316
|
+
eps:
|
|
317
|
+
type: number
|
|
318
|
+
format: double
|
|
319
|
+
example: 6.75
|
|
320
|
+
description:
|
|
321
|
+
type: string
|
|
322
|
+
example: Apple designs and manufactures smartphones.
|
|
323
|
+
ceo:
|
|
324
|
+
type: string
|
|
325
|
+
example: Timothy Cook
|
|
326
|
+
sector:
|
|
327
|
+
type: string
|
|
328
|
+
example: Technology
|
|
329
|
+
industry:
|
|
330
|
+
type: string
|
|
331
|
+
example: Consumer Electronics
|
|
332
|
+
city:
|
|
333
|
+
type: string
|
|
334
|
+
example: Cupertino
|
|
335
|
+
state:
|
|
336
|
+
type: string
|
|
337
|
+
example: California
|
|
338
|
+
country:
|
|
339
|
+
type: string
|
|
340
|
+
example: USA
|
|
341
|
+
required:
|
|
342
|
+
- previousClose
|
|
343
|
+
- open
|
|
344
|
+
- dayLow
|
|
345
|
+
- dayHigh
|
|
346
|
+
- weekLow52
|
|
347
|
+
- weekHigh52
|
|
348
|
+
- volume
|
|
349
|
+
- averageVolume
|
|
350
|
+
- marketCap
|
|
351
|
+
- pe
|
|
352
|
+
- eps
|
|
353
|
+
- description
|
|
354
|
+
- ceo
|
|
355
|
+
- sector
|
|
356
|
+
- industry
|
|
357
|
+
- city
|
|
358
|
+
- state
|
|
359
|
+
- country
|
|
360
|
+
|
|
361
|
+
HistoryChartEntry:
|
|
362
|
+
description: A stock history chart entry
|
|
363
|
+
properties:
|
|
364
|
+
date:
|
|
365
|
+
type: string
|
|
366
|
+
example: 2024-12-24T02:30:00Z
|
|
367
|
+
open:
|
|
368
|
+
type: number
|
|
369
|
+
format: double
|
|
370
|
+
example: 175.25
|
|
371
|
+
low:
|
|
372
|
+
type: number
|
|
373
|
+
format: double
|
|
374
|
+
example: 172.75
|
|
375
|
+
high:
|
|
376
|
+
type: number
|
|
377
|
+
format: double
|
|
378
|
+
example: 185.25
|
|
379
|
+
close:
|
|
380
|
+
type: number
|
|
381
|
+
format: double
|
|
382
|
+
example: 180.75
|
|
383
|
+
required:
|
|
384
|
+
- date
|
|
385
|
+
- open
|
|
386
|
+
- low
|
|
387
|
+
- high
|
|
388
|
+
- close
|
|
389
|
+
|
|
390
|
+
NewsArticle:
|
|
391
|
+
description: A news article
|
|
392
|
+
properties:
|
|
393
|
+
title:
|
|
394
|
+
type: string
|
|
395
|
+
example: Apple Watches Recalled
|
|
396
|
+
description:
|
|
397
|
+
type: string
|
|
398
|
+
example: Apple Watches are being recalled worldwide
|
|
399
|
+
date:
|
|
400
|
+
type: integer
|
|
401
|
+
format: int64
|
|
402
|
+
example: 1709500000000
|
|
403
|
+
link:
|
|
404
|
+
type: string
|
|
405
|
+
example: https://news.com/articles/abc
|
|
406
|
+
thumbnail:
|
|
407
|
+
type: string
|
|
408
|
+
example: https://news.com/articles/abc/image.png
|
|
409
|
+
required:
|
|
410
|
+
- title
|
|
411
|
+
- description
|
|
412
|
+
- date
|
|
413
|
+
- link
|
|
414
|
+
- thumbnail
|
|
415
|
+
|
|
416
|
+
StockNewsArticle:
|
|
417
|
+
description: A stock news article
|
|
418
|
+
allOf:
|
|
419
|
+
- $ref: "#/components/schemas/NewsArticle"
|
|
420
|
+
- type: object
|
|
421
|
+
properties:
|
|
422
|
+
symbol:
|
|
423
|
+
type: string
|
|
424
|
+
example: AAPL
|
|
425
|
+
required:
|
|
426
|
+
- symbol
|
|
427
|
+
|
|
428
|
+
Error:
|
|
429
|
+
description: A generic error
|
|
430
|
+
properties:
|
|
431
|
+
status:
|
|
432
|
+
type: integer
|
|
433
|
+
format: int64
|
|
434
|
+
example: 500
|
|
435
|
+
code:
|
|
436
|
+
$ref: "#/components/schemas/ErrorCode"
|
|
437
|
+
example: ERROR
|
|
438
|
+
message:
|
|
439
|
+
type: string
|
|
440
|
+
example: Error
|
|
441
|
+
required:
|
|
442
|
+
- status
|
|
443
|
+
- code
|
|
444
|
+
- message
|
|
445
|
+
|
|
446
|
+
ErrorCode:
|
|
447
|
+
type: string
|
|
448
|
+
enum:
|
|
449
|
+
- ERROR
|
|
450
|
+
|
|
451
|
+
HistoryTimeframe:
|
|
452
|
+
type: string
|
|
453
|
+
enum:
|
|
454
|
+
- MIN5
|
|
455
|
+
- MIN15
|
|
456
|
+
- MIN30
|
|
457
|
+
- HOUR1
|
|
458
|
+
- HOUR4
|
|
459
|
+
- DAY1
|
|
460
|
+
|
|
461
|
+
responses:
|
|
462
|
+
NotFound:
|
|
463
|
+
description: The resource was not found
|
|
464
|
+
content:
|
|
465
|
+
application/json:
|
|
466
|
+
schema:
|
|
467
|
+
$ref: "#/components/schemas/Error"
|
|
468
|
+
|
|
469
|
+
InternalServerError:
|
|
470
|
+
description: There was an internal server error
|
|
471
|
+
content:
|
|
472
|
+
application/json:
|
|
473
|
+
schema:
|
|
474
|
+
$ref: "#/components/schemas/Error"
|