1/*
2 * Legal Notice
3 *
4 * This document and associated source code (the "Work") is a part of a
5 * benchmark specification maintained by the TPC.
6 *
7 * The TPC reserves all right, title, and interest to the Work as provided
8 * under U.S. and international laws, including without limitation all patent
9 * and trademark rights therein.
10 *
11 * No Warranty
12 *
13 * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
14 * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
15 * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
16 * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
17 * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
18 * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
19 * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
20 * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
21 * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
22 * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
23 * WITH REGARD TO THE WORK.
24 * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
25 * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
26 * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
27 * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
28 * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
29 * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
30 * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
31 * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
32 *
33 * Contributors
34 * - Sergey Vasilevskiy, Doug Johnson, Larry Loen
35 */
36
37/******************************************************************************
38 * Description: Simple behaviorless structs representing a row in a table.
39 * These are what is emitted by EGen to database loaders.
40 ******************************************************************************/
41
42#ifndef TABLE_ROWS_H
43#define TABLE_ROWS_H
44
45#include "utilities/EGenStandardTypes.h"
46#include "utilities/TableConsts.h"
47#include "utilities/DateTime.h"
48
49using namespace std;
50
51namespace TPCE {
52
53// ACCOUNT_PERMISSION table
54typedef struct ACCOUNT_PERMISSION_ROW {
55 TIdent AP_CA_ID;
56 char AP_ACL[cACL_len + 1]; // binary column in the table
57 char AP_TAX_ID[cTAX_ID_len + 1];
58 char AP_L_NAME[cL_NAME_len + 1];
59 char AP_F_NAME[cF_NAME_len + 1];
60} * PACCOUNT_PERMISSION_ROW;
61
62// ADDRESS table
63typedef struct ADDRESS_ROW {
64 TIdent AD_ID;
65 char AD_LINE1[cAD_LINE_len + 1];
66 char AD_LINE2[cAD_LINE_len + 1];
67 char AD_ZC_CODE[cAD_ZIP_len + 1];
68 char AD_CTRY[cAD_CTRY_len + 1];
69} * PADDRESS_ROW;
70
71// BROKER table
72typedef struct BROKER_ROW {
73 TIdent B_ID;
74 char B_ST_ID[cST_ID_len + 1];
75 char B_NAME[cB_NAME_len + 1];
76 int B_NUM_TRADES;
77 double B_COMM_TOTAL;
78} * PBROKER_ROW;
79
80// CASH_TRANSACTION table
81typedef struct CASH_TRANSACTION_ROW {
82 TTrade CT_T_ID;
83 CDateTime CT_DTS;
84 double CT_AMT;
85 char CT_NAME[cCT_NAME_len + 1];
86} * PCASH_TRANSACTION_ROW;
87
88// CHARGE table
89typedef struct CHARGE_ROW {
90 char CH_TT_ID[cTT_ID_len + 1];
91 int CH_C_TIER;
92 double CH_CHRG;
93} * PCHARGE_ROW;
94
95// COMMISSION_RATE table
96typedef struct COMMISSION_RATE_ROW {
97 int CR_C_TIER;
98 char CR_TT_ID[cTT_ID_len + 1];
99 char CR_EX_ID[cEX_ID_len + 1];
100 int CR_FROM_QTY;
101 int CR_TO_QTY;
102 double CR_RATE;
103} * PCOMMISSION_RATE_ROW;
104
105// COMPANY table
106typedef struct COMPANY_ROW {
107 TIdent CO_ID;
108 char CO_ST_ID[cST_ID_len + 1];
109 char CO_NAME[cCO_NAME_len + 1];
110 char CO_IN_ID[cIN_ID_len + 1];
111 char CO_SP_RATE[cSP_RATE_len + 1];
112 char CO_CEO[cCEO_NAME_len + 1];
113 TIdent CO_AD_ID;
114 char CO_DESC[cCO_DESC_len + 1];
115 CDateTime CO_OPEN_DATE;
116} * PCOMPANY_ROW;
117
118// COMPANY_COMPETITOR table
119typedef struct COMPANY_COMPETITOR_ROW {
120 TIdent CP_CO_ID;
121 TIdent CP_COMP_CO_ID;
122 char CP_IN_ID[cIN_ID_len + 1];
123} * PCOMPANY_COMPETITOR_ROW;
124
125// CUSTOMER table
126typedef struct CUSTOMER_ROW {
127 TIdent C_ID;
128 char C_TAX_ID[cTAX_ID_len + 1];
129 char C_ST_ID[cST_ID_len + 1];
130 char C_L_NAME[cL_NAME_len + 1];
131 char C_F_NAME[cF_NAME_len + 1];
132 char C_M_NAME[cM_NAME_len + 1];
133 char C_GNDR;
134 char C_TIER;
135 CDateTime C_DOB;
136 TIdent C_AD_ID;
137 char C_CTRY_1[cCTRY_len + 1];
138 char C_AREA_1[cAREA_len + 1];
139 char C_LOCAL_1[cLOCAL_len + 1];
140 char C_EXT_1[cEXT_len + 1];
141 char C_CTRY_2[cCTRY_len + 1];
142 char C_AREA_2[cAREA_len + 1];
143 char C_LOCAL_2[cLOCAL_len + 1];
144 char C_EXT_2[cEXT_len + 1];
145 char C_CTRY_3[cCTRY_len + 1];
146 char C_AREA_3[cAREA_len + 1];
147 char C_LOCAL_3[cLOCAL_len + 1];
148 char C_EXT_3[cEXT_len + 1];
149 char C_EMAIL_1[cEMAIL_len + 1];
150 char C_EMAIL_2[cEMAIL_len + 1];
151
152 CUSTOMER_ROW() : C_ID(0){};
153
154} * PCUSTOMER_ROW;
155
156// CUSTOMER_ACCOUNT table
157typedef struct CUSTOMER_ACCOUNT_ROW {
158 TIdent CA_ID;
159 TIdent CA_B_ID;
160 TIdent CA_C_ID;
161 char CA_NAME[cCA_NAME_len + 1];
162 char CA_TAX_ST;
163 double CA_BAL;
164} * PCUSTOMER_ACCOUNT_ROW;
165
166// CUSTOMER_TAXRATE table
167typedef struct CUSTOMER_TAXRATE_ROW {
168 char CX_TX_ID[cTX_ID_len + 1];
169 TIdent CX_C_ID;
170} * PCUSTOMER_TAXRATE_ROW;
171
172// DAILY_MARKET table
173typedef struct DAILY_MARKET_ROW {
174 CDateTime DM_DATE;
175 char DM_S_SYMB[cSYMBOL_len + 1];
176 double DM_CLOSE;
177 double DM_HIGH;
178 double DM_LOW;
179 INT64 DM_VOL;
180} * PDAILY_MARKET_ROW;
181
182// EXCHANGE table
183typedef struct EXCHANGE_ROW {
184 char EX_ID[cEX_ID_len + 1];
185 char EX_NAME[cEX_NAME_len + 1];
186 int EX_NUM_SYMB;
187 int EX_OPEN;
188 int EX_CLOSE;
189 char EX_DESC[cEX_DESC_len + 1];
190 TIdent EX_AD_ID;
191} * PEXCHANGE_ROW;
192
193// FINANCIAL table
194typedef struct FINANCIAL_ROW {
195 TIdent FI_CO_ID;
196 int FI_YEAR;
197 int FI_QTR;
198 CDateTime FI_QTR_START_DATE;
199 double FI_REVENUE;
200 double FI_NET_EARN;
201 double FI_BASIC_EPS;
202 double FI_DILUT_EPS;
203 double FI_MARGIN;
204 double FI_INVENTORY;
205 double FI_ASSETS;
206 double FI_LIABILITY;
207 INT64 FI_OUT_BASIC;
208 INT64 FI_OUT_DILUT;
209} * PFINANCIAL_ROW;
210
211// HOLDING table
212typedef struct HOLDING_ROW {
213 TTrade H_T_ID;
214 TIdent H_CA_ID;
215 char H_S_SYMB[cSYMBOL_len + 1];
216 CDateTime H_DTS;
217 double H_PRICE;
218 int H_QTY;
219} * PHOLDING_ROW;
220
221// HOLDING_HISTORY table
222typedef struct HOLDING_HISTORY_ROW {
223 TTrade HH_H_T_ID;
224 TTrade HH_T_ID;
225 int HH_BEFORE_QTY;
226 int HH_AFTER_QTY;
227} * PHOLDING_HISTORY_ROW;
228
229// HOLDING_SUMMARY table
230typedef struct HOLDING_SUMMARY_ROW {
231 TIdent HS_CA_ID;
232 char HS_S_SYMB[cSYMBOL_len + 1];
233 int HS_QTY;
234} * PHOLDING_SUMMARY_ROW;
235
236// INDUSTRY table
237typedef struct INDUSTRY_ROW {
238 char IN_ID[cIN_ID_len + 1];
239 char IN_NAME[cIN_NAME_len + 1];
240 char IN_SC_ID[cSC_ID_len + 1];
241} * PINDUSTRY_ROW;
242
243// LAST_TRADE table
244typedef struct LAST_TRADE_ROW {
245 char LT_S_SYMB[cSYMBOL_len + 1];
246 CDateTime LT_DTS;
247 double LT_PRICE;
248 double LT_OPEN_PRICE;
249 INT64 LT_VOL;
250} * PLAST_TRADE_ROW;
251
252// NEWS_ITEM table
253typedef struct NEWS_ITEM_ROW {
254 TIdent NI_ID;
255 char NI_HEADLINE[cNI_HEADLINE_len + 1];
256 char NI_SUMMARY[cNI_SUMMARY_len + 1];
257 char NI_ITEM[cNI_ITEM_len + 1];
258 CDateTime NI_DTS;
259 char NI_SOURCE[cNI_SOURCE_len + 1];
260 char NI_AUTHOR[cNI_AUTHOR_len + 1];
261} * PNEWS_ITEM_ROW;
262
263// NEWS_XREF table
264typedef struct NEWS_XREF_ROW {
265 TIdent NX_NI_ID;
266 TIdent NX_CO_ID;
267} * PNEWS_XREF_ROW;
268
269// SECTOR table
270typedef struct SECTOR_ROW {
271 char SC_ID[cSC_ID_len + 1];
272 char SC_NAME[cSC_NAME_len + 1];
273} * PSECTOR_ROW;
274
275// SECURITY table
276typedef struct SECURITY_ROW {
277 char S_SYMB[cSYMBOL_len + 1];
278 char S_ISSUE[cS_ISSUE_len + 1];
279 char S_ST_ID[cST_ID_len + 1];
280 char S_NAME[cS_NAME_len + 1];
281 char S_EX_ID[cEX_ID_len + 1];
282 TIdent S_CO_ID;
283 INT64 S_NUM_OUT;
284 CDateTime S_START_DATE;
285 CDateTime S_EXCH_DATE;
286 double S_PE;
287 float S_52WK_HIGH;
288 CDateTime S_52WK_HIGH_DATE;
289 float S_52WK_LOW;
290 CDateTime S_52WK_LOW_DATE;
291 double S_DIVIDEND;
292 double S_YIELD;
293} * PSECURITY_ROW;
294
295// SETTLEMENT table
296typedef struct SETTLEMENT_ROW {
297 TTrade SE_T_ID;
298 char SE_CASH_TYPE[cSE_CASH_TYPE_len + 1];
299 CDateTime SE_CASH_DUE_DATE;
300 double SE_AMT;
301} * PSETTLEMENT_ROW;
302
303// STATUS_TYPE table
304typedef struct STATUS_TYPE_ROW {
305 char ST_ID[cST_ID_len + 1];
306 char ST_NAME[cST_NAME_len + 1];
307} * PSTATUS_TYPE_ROW;
308
309// TAXRATE table
310typedef struct TAX_RATE_ROW {
311 char TX_ID[cTX_ID_len + 1];
312 char TX_NAME[cTX_NAME_len + 1];
313 double TX_RATE;
314} * PTAX_RATE_ROW;
315
316// TRADE table
317typedef struct TRADE_ROW {
318 TTrade T_ID;
319 CDateTime T_DTS;
320 char T_ST_ID[cST_ID_len + 1];
321 char T_TT_ID[cTT_ID_len + 1];
322 bool T_IS_CASH;
323 char T_S_SYMB[cSYMBOL_len + 1];
324 int T_QTY;
325 double T_BID_PRICE;
326 TIdent T_CA_ID;
327 char T_EXEC_NAME[cEXEC_NAME_len + 1];
328 double T_TRADE_PRICE;
329 double T_CHRG;
330 double T_COMM;
331 double T_TAX;
332 bool T_LIFO;
333} * PTRADE_ROW;
334
335// TRADE_HISTORY table
336typedef struct TRADE_HISTORY_ROW {
337 TTrade TH_T_ID;
338 CDateTime TH_DTS;
339 char TH_ST_ID[cST_ID_len + 1];
340} * PTRADE_HISTORY_ROW;
341
342// TRADE_REQUEST table
343typedef struct TRADE_REQUEST_ROW {
344 TTrade TR_T_ID;
345 char TR_TT_ID[cTT_ID_len + 1];
346 char TR_S_SYMB[cSYMBOL_len + 1];
347 int TR_QTY;
348 double TR_BID_PRICE;
349 TIdent TR_B_ID;
350} * PTRADE_REQUEST_ROW;
351
352// TRADE_TYPE table
353typedef struct TRADE_TYPE_ROW {
354 char TT_ID[cTT_ID_len + 1];
355 char TT_NAME[cTT_NAME_len + 1];
356 bool TT_IS_SELL;
357 bool TT_IS_MRKT;
358} * PTRADE_TYPE_ROW;
359
360// WATCH_ITEM table
361typedef struct WATCH_ITEM_ROW {
362 TIdent WI_WL_ID;
363 char WI_S_SYMB[cSYMBOL_len + 1];
364} * PWATCH_ITEM_ROW;
365
366// WATCH_LIST table
367typedef struct WATCH_LIST_ROW {
368 TIdent WL_ID;
369 TIdent WL_C_ID;
370} * PWATCH_LIST_ROW;
371
372// ZIP_CODE table
373typedef struct ZIP_CODE_ROW {
374 char ZC_CODE[cZC_CODE_len + 1];
375 char ZC_TOWN[cZC_TOWN_len + 1];
376 char ZC_DIV[cZC_DIV_len + 1];
377} * PZIP_CODE_ROW;
378
379} // namespace TPCE
380
381#endif // #ifndef TABLE_ROWS_H
382