@rivascva/dt-idl 1.1.129 → 1.1.131
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 +127 -0
- package/go/psql/utils.go +11 -0
- package/package.json +1 -1
- package/services/dt-trade-service.yaml +142 -0
- package/ts/services/dt-trade-service.ts +127 -0
package/dist/index.d.ts
CHANGED
|
@@ -719,6 +719,23 @@ interface paths$2 {
|
|
|
719
719
|
patch?: never;
|
|
720
720
|
trace?: never;
|
|
721
721
|
};
|
|
722
|
+
"/portfolios/{portfolioId}/history": {
|
|
723
|
+
parameters: {
|
|
724
|
+
query?: never;
|
|
725
|
+
header?: never;
|
|
726
|
+
path?: never;
|
|
727
|
+
cookie?: never;
|
|
728
|
+
};
|
|
729
|
+
/** @description Gets the portfolio history values */
|
|
730
|
+
get: operations$2["getPortfolioHistory"];
|
|
731
|
+
put?: never;
|
|
732
|
+
post?: never;
|
|
733
|
+
delete?: never;
|
|
734
|
+
options?: never;
|
|
735
|
+
head?: never;
|
|
736
|
+
patch?: never;
|
|
737
|
+
trace?: never;
|
|
738
|
+
};
|
|
722
739
|
"/portfolios/by-user/{userId}": {
|
|
723
740
|
parameters: {
|
|
724
741
|
query?: never;
|
|
@@ -770,6 +787,23 @@ interface paths$2 {
|
|
|
770
787
|
patch?: never;
|
|
771
788
|
trace?: never;
|
|
772
789
|
};
|
|
790
|
+
"/orders/by-portfolio/{portfolioId}": {
|
|
791
|
+
parameters: {
|
|
792
|
+
query?: never;
|
|
793
|
+
header?: never;
|
|
794
|
+
path?: never;
|
|
795
|
+
cookie?: never;
|
|
796
|
+
};
|
|
797
|
+
/** @description Gets the orders for the given portfolio */
|
|
798
|
+
get: operations$2["getOrdersByPortfolio"];
|
|
799
|
+
put?: never;
|
|
800
|
+
post?: never;
|
|
801
|
+
delete?: never;
|
|
802
|
+
options?: never;
|
|
803
|
+
head?: never;
|
|
804
|
+
patch?: never;
|
|
805
|
+
trace?: never;
|
|
806
|
+
};
|
|
773
807
|
}
|
|
774
808
|
interface components$2 {
|
|
775
809
|
schemas: {
|
|
@@ -810,6 +844,33 @@ interface components$2 {
|
|
|
810
844
|
*/
|
|
811
845
|
dateUpdated: number;
|
|
812
846
|
};
|
|
847
|
+
/** @description A portfolio history value */
|
|
848
|
+
PortfolioHistoryValue: {
|
|
849
|
+
/** @example 123456 */
|
|
850
|
+
id: string;
|
|
851
|
+
/** @example 123456 */
|
|
852
|
+
portfolioId: string;
|
|
853
|
+
/**
|
|
854
|
+
* Format: double
|
|
855
|
+
* @example 10500.25
|
|
856
|
+
*/
|
|
857
|
+
cash: number;
|
|
858
|
+
/**
|
|
859
|
+
* Format: double
|
|
860
|
+
* @example 10500.25
|
|
861
|
+
*/
|
|
862
|
+
totalValue: number;
|
|
863
|
+
/**
|
|
864
|
+
* Format: int64
|
|
865
|
+
* @example 1713398544000
|
|
866
|
+
*/
|
|
867
|
+
dateCreated: number;
|
|
868
|
+
/**
|
|
869
|
+
* Format: int64
|
|
870
|
+
* @example 1713398544000
|
|
871
|
+
*/
|
|
872
|
+
dateUpdated: number;
|
|
873
|
+
};
|
|
813
874
|
/** @description A stock holding */
|
|
814
875
|
Holding: {
|
|
815
876
|
/** @example 123456 */
|
|
@@ -899,6 +960,10 @@ interface components$2 {
|
|
|
899
960
|
PortfolioType: "PERSONAL" | "COMPETITIVE";
|
|
900
961
|
/** @enum {string} */
|
|
901
962
|
OrderType: "BUY_MARKET" | "BUY_LIMIT" | "BUY_STOP" | "SELL_MARKET" | "SELL_LIMIT" | "SELL_STOP";
|
|
963
|
+
/** @enum {string} */
|
|
964
|
+
PortfolioHistoryTimeframe: "MIN5" | "MIN15" | "MIN30" | "HOUR1" | "HOUR4" | "DAY1";
|
|
965
|
+
/** @enum {string} */
|
|
966
|
+
OrderStatus: "PENDING" | "COMPLETED";
|
|
902
967
|
};
|
|
903
968
|
responses: {
|
|
904
969
|
/** @description No content */
|
|
@@ -1001,6 +1066,38 @@ interface operations$2 {
|
|
|
1001
1066
|
500: components$2["responses"]["InternalServerError"];
|
|
1002
1067
|
};
|
|
1003
1068
|
};
|
|
1069
|
+
getPortfolioHistory: {
|
|
1070
|
+
parameters: {
|
|
1071
|
+
query: {
|
|
1072
|
+
/** @description The portfolio history timeframe */
|
|
1073
|
+
timeframe: components$2["schemas"]["PortfolioHistoryTimeframe"];
|
|
1074
|
+
/** @description The portfolio history from date */
|
|
1075
|
+
from: string;
|
|
1076
|
+
/** @description The portfolio history to date */
|
|
1077
|
+
to: string;
|
|
1078
|
+
};
|
|
1079
|
+
header?: never;
|
|
1080
|
+
path: {
|
|
1081
|
+
/** @description The portfolio id */
|
|
1082
|
+
portfolioId: string;
|
|
1083
|
+
};
|
|
1084
|
+
cookie?: never;
|
|
1085
|
+
};
|
|
1086
|
+
requestBody?: never;
|
|
1087
|
+
responses: {
|
|
1088
|
+
/** @description Success */
|
|
1089
|
+
200: {
|
|
1090
|
+
headers: {
|
|
1091
|
+
[name: string]: unknown;
|
|
1092
|
+
};
|
|
1093
|
+
content: {
|
|
1094
|
+
"application/json": components$2["schemas"]["PortfolioHistoryValue"][];
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
404: components$2["responses"]["NotFound"];
|
|
1098
|
+
500: components$2["responses"]["InternalServerError"];
|
|
1099
|
+
};
|
|
1100
|
+
};
|
|
1004
1101
|
getPortfoliosByUser: {
|
|
1005
1102
|
parameters: {
|
|
1006
1103
|
query?: never;
|
|
@@ -1072,6 +1169,36 @@ interface operations$2 {
|
|
|
1072
1169
|
500: components$2["responses"]["InternalServerError"];
|
|
1073
1170
|
};
|
|
1074
1171
|
};
|
|
1172
|
+
getOrdersByPortfolio: {
|
|
1173
|
+
parameters: {
|
|
1174
|
+
query?: {
|
|
1175
|
+
/** @description The order status */
|
|
1176
|
+
status?: components$2["schemas"]["OrderStatus"];
|
|
1177
|
+
/** @description The maximum number of order results */
|
|
1178
|
+
limit?: number;
|
|
1179
|
+
};
|
|
1180
|
+
header?: never;
|
|
1181
|
+
path: {
|
|
1182
|
+
/** @description The portfolio id */
|
|
1183
|
+
portfolioId: string;
|
|
1184
|
+
};
|
|
1185
|
+
cookie?: never;
|
|
1186
|
+
};
|
|
1187
|
+
requestBody?: never;
|
|
1188
|
+
responses: {
|
|
1189
|
+
/** @description Success */
|
|
1190
|
+
200: {
|
|
1191
|
+
headers: {
|
|
1192
|
+
[name: string]: unknown;
|
|
1193
|
+
};
|
|
1194
|
+
content: {
|
|
1195
|
+
"application/json": components$2["schemas"]["Order"][];
|
|
1196
|
+
};
|
|
1197
|
+
};
|
|
1198
|
+
404: components$2["responses"]["NotFound"];
|
|
1199
|
+
500: components$2["responses"]["InternalServerError"];
|
|
1200
|
+
};
|
|
1201
|
+
};
|
|
1075
1202
|
}
|
|
1076
1203
|
|
|
1077
1204
|
/**
|
package/go/psql/utils.go
CHANGED
|
@@ -41,6 +41,17 @@ func GetSelectAllQuery(table string, where ...Where) (string, []any, error) {
|
|
|
41
41
|
return builder.ToSql()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// GetSelectAllQueryWithLimit builds and returns the query and arguments to perform a select all query on the given table with a limit.
|
|
45
|
+
// Provide a where map to specify which rows to select. A nil value will select all rows.
|
|
46
|
+
func GetSelectAllQueryWithLimit(table string, limit int, where ...Where) (string, []any, error) {
|
|
47
|
+
builder := sq.Select("*").From(table)
|
|
48
|
+
for _, mp := range where {
|
|
49
|
+
builder = builder.Where(mp)
|
|
50
|
+
}
|
|
51
|
+
builder.Limit(uint64(limit))
|
|
52
|
+
return builder.ToSql()
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
// GetSelectColumnQuery builds and returns the query and arguments to perform a select column query on the given table.
|
|
45
56
|
// Provide a where map to specify which rows to select. A nil value will select all rows.
|
|
46
57
|
func GetSelectColumnQuery(table string, column string, where ...Where) (string, []any, error) {
|
package/package.json
CHANGED
|
@@ -71,6 +71,55 @@ paths:
|
|
|
71
71
|
500:
|
|
72
72
|
$ref: '#/components/responses/InternalServerError'
|
|
73
73
|
|
|
74
|
+
/portfolios/{portfolioId}/history:
|
|
75
|
+
get:
|
|
76
|
+
description: Gets the portfolio history values
|
|
77
|
+
operationId: getPortfolioHistory
|
|
78
|
+
tags:
|
|
79
|
+
- Portfolios
|
|
80
|
+
parameters:
|
|
81
|
+
- in: path
|
|
82
|
+
name: portfolioId
|
|
83
|
+
description: The portfolio id
|
|
84
|
+
required: true
|
|
85
|
+
schema:
|
|
86
|
+
type: string
|
|
87
|
+
example: 123456
|
|
88
|
+
- in: query
|
|
89
|
+
name: timeframe
|
|
90
|
+
description: The portfolio history timeframe
|
|
91
|
+
required: true
|
|
92
|
+
schema:
|
|
93
|
+
$ref: '#/components/schemas/PortfolioHistoryTimeframe'
|
|
94
|
+
example: MIN5
|
|
95
|
+
- in: query
|
|
96
|
+
name: from
|
|
97
|
+
description: The portfolio history from date
|
|
98
|
+
required: true
|
|
99
|
+
schema:
|
|
100
|
+
type: string
|
|
101
|
+
example: 2024-12-24
|
|
102
|
+
- in: query
|
|
103
|
+
name: to
|
|
104
|
+
description: The portfolio history to date
|
|
105
|
+
required: true
|
|
106
|
+
schema:
|
|
107
|
+
type: string
|
|
108
|
+
example: 2024-12-31
|
|
109
|
+
responses:
|
|
110
|
+
200:
|
|
111
|
+
description: Success
|
|
112
|
+
content:
|
|
113
|
+
application/json:
|
|
114
|
+
schema:
|
|
115
|
+
type: array
|
|
116
|
+
items:
|
|
117
|
+
$ref: '#/components/schemas/PortfolioHistoryValue'
|
|
118
|
+
404:
|
|
119
|
+
$ref: '#/components/responses/NotFound'
|
|
120
|
+
500:
|
|
121
|
+
$ref: '#/components/responses/InternalServerError'
|
|
122
|
+
|
|
74
123
|
/portfolios/by-user/{userId}:
|
|
75
124
|
get:
|
|
76
125
|
description: Gets the portfolios for the given user
|
|
@@ -150,6 +199,50 @@ paths:
|
|
|
150
199
|
500:
|
|
151
200
|
$ref: '#/components/responses/InternalServerError'
|
|
152
201
|
|
|
202
|
+
/orders/by-portfolio/{portfolioId}:
|
|
203
|
+
get:
|
|
204
|
+
description: Gets the orders for the given portfolio
|
|
205
|
+
operationId: getOrdersByPortfolio
|
|
206
|
+
tags:
|
|
207
|
+
- Orders
|
|
208
|
+
parameters:
|
|
209
|
+
- in: path
|
|
210
|
+
name: portfolioId
|
|
211
|
+
description: The portfolio id
|
|
212
|
+
required: true
|
|
213
|
+
schema:
|
|
214
|
+
type: string
|
|
215
|
+
example: 12345
|
|
216
|
+
- in: query
|
|
217
|
+
name: status
|
|
218
|
+
description: The order status
|
|
219
|
+
required: false
|
|
220
|
+
schema:
|
|
221
|
+
$ref: '#/components/schemas/OrderStatus'
|
|
222
|
+
example: COMPLETED
|
|
223
|
+
- in: query
|
|
224
|
+
name: limit
|
|
225
|
+
description: The maximum number of order results
|
|
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/Order'
|
|
241
|
+
404:
|
|
242
|
+
$ref: '#/components/responses/NotFound'
|
|
243
|
+
500:
|
|
244
|
+
$ref: '#/components/responses/InternalServerError'
|
|
245
|
+
|
|
153
246
|
components:
|
|
154
247
|
schemas:
|
|
155
248
|
AddPortfolioPayload:
|
|
@@ -213,6 +306,39 @@ components:
|
|
|
213
306
|
- dateCreated
|
|
214
307
|
- dateUpdated
|
|
215
308
|
|
|
309
|
+
PortfolioHistoryValue:
|
|
310
|
+
description: A portfolio history value
|
|
311
|
+
properties:
|
|
312
|
+
id:
|
|
313
|
+
type: string
|
|
314
|
+
example: 123456
|
|
315
|
+
portfolioId:
|
|
316
|
+
type: string
|
|
317
|
+
example: 123456
|
|
318
|
+
cash:
|
|
319
|
+
type: number
|
|
320
|
+
format: double
|
|
321
|
+
example: 10500.25
|
|
322
|
+
totalValue:
|
|
323
|
+
type: number
|
|
324
|
+
format: double
|
|
325
|
+
example: 10500.25
|
|
326
|
+
dateCreated:
|
|
327
|
+
type: integer
|
|
328
|
+
format: int64
|
|
329
|
+
example: 1713398544000
|
|
330
|
+
dateUpdated:
|
|
331
|
+
type: integer
|
|
332
|
+
format: int64
|
|
333
|
+
example: 1713398544000
|
|
334
|
+
required:
|
|
335
|
+
- id
|
|
336
|
+
- portfolioId
|
|
337
|
+
- cash
|
|
338
|
+
- totalValue
|
|
339
|
+
- dateCreated
|
|
340
|
+
- dateUpdated
|
|
341
|
+
|
|
216
342
|
Holding:
|
|
217
343
|
description: A stock holding
|
|
218
344
|
properties:
|
|
@@ -349,6 +475,22 @@ components:
|
|
|
349
475
|
- SELL_LIMIT
|
|
350
476
|
- SELL_STOP
|
|
351
477
|
|
|
478
|
+
PortfolioHistoryTimeframe:
|
|
479
|
+
type: string
|
|
480
|
+
enum:
|
|
481
|
+
- MIN5
|
|
482
|
+
- MIN15
|
|
483
|
+
- MIN30
|
|
484
|
+
- HOUR1
|
|
485
|
+
- HOUR4
|
|
486
|
+
- DAY1
|
|
487
|
+
|
|
488
|
+
OrderStatus:
|
|
489
|
+
type: string
|
|
490
|
+
enum:
|
|
491
|
+
- PENDING
|
|
492
|
+
- COMPLETED
|
|
493
|
+
|
|
352
494
|
responses:
|
|
353
495
|
NoContent:
|
|
354
496
|
description: No content
|
|
@@ -38,6 +38,23 @@ export interface paths {
|
|
|
38
38
|
patch?: never;
|
|
39
39
|
trace?: never;
|
|
40
40
|
};
|
|
41
|
+
"/portfolios/{portfolioId}/history": {
|
|
42
|
+
parameters: {
|
|
43
|
+
query?: never;
|
|
44
|
+
header?: never;
|
|
45
|
+
path?: never;
|
|
46
|
+
cookie?: never;
|
|
47
|
+
};
|
|
48
|
+
/** @description Gets the portfolio history values */
|
|
49
|
+
get: operations["getPortfolioHistory"];
|
|
50
|
+
put?: never;
|
|
51
|
+
post?: never;
|
|
52
|
+
delete?: never;
|
|
53
|
+
options?: never;
|
|
54
|
+
head?: never;
|
|
55
|
+
patch?: never;
|
|
56
|
+
trace?: never;
|
|
57
|
+
};
|
|
41
58
|
"/portfolios/by-user/{userId}": {
|
|
42
59
|
parameters: {
|
|
43
60
|
query?: never;
|
|
@@ -89,6 +106,23 @@ export interface paths {
|
|
|
89
106
|
patch?: never;
|
|
90
107
|
trace?: never;
|
|
91
108
|
};
|
|
109
|
+
"/orders/by-portfolio/{portfolioId}": {
|
|
110
|
+
parameters: {
|
|
111
|
+
query?: never;
|
|
112
|
+
header?: never;
|
|
113
|
+
path?: never;
|
|
114
|
+
cookie?: never;
|
|
115
|
+
};
|
|
116
|
+
/** @description Gets the orders for the given portfolio */
|
|
117
|
+
get: operations["getOrdersByPortfolio"];
|
|
118
|
+
put?: never;
|
|
119
|
+
post?: never;
|
|
120
|
+
delete?: never;
|
|
121
|
+
options?: never;
|
|
122
|
+
head?: never;
|
|
123
|
+
patch?: never;
|
|
124
|
+
trace?: never;
|
|
125
|
+
};
|
|
92
126
|
}
|
|
93
127
|
export type webhooks = Record<string, never>;
|
|
94
128
|
export interface components {
|
|
@@ -130,6 +164,33 @@ export interface components {
|
|
|
130
164
|
*/
|
|
131
165
|
dateUpdated: number;
|
|
132
166
|
};
|
|
167
|
+
/** @description A portfolio history value */
|
|
168
|
+
PortfolioHistoryValue: {
|
|
169
|
+
/** @example 123456 */
|
|
170
|
+
id: string;
|
|
171
|
+
/** @example 123456 */
|
|
172
|
+
portfolioId: string;
|
|
173
|
+
/**
|
|
174
|
+
* Format: double
|
|
175
|
+
* @example 10500.25
|
|
176
|
+
*/
|
|
177
|
+
cash: number;
|
|
178
|
+
/**
|
|
179
|
+
* Format: double
|
|
180
|
+
* @example 10500.25
|
|
181
|
+
*/
|
|
182
|
+
totalValue: number;
|
|
183
|
+
/**
|
|
184
|
+
* Format: int64
|
|
185
|
+
* @example 1713398544000
|
|
186
|
+
*/
|
|
187
|
+
dateCreated: number;
|
|
188
|
+
/**
|
|
189
|
+
* Format: int64
|
|
190
|
+
* @example 1713398544000
|
|
191
|
+
*/
|
|
192
|
+
dateUpdated: number;
|
|
193
|
+
};
|
|
133
194
|
/** @description A stock holding */
|
|
134
195
|
Holding: {
|
|
135
196
|
/** @example 123456 */
|
|
@@ -219,6 +280,10 @@ export interface components {
|
|
|
219
280
|
PortfolioType: "PERSONAL" | "COMPETITIVE";
|
|
220
281
|
/** @enum {string} */
|
|
221
282
|
OrderType: "BUY_MARKET" | "BUY_LIMIT" | "BUY_STOP" | "SELL_MARKET" | "SELL_LIMIT" | "SELL_STOP";
|
|
283
|
+
/** @enum {string} */
|
|
284
|
+
PortfolioHistoryTimeframe: "MIN5" | "MIN15" | "MIN30" | "HOUR1" | "HOUR4" | "DAY1";
|
|
285
|
+
/** @enum {string} */
|
|
286
|
+
OrderStatus: "PENDING" | "COMPLETED";
|
|
222
287
|
};
|
|
223
288
|
responses: {
|
|
224
289
|
/** @description No content */
|
|
@@ -322,6 +387,38 @@ export interface operations {
|
|
|
322
387
|
500: components["responses"]["InternalServerError"];
|
|
323
388
|
};
|
|
324
389
|
};
|
|
390
|
+
getPortfolioHistory: {
|
|
391
|
+
parameters: {
|
|
392
|
+
query: {
|
|
393
|
+
/** @description The portfolio history timeframe */
|
|
394
|
+
timeframe: components["schemas"]["PortfolioHistoryTimeframe"];
|
|
395
|
+
/** @description The portfolio history from date */
|
|
396
|
+
from: string;
|
|
397
|
+
/** @description The portfolio history to date */
|
|
398
|
+
to: string;
|
|
399
|
+
};
|
|
400
|
+
header?: never;
|
|
401
|
+
path: {
|
|
402
|
+
/** @description The portfolio id */
|
|
403
|
+
portfolioId: string;
|
|
404
|
+
};
|
|
405
|
+
cookie?: never;
|
|
406
|
+
};
|
|
407
|
+
requestBody?: never;
|
|
408
|
+
responses: {
|
|
409
|
+
/** @description Success */
|
|
410
|
+
200: {
|
|
411
|
+
headers: {
|
|
412
|
+
[name: string]: unknown;
|
|
413
|
+
};
|
|
414
|
+
content: {
|
|
415
|
+
"application/json": components["schemas"]["PortfolioHistoryValue"][];
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
404: components["responses"]["NotFound"];
|
|
419
|
+
500: components["responses"]["InternalServerError"];
|
|
420
|
+
};
|
|
421
|
+
};
|
|
325
422
|
getPortfoliosByUser: {
|
|
326
423
|
parameters: {
|
|
327
424
|
query?: never;
|
|
@@ -393,4 +490,34 @@ export interface operations {
|
|
|
393
490
|
500: components["responses"]["InternalServerError"];
|
|
394
491
|
};
|
|
395
492
|
};
|
|
493
|
+
getOrdersByPortfolio: {
|
|
494
|
+
parameters: {
|
|
495
|
+
query?: {
|
|
496
|
+
/** @description The order status */
|
|
497
|
+
status?: components["schemas"]["OrderStatus"];
|
|
498
|
+
/** @description The maximum number of order results */
|
|
499
|
+
limit?: number;
|
|
500
|
+
};
|
|
501
|
+
header?: never;
|
|
502
|
+
path: {
|
|
503
|
+
/** @description The portfolio id */
|
|
504
|
+
portfolioId: string;
|
|
505
|
+
};
|
|
506
|
+
cookie?: never;
|
|
507
|
+
};
|
|
508
|
+
requestBody?: never;
|
|
509
|
+
responses: {
|
|
510
|
+
/** @description Success */
|
|
511
|
+
200: {
|
|
512
|
+
headers: {
|
|
513
|
+
[name: string]: unknown;
|
|
514
|
+
};
|
|
515
|
+
content: {
|
|
516
|
+
"application/json": components["schemas"]["Order"][];
|
|
517
|
+
};
|
|
518
|
+
};
|
|
519
|
+
404: components["responses"]["NotFound"];
|
|
520
|
+
500: components["responses"]["InternalServerError"];
|
|
521
|
+
};
|
|
522
|
+
};
|
|
396
523
|
}
|