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, Matt Emmerton, Christopher Chan-Nui |
35 | */ |
36 | |
37 | /****************************************************************************** |
38 | * Description: This file is used to "expose" the configurable driver |
39 | * parameters. These values may be set by test sponsors |
40 | * for testing and prototyping. The default values |
41 | * represent those that must be used for a compliant run. |
42 | ******************************************************************************/ |
43 | |
44 | #ifndef DRIVER_PARAM_SETTINGS_H |
45 | #define DRIVER_PARAM_SETTINGS_H |
46 | |
47 | #include <iostream> |
48 | #include <iomanip> // for log message formatting |
49 | #include <sstream> // for log message construction |
50 | |
51 | #include "utilities/EGenUtilities_stdafx.h" |
52 | |
53 | namespace TPCE { |
54 | |
55 | // CHECK tests for CheckValid and CheckCompliant, use macros so we can get a |
56 | // textual representation of the tested values, these tests could be |
57 | // significantly condensed but we're trying for readibility here... |
58 | #define DRIVERPARAM_CHECK_EQUAL(name, lhs, rhs) \ |
59 | if ((lhs) != (rhs)) { \ |
60 | std::ostringstream strm; \ |
61 | strm << #lhs << "(" << (lhs) << ") != " << #rhs << "(" << (rhs) << ")"; \ |
62 | throw CCheckErr(name, strm.str()); \ |
63 | } |
64 | |
65 | #define DRIVERPARAM_CHECK_GE(name, lhs, rhs) \ |
66 | if ((lhs) < (rhs)) { \ |
67 | std::ostringstream strm; \ |
68 | strm << #lhs << "(" << (lhs) << ") < " << #rhs << "(" << (rhs) << ")"; \ |
69 | throw CCheckErr(name, strm.str()); \ |
70 | } |
71 | |
72 | #define DRIVERPARAM_CHECK_LE(name, lhs, rhs) \ |
73 | if ((lhs) > (rhs)) { \ |
74 | std::ostringstream strm; \ |
75 | strm << #lhs << "(" << (lhs) << ") > " << #rhs << "(" << (rhs) << ")"; \ |
76 | throw CCheckErr(name, strm.str()); \ |
77 | } |
78 | |
79 | #define DRIVERPARAM_CHECK_BETWEEN(name, lhs, minval, maxval) \ |
80 | DRIVERPARAM_CHECK_GE(name, lhs, minval) \ |
81 | DRIVERPARAM_CHECK_LE(name, lhs, maxval) |
82 | |
83 | #define DRIVERPARAM_CHECK_DEFAULT(name) \ |
84 | if (cur.name != dft.name) { \ |
85 | std::ostringstream strm; \ |
86 | strm << #name << "(" << cur.name << ") != " << dft.name; \ |
87 | throw CCheckErr(#name, strm.str()); \ |
88 | } |
89 | |
90 | /****************************************************************************** |
91 | * Parameter Base Class Template |
92 | ******************************************************************************/ |
93 | template <typename T> class CParametersWithoutDefaults { |
94 | public: |
95 | T cur; |
96 | |
97 | CParametersWithoutDefaults() { |
98 | } |
99 | /* |
100 | * Virtual destructor. Provided so that a sponsor-specific |
101 | * destructor can be called on destruction from the base-class pointer. |
102 | * |
103 | * PARAMETERS: |
104 | * none. |
105 | * |
106 | * RETURNS: |
107 | * not applicable. |
108 | */ |
109 | virtual ~CParametersWithoutDefaults(){}; |
110 | |
111 | virtual void CheckValid(void) = 0; |
112 | virtual void CheckCompliant(void) = 0; |
113 | bool IsValid(void) { |
114 | try { |
115 | CheckValid(); |
116 | return true; |
117 | } catch (CCheckErr) { |
118 | throw; |
119 | return false; |
120 | } |
121 | } |
122 | |
123 | bool IsCompliant(void) { |
124 | // This will always return true for the classes defined in this file |
125 | try { |
126 | CheckCompliant(); |
127 | return true; |
128 | } catch (CCheckErr) { |
129 | throw; |
130 | return false; |
131 | } |
132 | } |
133 | }; |
134 | |
135 | template <typename T, typename T2> class CParametersWithDefaults { |
136 | // protected: |
137 | public: |
138 | T dft; |
139 | T2 state; |
140 | |
141 | public: |
142 | T cur; |
143 | |
144 | CParametersWithDefaults() { |
145 | } |
146 | /* |
147 | * Virtual destructor. Provided so that a sponsor-specific |
148 | * destructor can be called on destruction from the base-class pointer. |
149 | * |
150 | * PARAMETERS: |
151 | * none. |
152 | * |
153 | * RETURNS: |
154 | * not applicable. |
155 | */ |
156 | virtual ~CParametersWithDefaults(){}; |
157 | |
158 | void Initialize(void) { |
159 | InitializeDefaults(); |
160 | SetToDefaults(); |
161 | } |
162 | |
163 | void SetToDefaults(void) { |
164 | cur = dft; |
165 | CheckDefaults(); |
166 | } |
167 | |
168 | virtual void InitializeDefaults(void) { |
169 | } |
170 | virtual void CheckDefaults(void) { |
171 | } |
172 | virtual void CheckValid(void) = 0; |
173 | virtual void CheckCompliant(void) = 0; |
174 | bool IsValid(void) { |
175 | try { |
176 | CheckValid(); |
177 | return true; |
178 | } catch (CCheckErr) { |
179 | throw; |
180 | return false; |
181 | } |
182 | } |
183 | |
184 | bool IsCompliant(void) { |
185 | try { |
186 | CheckCompliant(); |
187 | return true; |
188 | } catch (CCheckErr) { |
189 | throw; |
190 | return false; |
191 | } |
192 | } |
193 | }; |
194 | |
195 | /****************************************************************************** |
196 | * Parameter Structures (Data) |
197 | ******************************************************************************/ |
198 | typedef struct TBrokerVolumeSettings { |
199 | } * PBrokerVolumeSettings; |
200 | |
201 | typedef struct TCustomerPositionSettings { |
202 | INT32 by_cust_id; // percentage |
203 | INT32 by_tax_id; // percentage |
204 | INT32 get_history; // percentage |
205 | } * PCustomerPositionSettings; |
206 | |
207 | typedef struct TMarketWatchSettings { |
208 | INT32 by_acct_id; // percentage |
209 | INT32 by_industry; // percentage |
210 | INT32 by_watch_list; // percentage |
211 | } * PMarketWatchSettings; |
212 | |
213 | typedef struct TSecurityDetailSettings { |
214 | INT32 LOBAccessPercentage; |
215 | } * PSecurityDetailSettings; |
216 | |
217 | typedef struct TTradeLookupSettings { |
218 | INT32 do_frame1; // percentage |
219 | INT32 do_frame2; // percentage |
220 | INT32 do_frame3; // percentage |
221 | INT32 do_frame4; // percentage |
222 | |
223 | INT32 MaxRowsFrame1; // Max number of trades for frame |
224 | |
225 | INT32 BackOffFromEndTimeFrame2; // Used to cap time interval generated. |
226 | INT32 MaxRowsFrame2; // Max number of trades for frame |
227 | |
228 | INT32 BackOffFromEndTimeFrame3; // Used to cap time interval generated. |
229 | INT32 MaxRowsFrame3; // Max number of trades for frame |
230 | |
231 | INT32 BackOffFromEndTimeFrame4; // Used to cap time interval generated. |
232 | INT32 MaxRowsFrame4; // Max number of rows for frame |
233 | } * PTradeLookupSettings; |
234 | |
235 | typedef struct TTradeOrderSettings { |
236 | INT32 market; |
237 | INT32 limit; |
238 | INT32 stop_loss; |
239 | INT32 security_by_name; |
240 | INT32 security_by_symbol; |
241 | INT32 buy_orders; |
242 | INT32 sell_orders; |
243 | INT32 lifo; |
244 | INT32 exec_is_owner; |
245 | INT32 rollback; |
246 | INT32 type_is_margin; |
247 | } * PTradeOrderSettings; |
248 | |
249 | typedef struct TTradeUpdateSettings { |
250 | INT32 do_frame1; // percentage |
251 | INT32 do_frame2; // percentage |
252 | INT32 do_frame3; // percentage |
253 | |
254 | INT32 MaxRowsFrame1; // Max number of trades for frame |
255 | INT32 MaxRowsToUpdateFrame1; // Max number of rows to update |
256 | |
257 | INT32 BackOffFromEndTimeFrame2; // Used to cap time interval generated. |
258 | INT32 MaxRowsFrame2; // Max number of trades for frame |
259 | INT32 MaxRowsToUpdateFrame2; // Max number of rows to update |
260 | |
261 | INT32 BackOffFromEndTimeFrame3; // Used to cap time interval generated. |
262 | INT32 MaxRowsFrame3; // Max number of trades for frame |
263 | INT32 MaxRowsToUpdateFrame3; // Max number of rows to update |
264 | } * PTradeUpdateSettings; |
265 | |
266 | typedef struct TTxnMixGeneratorSettings { |
267 | // Market-Feed and Trade-Result settings don't really alter the mix. |
268 | // They are done as a by-product of Trade-Orders. However, the values |
269 | // still need to be set correctly because they get used when generating |
270 | // the random number for selecting the other transaction types. |
271 | INT32 BrokerVolumeMixLevel; |
272 | INT32 CustomerPositionMixLevel; |
273 | INT32 MarketFeedMixLevel; |
274 | INT32 MarketWatchMixLevel; |
275 | INT32 SecurityDetailMixLevel; |
276 | INT32 TradeLookupMixLevel; |
277 | INT32 TradeOrderMixLevel; |
278 | INT32 TradeResultMixLevel; |
279 | INT32 TradeStatusMixLevel; |
280 | INT32 TradeUpdateMixLevel; |
281 | |
282 | // Transaction mix levels are expressed out of a total of 1000. |
283 | INT32 TransactionMixTotal; |
284 | } * PTxnMixGeneratorSettings; |
285 | |
286 | typedef struct TLoaderSettings { |
287 | TIdent iConfiguredCustomerCount; |
288 | TIdent iActiveCustomerCount; |
289 | INT32 iScaleFactor; |
290 | INT32 iDaysOfInitialTrades; |
291 | TIdent iStartingCustomer; |
292 | TIdent iCustomerCount; |
293 | } * pLoaderSettings; |
294 | |
295 | typedef struct TDriverGlobalSettings { |
296 | TIdent iConfiguredCustomerCount; |
297 | TIdent iActiveCustomerCount; |
298 | INT32 iScaleFactor; |
299 | INT32 iDaysOfInitialTrades; |
300 | } * PDriverGlobalSettings; |
301 | |
302 | typedef struct TDriverCESettings { |
303 | UINT32 UniqueId; |
304 | RNGSEED TxnMixRNGSeed; |
305 | RNGSEED TxnInputRNGSeed; |
306 | } * PDriverCESettings; |
307 | |
308 | typedef struct TDriverCEPartitionSettings { |
309 | TIdent iMyStartingCustomerId; |
310 | TIdent iMyCustomerCount; |
311 | INT32 iPartitionPercent; |
312 | } * PDriverCEPartitionSettings; |
313 | |
314 | typedef struct TDriverMEESettings { |
315 | UINT32 UniqueId; |
316 | RNGSEED RNGSeed; |
317 | RNGSEED TickerTapeRNGSeed; |
318 | RNGSEED TradingFloorRNGSeed; |
319 | } * PDriverMEESettings; |
320 | |
321 | typedef struct TDriverDMSettings { |
322 | UINT32 UniqueId; |
323 | RNGSEED RNGSeed; |
324 | } * PDriverDMSettings; |
325 | |
326 | /****************************************************************************** |
327 | * Parameter Structures (Boolean "Is Default" State) |
328 | ******************************************************************************/ |
329 | struct TBrokerVolumeSettingsState {}; |
330 | |
331 | struct TCustomerPositionSettingsState { |
332 | bool by_cust_id; // percentage |
333 | bool by_tax_id; // percentage |
334 | bool get_history; // percentage |
335 | }; |
336 | |
337 | struct TMarketWatchSettingsState { |
338 | bool by_acct_id; // percentage |
339 | bool by_industry; // percentage |
340 | bool by_watch_list; // percentage |
341 | }; |
342 | |
343 | struct TSecurityDetailSettingsState { |
344 | bool LOBAccessPercentage; |
345 | }; |
346 | |
347 | struct TTradeLookupSettingsState { |
348 | bool do_frame1; // percentage |
349 | bool do_frame2; // percentage |
350 | bool do_frame3; // percentage |
351 | bool do_frame4; // percentage |
352 | |
353 | bool MaxRowsFrame1; // Max number of trades for frame |
354 | |
355 | bool BackOffFromEndTimeFrame2; // Used to cap time interval generated. |
356 | bool MaxRowsFrame2; // Max number of trades for frame |
357 | |
358 | bool BackOffFromEndTimeFrame3; // Used to cap time interval generated. |
359 | bool MaxRowsFrame3; // Max number of trades for frame |
360 | |
361 | bool BackOffFromEndTimeFrame4; // Used to cap time interval generated. |
362 | bool MaxRowsFrame4; // Max number of rows for frame |
363 | }; |
364 | |
365 | struct TTradeOrderSettingsState { |
366 | bool market; |
367 | bool limit; |
368 | bool stop_loss; |
369 | bool security_by_name; |
370 | bool security_by_symbol; |
371 | bool buy_orders; |
372 | bool sell_orders; |
373 | bool lifo; |
374 | bool exec_is_owner; |
375 | bool rollback; |
376 | bool type_is_margin; |
377 | }; |
378 | |
379 | struct TTradeUpdateSettingsState { |
380 | bool do_frame1; // percentage |
381 | bool do_frame2; // percentage |
382 | bool do_frame3; // percentage |
383 | |
384 | bool MaxRowsFrame1; // Max number of trades for frame |
385 | bool MaxRowsToUpdateFrame1; // Max number of rows to update |
386 | |
387 | bool BackOffFromEndTimeFrame2; // Used to cap time interval generated. |
388 | bool MaxRowsFrame2; // Max number of trades for frame |
389 | bool MaxRowsToUpdateFrame2; // Max number of rows to update |
390 | |
391 | bool BackOffFromEndTimeFrame3; // Used to cap time interval generated. |
392 | bool MaxRowsFrame3; // Max number of trades for frame |
393 | bool MaxRowsToUpdateFrame3; // Max number of rows to update |
394 | }; |
395 | |
396 | struct TTxnMixGeneratorSettingsState { |
397 | bool BrokerVolumeMixLevel; |
398 | bool CustomerPositionMixLevel; |
399 | bool MarketWatchMixLevel; |
400 | bool SecurityDetailMixLevel; |
401 | bool TradeLookupMixLevel; |
402 | bool TradeOrderMixLevel; |
403 | bool TradeStatusMixLevel; |
404 | bool TradeUpdateMixLevel; |
405 | bool TransactionMixTotal; |
406 | }; |
407 | |
408 | struct TLoaderSettingsState { |
409 | bool iConfiguredCustomerCount; |
410 | bool iActiveCustomerCount; |
411 | bool iScaleFactor; |
412 | bool iDaysOfInitialTrades; |
413 | bool iStartingCustomer; |
414 | bool iCustomerCount; |
415 | }; |
416 | |
417 | struct TDriverCEPartitionSettingsState { |
418 | bool iPartitionPercent; |
419 | }; |
420 | |
421 | struct TDriverGlobalSettingsState { |
422 | bool iConfiguredCustomerCount; |
423 | bool iActiveCustomerCount; |
424 | bool iScaleFactor; |
425 | bool iDaysOfInitialTrades; |
426 | }; |
427 | |
428 | /****************************************************************************** |
429 | * Parameter Derived Class / Template Instantiation |
430 | ******************************************************************************/ |
431 | class CBrokerVolumeSettings |
432 | : public CParametersWithDefaults<struct TBrokerVolumeSettings, struct TBrokerVolumeSettingsState> { |
433 | public: |
434 | CBrokerVolumeSettings() { |
435 | Initialize(); |
436 | } |
437 | |
438 | void InitializeDefaults(void) { |
439 | } |
440 | |
441 | void CheckDefaults(void) { |
442 | } |
443 | |
444 | void CheckValid(void) { |
445 | } |
446 | |
447 | void CheckCompliant(void) { |
448 | } |
449 | }; |
450 | |
451 | class CCustomerPositionSettings |
452 | : public CParametersWithDefaults<struct TCustomerPositionSettings, struct TCustomerPositionSettingsState> { |
453 | public: |
454 | CCustomerPositionSettings() { |
455 | Initialize(); |
456 | } |
457 | |
458 | void InitializeDefaults(void) { |
459 | dft.by_cust_id = 50; |
460 | dft.by_tax_id = 50; |
461 | dft.get_history = 50; |
462 | } |
463 | |
464 | void CheckDefaults(void) { |
465 | state.by_cust_id = (cur.by_cust_id == dft.by_cust_id); |
466 | state.by_tax_id = (cur.by_tax_id == dft.by_tax_id); |
467 | state.get_history = (cur.get_history == dft.get_history); |
468 | } |
469 | |
470 | void CheckValid(void) { |
471 | DRIVERPARAM_CHECK_BETWEEN("by_cust_id" , cur.by_cust_id, 0, 100); |
472 | DRIVERPARAM_CHECK_BETWEEN("by_tax_id" , cur.by_tax_id, 0, 100); |
473 | DRIVERPARAM_CHECK_EQUAL("by_*_id total" , cur.by_cust_id + cur.by_tax_id, 100); |
474 | DRIVERPARAM_CHECK_BETWEEN("get_history" , cur.get_history, 0, 100); |
475 | } |
476 | |
477 | void CheckCompliant(void) { |
478 | CheckValid(); |
479 | DRIVERPARAM_CHECK_DEFAULT(by_cust_id); |
480 | DRIVERPARAM_CHECK_DEFAULT(by_tax_id); |
481 | DRIVERPARAM_CHECK_DEFAULT(get_history); |
482 | } |
483 | }; |
484 | |
485 | class CMarketWatchSettings |
486 | : public CParametersWithDefaults<struct TMarketWatchSettings, struct TMarketWatchSettingsState> { |
487 | public: |
488 | CMarketWatchSettings() { |
489 | Initialize(); |
490 | } |
491 | |
492 | void InitializeDefaults(void) { |
493 | dft.by_acct_id = 35; |
494 | dft.by_industry = 5; |
495 | dft.by_watch_list = 60; |
496 | } |
497 | |
498 | void CheckDefaults(void) { |
499 | state.by_acct_id = (cur.by_acct_id == dft.by_acct_id); |
500 | state.by_industry = (cur.by_industry == dft.by_industry); |
501 | state.by_watch_list = (cur.by_watch_list == dft.by_watch_list); |
502 | } |
503 | |
504 | void CheckValid(void) { |
505 | DRIVERPARAM_CHECK_BETWEEN("by_acct_id" , cur.by_acct_id, 0, 100); |
506 | DRIVERPARAM_CHECK_BETWEEN("by_industry" , cur.by_industry, 0, 100); |
507 | DRIVERPARAM_CHECK_BETWEEN("by_watch_list" , cur.by_watch_list, 0, 100); |
508 | DRIVERPARAM_CHECK_EQUAL("by_* total" , cur.by_acct_id + cur.by_industry + cur.by_watch_list, 100); |
509 | } |
510 | |
511 | void CheckCompliant(void) { |
512 | CheckValid(); |
513 | DRIVERPARAM_CHECK_DEFAULT(by_acct_id); |
514 | DRIVERPARAM_CHECK_DEFAULT(by_industry); |
515 | DRIVERPARAM_CHECK_DEFAULT(by_watch_list); |
516 | } |
517 | }; |
518 | |
519 | class CSecurityDetailSettings |
520 | : public CParametersWithDefaults<struct TSecurityDetailSettings, struct TSecurityDetailSettingsState> { |
521 | public: |
522 | CSecurityDetailSettings() { |
523 | Initialize(); |
524 | } |
525 | |
526 | void InitializeDefaults(void) { |
527 | dft.LOBAccessPercentage = 1; |
528 | } |
529 | |
530 | void CheckDefaults(void) { |
531 | state.LOBAccessPercentage = (cur.LOBAccessPercentage == dft.LOBAccessPercentage); |
532 | } |
533 | |
534 | void CheckValid(void) { |
535 | DRIVERPARAM_CHECK_BETWEEN("LOBAccessPercentage" , cur.LOBAccessPercentage, 0, 100); |
536 | } |
537 | |
538 | void CheckCompliant(void) { |
539 | CheckValid(); |
540 | DRIVERPARAM_CHECK_DEFAULT(LOBAccessPercentage); |
541 | } |
542 | }; |
543 | |
544 | class CTradeLookupSettings |
545 | : public CParametersWithDefaults<struct TTradeLookupSettings, struct TTradeLookupSettingsState> { |
546 | public: |
547 | CTradeLookupSettings() { |
548 | Initialize(); |
549 | } |
550 | |
551 | void InitializeDefaults(void) { |
552 | dft.do_frame1 = 30; |
553 | dft.do_frame2 = 30; |
554 | dft.do_frame3 = 30; |
555 | dft.do_frame4 = 10; |
556 | dft.MaxRowsFrame1 = 20; |
557 | dft.BackOffFromEndTimeFrame2 = 4 * 8 * 3600; // four 8-hour days or 32 hours |
558 | dft.MaxRowsFrame2 = 20; |
559 | dft.BackOffFromEndTimeFrame3 = 200 * 60; // 200 minutes |
560 | dft.MaxRowsFrame3 = 20; |
561 | dft.BackOffFromEndTimeFrame4 = 500 * 60; // 30,000 seconds |
562 | dft.MaxRowsFrame4 = 20; |
563 | } |
564 | |
565 | void CheckDefaults(void) { |
566 | state.do_frame1 = (cur.do_frame1 == dft.do_frame1); |
567 | state.do_frame2 = (cur.do_frame2 == dft.do_frame2); |
568 | state.do_frame3 = (cur.do_frame3 == dft.do_frame3); |
569 | state.do_frame4 = (cur.do_frame4 == dft.do_frame4); |
570 | state.MaxRowsFrame1 = (cur.MaxRowsFrame1 == dft.MaxRowsFrame1); |
571 | state.BackOffFromEndTimeFrame2 = (cur.BackOffFromEndTimeFrame2 == dft.BackOffFromEndTimeFrame2); |
572 | state.MaxRowsFrame2 = (cur.MaxRowsFrame2 == dft.MaxRowsFrame2); |
573 | state.BackOffFromEndTimeFrame3 = (cur.BackOffFromEndTimeFrame3 == dft.BackOffFromEndTimeFrame3); |
574 | state.MaxRowsFrame3 = (cur.MaxRowsFrame3 == dft.MaxRowsFrame3); |
575 | state.BackOffFromEndTimeFrame4 = (cur.BackOffFromEndTimeFrame4 == dft.BackOffFromEndTimeFrame4); |
576 | state.MaxRowsFrame4 = (cur.MaxRowsFrame4 == dft.MaxRowsFrame4); |
577 | } |
578 | |
579 | void CheckValid(void) { |
580 | DRIVERPARAM_CHECK_BETWEEN("do_frame1" , cur.do_frame1, 0, 100); |
581 | DRIVERPARAM_CHECK_BETWEEN("do_frame2" , cur.do_frame2, 0, 100); |
582 | DRIVERPARAM_CHECK_BETWEEN("do_frame3" , cur.do_frame3, 0, 100); |
583 | DRIVERPARAM_CHECK_BETWEEN("do_frame4" , cur.do_frame4, 0, 100); |
584 | DRIVERPARAM_CHECK_EQUAL("do_frame* total" , cur.do_frame1 + cur.do_frame2 + cur.do_frame3 + cur.do_frame4, 100); |
585 | DRIVERPARAM_CHECK_LE("MaxRowsFrame1" , cur.MaxRowsFrame1, TradeLookupFrame1MaxRows); |
586 | DRIVERPARAM_CHECK_LE("MaxRowsFrame2" , cur.MaxRowsFrame2, TradeLookupFrame2MaxRows); |
587 | DRIVERPARAM_CHECK_LE("MaxRowsFrame3" , cur.MaxRowsFrame3, TradeLookupFrame3MaxRows); |
588 | DRIVERPARAM_CHECK_LE("MaxRowsFrame4" , cur.MaxRowsFrame4, TradeLookupFrame4MaxRows); |
589 | } |
590 | |
591 | void CheckCompliant(void) { |
592 | CheckValid(); |
593 | DRIVERPARAM_CHECK_DEFAULT(do_frame1); |
594 | DRIVERPARAM_CHECK_DEFAULT(do_frame2); |
595 | DRIVERPARAM_CHECK_DEFAULT(do_frame3); |
596 | DRIVERPARAM_CHECK_DEFAULT(do_frame4); |
597 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsFrame1); |
598 | DRIVERPARAM_CHECK_DEFAULT(BackOffFromEndTimeFrame2); |
599 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsFrame2); |
600 | DRIVERPARAM_CHECK_DEFAULT(BackOffFromEndTimeFrame3); |
601 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsFrame3); |
602 | DRIVERPARAM_CHECK_DEFAULT(BackOffFromEndTimeFrame4); |
603 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsFrame4); |
604 | } |
605 | }; |
606 | |
607 | class CTradeOrderSettings |
608 | : public CParametersWithDefaults<struct TTradeOrderSettings, struct TTradeOrderSettingsState> { |
609 | public: |
610 | CTradeOrderSettings() { |
611 | Initialize(); |
612 | } |
613 | |
614 | void InitializeDefaults(void) { |
615 | dft.market = 60; |
616 | dft.limit = 40; |
617 | dft.stop_loss = 50; |
618 | dft.security_by_name = 40; |
619 | dft.security_by_symbol = 60; |
620 | dft.buy_orders = 50; |
621 | dft.sell_orders = 50; |
622 | dft.lifo = 35; |
623 | dft.exec_is_owner = 90; |
624 | dft.rollback = 1; |
625 | dft.type_is_margin = 8; |
626 | } |
627 | |
628 | void CheckDefaults(void) { |
629 | state.market = (cur.market == dft.market); |
630 | state.limit = (cur.limit == dft.limit); |
631 | state.stop_loss = (cur.stop_loss == dft.stop_loss); |
632 | state.security_by_name = (cur.security_by_name == dft.security_by_name); |
633 | state.security_by_symbol = (cur.security_by_symbol == dft.security_by_symbol); |
634 | state.buy_orders = (cur.buy_orders == dft.buy_orders); |
635 | state.sell_orders = (cur.sell_orders == dft.sell_orders); |
636 | state.lifo = (cur.lifo == dft.lifo); |
637 | state.exec_is_owner = (cur.exec_is_owner == dft.exec_is_owner); |
638 | state.rollback = (cur.rollback == dft.rollback); |
639 | state.type_is_margin = (cur.type_is_margin == dft.type_is_margin); |
640 | } |
641 | |
642 | void CheckValid(void) { |
643 | DRIVERPARAM_CHECK_BETWEEN("market" , cur.market, 0, 100); |
644 | DRIVERPARAM_CHECK_BETWEEN("limit" , cur.limit, 0, 100); |
645 | DRIVERPARAM_CHECK_EQUAL("market or limit total" , cur.market + cur.limit, 100); |
646 | DRIVERPARAM_CHECK_BETWEEN("stop_loss" , cur.stop_loss, 0, 100); |
647 | DRIVERPARAM_CHECK_BETWEEN("security_by_name" , cur.security_by_name, 0, 100); |
648 | DRIVERPARAM_CHECK_BETWEEN("security_by_symbol" , cur.security_by_symbol, 0, 100); |
649 | DRIVERPARAM_CHECK_EQUAL("security_by_* total" , cur.security_by_name + cur.security_by_symbol, 100); |
650 | DRIVERPARAM_CHECK_BETWEEN("buy_orders" , cur.buy_orders, 0, 100); |
651 | DRIVERPARAM_CHECK_BETWEEN("sell_orders" , cur.sell_orders, 0, 100); |
652 | DRIVERPARAM_CHECK_EQUAL("*_orders total" , cur.buy_orders + cur.sell_orders, 100); |
653 | DRIVERPARAM_CHECK_BETWEEN("lifo" , cur.lifo, 0, 100); |
654 | DRIVERPARAM_CHECK_BETWEEN("exec_is_owner" , cur.exec_is_owner, 0, 100); |
655 | DRIVERPARAM_CHECK_BETWEEN("rollback" , cur.rollback, 0, 100); |
656 | DRIVERPARAM_CHECK_BETWEEN("type_is_margin" , cur.type_is_margin, 0, 100); |
657 | } |
658 | |
659 | void CheckCompliant(void) { |
660 | CheckValid(); |
661 | DRIVERPARAM_CHECK_BETWEEN("exec_is_owner" , cur.exec_is_owner, 60, 100); |
662 | DRIVERPARAM_CHECK_DEFAULT(market); |
663 | DRIVERPARAM_CHECK_DEFAULT(limit); |
664 | DRIVERPARAM_CHECK_DEFAULT(stop_loss); |
665 | DRIVERPARAM_CHECK_DEFAULT(security_by_name); |
666 | DRIVERPARAM_CHECK_DEFAULT(security_by_symbol); |
667 | DRIVERPARAM_CHECK_DEFAULT(buy_orders); |
668 | DRIVERPARAM_CHECK_DEFAULT(sell_orders); |
669 | DRIVERPARAM_CHECK_DEFAULT(lifo); |
670 | DRIVERPARAM_CHECK_DEFAULT(exec_is_owner); |
671 | DRIVERPARAM_CHECK_DEFAULT(rollback); |
672 | DRIVERPARAM_CHECK_DEFAULT(type_is_margin); |
673 | } |
674 | }; |
675 | |
676 | class CTradeUpdateSettings |
677 | : public CParametersWithDefaults<struct TTradeUpdateSettings, struct TTradeUpdateSettingsState> { |
678 | public: |
679 | CTradeUpdateSettings() { |
680 | Initialize(); |
681 | } |
682 | |
683 | void InitializeDefaults(void) { |
684 | dft.do_frame1 = 33; |
685 | dft.do_frame2 = 33; |
686 | dft.do_frame3 = 34; |
687 | dft.MaxRowsFrame1 = 20; |
688 | dft.MaxRowsToUpdateFrame1 = 20; |
689 | dft.MaxRowsFrame2 = 20; |
690 | dft.MaxRowsToUpdateFrame2 = 20; |
691 | dft.BackOffFromEndTimeFrame2 = 4 * 8 * 3600; // four 8-hour days or 32 hours |
692 | dft.MaxRowsFrame3 = 20; |
693 | dft.MaxRowsToUpdateFrame3 = 20; |
694 | dft.BackOffFromEndTimeFrame3 = 200 * 60; // 200 minutes |
695 | } |
696 | |
697 | void CheckDefaults(void) { |
698 | state.do_frame1 = (cur.do_frame1 == dft.do_frame1); |
699 | state.do_frame2 = (cur.do_frame2 == dft.do_frame2); |
700 | state.do_frame3 = (cur.do_frame3 == dft.do_frame3); |
701 | state.MaxRowsFrame1 = (cur.MaxRowsFrame1 == dft.MaxRowsFrame1); |
702 | state.MaxRowsToUpdateFrame1 = (cur.MaxRowsToUpdateFrame1 == dft.MaxRowsToUpdateFrame1); |
703 | state.MaxRowsFrame2 = (cur.MaxRowsFrame2 == dft.MaxRowsFrame2); |
704 | state.MaxRowsToUpdateFrame2 = (cur.MaxRowsToUpdateFrame2 == dft.MaxRowsToUpdateFrame2); |
705 | state.BackOffFromEndTimeFrame2 = (cur.BackOffFromEndTimeFrame2 == dft.BackOffFromEndTimeFrame2); |
706 | state.MaxRowsFrame3 = (cur.MaxRowsFrame3 == dft.MaxRowsFrame3); |
707 | state.MaxRowsToUpdateFrame3 = (cur.MaxRowsToUpdateFrame3 == dft.MaxRowsToUpdateFrame3); |
708 | state.BackOffFromEndTimeFrame3 = (cur.BackOffFromEndTimeFrame3 == dft.BackOffFromEndTimeFrame3); |
709 | } |
710 | |
711 | void CheckValid(void) { |
712 | DRIVERPARAM_CHECK_BETWEEN("do_frame1" , cur.do_frame1, 0, 100); |
713 | DRIVERPARAM_CHECK_BETWEEN("do_frame2" , cur.do_frame2, 0, 100); |
714 | DRIVERPARAM_CHECK_BETWEEN("do_frame3" , cur.do_frame3, 0, 100); |
715 | DRIVERPARAM_CHECK_EQUAL("do_frame* total" , cur.do_frame1 + cur.do_frame2 + cur.do_frame3, 100); |
716 | DRIVERPARAM_CHECK_LE("MaxRowsFrame1" , cur.MaxRowsFrame1, TradeUpdateFrame1MaxRows); |
717 | DRIVERPARAM_CHECK_LE("MaxRowsFrame2" , cur.MaxRowsFrame2, TradeUpdateFrame2MaxRows); |
718 | DRIVERPARAM_CHECK_LE("MaxRowsFrame3" , cur.MaxRowsFrame3, TradeUpdateFrame3MaxRows); |
719 | DRIVERPARAM_CHECK_LE("MaxRowsToUpdateFrame1" , cur.MaxRowsToUpdateFrame1, TradeUpdateFrame1MaxRows); |
720 | DRIVERPARAM_CHECK_LE("MaxRowsToUpdateFrame2" , cur.MaxRowsToUpdateFrame2, TradeUpdateFrame2MaxRows); |
721 | DRIVERPARAM_CHECK_LE("MaxRowsToUpdateFrame3" , cur.MaxRowsToUpdateFrame3, TradeUpdateFrame3MaxRows); |
722 | } |
723 | |
724 | void CheckCompliant(void) { |
725 | CheckValid(); |
726 | |
727 | DRIVERPARAM_CHECK_DEFAULT(do_frame1); |
728 | DRIVERPARAM_CHECK_DEFAULT(do_frame2); |
729 | DRIVERPARAM_CHECK_DEFAULT(do_frame3); |
730 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsFrame1); |
731 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsToUpdateFrame1); |
732 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsFrame2); |
733 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsToUpdateFrame2); |
734 | DRIVERPARAM_CHECK_DEFAULT(BackOffFromEndTimeFrame2); |
735 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsFrame3); |
736 | DRIVERPARAM_CHECK_DEFAULT(MaxRowsToUpdateFrame3); |
737 | DRIVERPARAM_CHECK_DEFAULT(BackOffFromEndTimeFrame3); |
738 | } |
739 | }; |
740 | |
741 | class CTxnMixGeneratorSettings |
742 | : public CParametersWithDefaults<struct TTxnMixGeneratorSettings, struct TTxnMixGeneratorSettingsState> { |
743 | public: |
744 | CTxnMixGeneratorSettings() { |
745 | Initialize(); |
746 | } |
747 | |
748 | void InitializeDefaults(void) { |
749 | dft.BrokerVolumeMixLevel = 49; |
750 | dft.CustomerPositionMixLevel = 130; |
751 | dft.MarketWatchMixLevel = 180; |
752 | dft.SecurityDetailMixLevel = 140; |
753 | dft.TradeLookupMixLevel = 80; |
754 | dft.TradeOrderMixLevel = 101; |
755 | dft.TradeStatusMixLevel = 190; |
756 | dft.TradeUpdateMixLevel = 20; |
757 | } |
758 | |
759 | void CheckDefaults(void) { |
760 | state.BrokerVolumeMixLevel = (cur.BrokerVolumeMixLevel == dft.BrokerVolumeMixLevel); |
761 | state.CustomerPositionMixLevel = (cur.CustomerPositionMixLevel == dft.CustomerPositionMixLevel); |
762 | state.MarketWatchMixLevel = (cur.MarketWatchMixLevel == dft.MarketWatchMixLevel); |
763 | state.SecurityDetailMixLevel = (cur.SecurityDetailMixLevel == dft.SecurityDetailMixLevel); |
764 | state.TradeLookupMixLevel = (cur.TradeLookupMixLevel == dft.TradeLookupMixLevel); |
765 | state.TradeOrderMixLevel = (cur.TradeOrderMixLevel == dft.TradeOrderMixLevel); |
766 | state.TradeStatusMixLevel = (cur.TradeStatusMixLevel == dft.TradeStatusMixLevel); |
767 | state.TradeUpdateMixLevel = (cur.TradeUpdateMixLevel == dft.TradeUpdateMixLevel); |
768 | } |
769 | |
770 | void CheckValid(void) { |
771 | DRIVERPARAM_CHECK_GE("BrokerVolumeMixLevel" , cur.BrokerVolumeMixLevel, 0); |
772 | DRIVERPARAM_CHECK_GE("CustomerPositionMixLevel" , cur.CustomerPositionMixLevel, 0); |
773 | DRIVERPARAM_CHECK_GE("MarketWatchMixLevel" , cur.MarketWatchMixLevel, 0); |
774 | DRIVERPARAM_CHECK_GE("SecurityDetailMixLevel" , cur.SecurityDetailMixLevel, 0); |
775 | DRIVERPARAM_CHECK_GE("TradeLookupMixLevel" , cur.TradeLookupMixLevel, 0); |
776 | DRIVERPARAM_CHECK_GE("TradeOrderMixLevel" , cur.TradeOrderMixLevel, 0); |
777 | DRIVERPARAM_CHECK_GE("TradeStatusMixLevel" , cur.TradeStatusMixLevel, 0); |
778 | DRIVERPARAM_CHECK_GE("TradeUpdateMixLevel" , cur.TradeUpdateMixLevel, 0); |
779 | } |
780 | |
781 | void CheckCompliant(void) { |
782 | CheckValid(); |
783 | DRIVERPARAM_CHECK_DEFAULT(BrokerVolumeMixLevel); |
784 | DRIVERPARAM_CHECK_DEFAULT(CustomerPositionMixLevel); |
785 | DRIVERPARAM_CHECK_DEFAULT(MarketWatchMixLevel); |
786 | DRIVERPARAM_CHECK_DEFAULT(SecurityDetailMixLevel); |
787 | DRIVERPARAM_CHECK_DEFAULT(TradeLookupMixLevel); |
788 | DRIVERPARAM_CHECK_DEFAULT(TradeOrderMixLevel); |
789 | DRIVERPARAM_CHECK_DEFAULT(TradeStatusMixLevel); |
790 | DRIVERPARAM_CHECK_DEFAULT(TradeUpdateMixLevel); |
791 | } |
792 | }; |
793 | |
794 | class CLoaderSettings : public CParametersWithDefaults<struct TLoaderSettings, struct TLoaderSettingsState> { |
795 | public: |
796 | CLoaderSettings(TIdent iConfiguredCustomerCount, TIdent iActiveCustomerCount, TIdent iStartingCustomer, |
797 | TIdent iCustomerCount, INT32 iScaleFactor, INT32 iDaysOfInitialTrades) { |
798 | Initialize(); |
799 | |
800 | cur.iConfiguredCustomerCount = iConfiguredCustomerCount; |
801 | cur.iActiveCustomerCount = iActiveCustomerCount; |
802 | cur.iStartingCustomer = iStartingCustomer; |
803 | cur.iCustomerCount = iCustomerCount; |
804 | cur.iScaleFactor = iScaleFactor; |
805 | cur.iDaysOfInitialTrades = iDaysOfInitialTrades; |
806 | |
807 | CheckDefaults(); |
808 | } |
809 | |
810 | CLoaderSettings() { |
811 | Initialize(); |
812 | } |
813 | |
814 | void InitializeDefaults(void) { |
815 | // NOTE: All of these parameters should match the default values hard- |
816 | // coded in src/EGenLoader.cpp via the variable names listed below. |
817 | dft.iConfiguredCustomerCount = 5000; // iDefaultCustomerCount |
818 | dft.iActiveCustomerCount = 5000; // iDefaultCustomerCount |
819 | dft.iStartingCustomer = 1; // iDefaultStartFromCustomer |
820 | dft.iCustomerCount = 5000; // iDefaultCustomerCount |
821 | dft.iScaleFactor = 500; // iScaleFactor |
822 | dft.iDaysOfInitialTrades = 300; // iDaysOfInitialTrades |
823 | } |
824 | |
825 | void CheckDefaults(void) { |
826 | state.iConfiguredCustomerCount = true; |
827 | state.iActiveCustomerCount = true; |
828 | state.iStartingCustomer = true; |
829 | state.iCustomerCount = true; |
830 | state.iScaleFactor = (cur.iScaleFactor == dft.iScaleFactor); |
831 | state.iDaysOfInitialTrades = (cur.iDaysOfInitialTrades == dft.iDaysOfInitialTrades); |
832 | } |
833 | |
834 | void CheckValid(void) { |
835 | DRIVERPARAM_CHECK_GE("iConfiguredCustomerCount" , cur.iConfiguredCustomerCount, 1000); |
836 | DRIVERPARAM_CHECK_GE("iActiveCustomerCount" , cur.iActiveCustomerCount, 1000); |
837 | DRIVERPARAM_CHECK_LE("iActiveCustomerCount" , cur.iActiveCustomerCount, cur.iConfiguredCustomerCount); |
838 | DRIVERPARAM_CHECK_EQUAL("iConfiguredCustomerCount" , cur.iConfiguredCustomerCount % 1000, 0); |
839 | DRIVERPARAM_CHECK_GE("iStartingCustomer" , cur.iStartingCustomer, 1) |
840 | DRIVERPARAM_CHECK_EQUAL("iStartingCustomer" , cur.iStartingCustomer % 1000, 1); |
841 | DRIVERPARAM_CHECK_EQUAL("iCustomerCount" , cur.iCustomerCount % 1000, 0); |
842 | DRIVERPARAM_CHECK_LE("iCustomerCount" , cur.iCustomerCount + cur.iStartingCustomer - 1, |
843 | cur.iConfiguredCustomerCount); |
844 | } |
845 | |
846 | void CheckCompliant(void) { |
847 | CheckValid(); |
848 | DRIVERPARAM_CHECK_GE("iConfiguredCustomerCount" , cur.iConfiguredCustomerCount, 5000); |
849 | DRIVERPARAM_CHECK_GE("iActiveCustomerCount" , cur.iActiveCustomerCount, 5000); |
850 | DRIVERPARAM_CHECK_EQUAL("iActiveCustomerCount" , cur.iActiveCustomerCount, cur.iConfiguredCustomerCount); |
851 | DRIVERPARAM_CHECK_DEFAULT(iScaleFactor); |
852 | DRIVERPARAM_CHECK_DEFAULT(iDaysOfInitialTrades); |
853 | } |
854 | }; |
855 | |
856 | class CDriverGlobalSettings |
857 | : public CParametersWithDefaults<struct TDriverGlobalSettings, struct TDriverGlobalSettingsState> { |
858 | public: |
859 | CDriverGlobalSettings(TIdent iConfiguredCustomerCount, TIdent iActiveCustomerCount, INT32 iScaleFactor, |
860 | INT32 iDaysOfInitialTrades) { |
861 | Initialize(); |
862 | |
863 | cur.iConfiguredCustomerCount = iConfiguredCustomerCount; |
864 | cur.iActiveCustomerCount = iActiveCustomerCount; |
865 | cur.iScaleFactor = iScaleFactor; |
866 | cur.iDaysOfInitialTrades = iDaysOfInitialTrades; |
867 | |
868 | CheckDefaults(); |
869 | } |
870 | |
871 | CDriverGlobalSettings() { |
872 | Initialize(); |
873 | } |
874 | |
875 | void InitializeDefaults(void) { |
876 | // NOTE: All of these parameters should match the default values hard- |
877 | // coded in src/EGenLoader.cpp via the variable names listed below, |
878 | // as these are the minimum build (and therefore run) values. |
879 | dft.iConfiguredCustomerCount = 5000; // iDefaultLoadUnitSize |
880 | dft.iActiveCustomerCount = 5000; // iDefaultLoadUnitSize |
881 | dft.iScaleFactor = 500; // iScaleFactor |
882 | dft.iDaysOfInitialTrades = 300; // iDaysOfInitialTrades |
883 | } |
884 | |
885 | void CheckDefaults(void) { |
886 | state.iConfiguredCustomerCount = true; |
887 | state.iActiveCustomerCount = true; |
888 | state.iScaleFactor = (cur.iScaleFactor == dft.iScaleFactor); |
889 | state.iDaysOfInitialTrades = (cur.iDaysOfInitialTrades == dft.iDaysOfInitialTrades); |
890 | } |
891 | |
892 | void CheckValid(void) { |
893 | DRIVERPARAM_CHECK_GE("iConfiguredCustomerCount" , cur.iConfiguredCustomerCount, 1000); |
894 | DRIVERPARAM_CHECK_GE("iActiveCustomerCount" , cur.iActiveCustomerCount, 1000); |
895 | DRIVERPARAM_CHECK_LE("iActiveCustomerCount" , cur.iActiveCustomerCount, cur.iConfiguredCustomerCount); |
896 | DRIVERPARAM_CHECK_EQUAL("iConfiguredCustomerCount" , cur.iConfiguredCustomerCount % 1000, 0); |
897 | } |
898 | |
899 | void CheckCompliant(void) { |
900 | CheckValid(); |
901 | DRIVERPARAM_CHECK_GE("iConfiguredCustomerCount" , cur.iConfiguredCustomerCount, 5000); |
902 | DRIVERPARAM_CHECK_GE("iActiveCustomerCount" , cur.iActiveCustomerCount, 5000); |
903 | DRIVERPARAM_CHECK_EQUAL("iActiveCustomerCount" , cur.iActiveCustomerCount, cur.iConfiguredCustomerCount); |
904 | DRIVERPARAM_CHECK_DEFAULT(iScaleFactor); |
905 | DRIVERPARAM_CHECK_DEFAULT(iDaysOfInitialTrades); |
906 | } |
907 | }; |
908 | |
909 | class CDriverCESettings : public CParametersWithoutDefaults<struct TDriverCESettings> { |
910 | public: |
911 | CDriverCESettings(UINT32 UniqueId, RNGSEED TxnMixRNGSeed, RNGSEED TxnInputRNGSeed) { |
912 | cur.UniqueId = UniqueId; |
913 | cur.TxnMixRNGSeed = TxnMixRNGSeed; |
914 | cur.TxnInputRNGSeed = TxnInputRNGSeed; |
915 | } |
916 | |
917 | CDriverCESettings(){}; |
918 | |
919 | void CheckValid(void) { |
920 | } |
921 | |
922 | void CheckCompliant(void) { |
923 | } |
924 | }; |
925 | |
926 | class CDriverCEPartitionSettings |
927 | : public CParametersWithDefaults<struct TDriverCEPartitionSettings, struct TDriverCEPartitionSettingsState> { |
928 | public: |
929 | CDriverCEPartitionSettings(TIdent iMyStartingCustomerId, TIdent iMyCustomerCount, INT32 iPartitionPercent) { |
930 | Initialize(); |
931 | |
932 | cur.iMyStartingCustomerId = iMyStartingCustomerId; |
933 | cur.iMyCustomerCount = iMyCustomerCount; |
934 | cur.iPartitionPercent = iPartitionPercent; |
935 | |
936 | CheckDefaults(); |
937 | } |
938 | |
939 | // Default constructor neccessary for CE instantiation in the |
940 | // non-partitioned case In thise case we set the current values to 0 to |
941 | // indicate that they are unused. |
942 | CDriverCEPartitionSettings() { |
943 | Initialize(); |
944 | |
945 | cur.iMyStartingCustomerId = 0; |
946 | cur.iMyCustomerCount = 0; |
947 | cur.iPartitionPercent = 0; |
948 | |
949 | CheckDefaults(); |
950 | } |
951 | |
952 | void InitializeDefaults(void) { |
953 | dft.iMyStartingCustomerId = 1; // Spec 6.4.3.1: Minimum possible starting C_ID |
954 | dft.iMyCustomerCount = 5000; // Spec 6.4.3.1: Minimum partition size |
955 | dft.iPartitionPercent = 50; // Spec 6.4.3.1: Required partition percentage |
956 | } |
957 | |
958 | void CheckDefaults(void) { |
959 | state.iPartitionPercent = (cur.iPartitionPercent == dft.iPartitionPercent); |
960 | } |
961 | |
962 | void CheckValid(void) { |
963 | DRIVERPARAM_CHECK_BETWEEN("iPartitionPercent" , cur.iPartitionPercent, 0, 100); |
964 | if (cur.iMyStartingCustomerId == 0 && cur.iMyCustomerCount == 0 && cur.iPartitionPercent == 0) { |
965 | // Partitioning Disabled: |
966 | // - in this case, the default constructor would have been used and |
967 | // all values |
968 | // are set to 0. This must be considered valid. |
969 | } else { |
970 | // Partitioning Enabled: |
971 | // Spec clause 6.4.3.1 has many requirements, these are the ones |
972 | // that we validate here: |
973 | // - minimum C_ID in a subrange is the starting C_ID for a LU |
974 | // - minimum C_ID size of a subrange is 5000 |
975 | // - size of a subrange must be an integral multiple of LU |
976 | DRIVERPARAM_CHECK_EQUAL("iMyStartingCustomerId" , cur.iMyStartingCustomerId % 1000, 1); |
977 | DRIVERPARAM_CHECK_GE("iMyCustomerCount" , cur.iMyCustomerCount, 1000); |
978 | DRIVERPARAM_CHECK_EQUAL("iMyCustomerCount" , cur.iMyCustomerCount % 1000, 0); |
979 | } |
980 | } |
981 | |
982 | void CheckCompliant(void) { |
983 | CheckValid(); |
984 | |
985 | if (cur.iMyStartingCustomerId == 0 && cur.iMyCustomerCount == 0 && cur.iPartitionPercent == 0) { |
986 | // Partitioning Disabled |
987 | } else { |
988 | // - CE partition is used 50% of the time |
989 | DRIVERPARAM_CHECK_DEFAULT(iPartitionPercent); |
990 | } |
991 | } |
992 | }; |
993 | |
994 | class CDriverMEESettings : public CParametersWithoutDefaults<struct TDriverMEESettings> { |
995 | public: |
996 | CDriverMEESettings(UINT32 UniqueId, RNGSEED RNGSeed, RNGSEED TickerTapeRNGSeed, RNGSEED TradingFloorRNGSeed) { |
997 | cur.UniqueId = UniqueId; |
998 | cur.RNGSeed = RNGSeed; |
999 | cur.TickerTapeRNGSeed = TickerTapeRNGSeed; |
1000 | cur.TradingFloorRNGSeed = TradingFloorRNGSeed; |
1001 | } |
1002 | |
1003 | CDriverMEESettings(){}; |
1004 | |
1005 | void CheckValid(void) { |
1006 | } |
1007 | |
1008 | void CheckCompliant(void) { |
1009 | } |
1010 | }; |
1011 | |
1012 | class CDriverDMSettings : public CParametersWithoutDefaults<struct TDriverDMSettings> { |
1013 | public: |
1014 | CDriverDMSettings(UINT32 UniqueId, RNGSEED RNGSeed) { |
1015 | cur.UniqueId = UniqueId; |
1016 | cur.RNGSeed = RNGSeed; |
1017 | } |
1018 | |
1019 | CDriverDMSettings(){}; |
1020 | |
1021 | void CheckValid(void) { |
1022 | } |
1023 | |
1024 | void CheckCompliant(void) { |
1025 | } |
1026 | }; |
1027 | |
1028 | typedef struct TDriverCETxnSettings { |
1029 | CBrokerVolumeSettings BV_settings; |
1030 | CCustomerPositionSettings CP_settings; |
1031 | CMarketWatchSettings MW_settings; |
1032 | CSecurityDetailSettings SD_settings; |
1033 | CTradeLookupSettings TL_settings; |
1034 | CTradeOrderSettings TO_settings; |
1035 | CTradeUpdateSettings TU_settings; |
1036 | |
1037 | CTxnMixGeneratorSettings TxnMixGenerator_settings; |
1038 | |
1039 | bool IsValid(void) { |
1040 | try { |
1041 | CheckValid(); |
1042 | return true; |
1043 | } catch (CCheckErr) { |
1044 | throw; |
1045 | return false; |
1046 | } |
1047 | } |
1048 | |
1049 | bool IsCompliant(void) { |
1050 | try { |
1051 | CheckCompliant(); |
1052 | return true; |
1053 | } catch (CCheckErr) { |
1054 | throw; |
1055 | return false; |
1056 | } |
1057 | } |
1058 | |
1059 | void CheckValid(void) { |
1060 | BV_settings.CheckValid(); |
1061 | CP_settings.CheckValid(); |
1062 | MW_settings.CheckValid(); |
1063 | SD_settings.CheckValid(); |
1064 | TL_settings.CheckValid(); |
1065 | TO_settings.CheckValid(); |
1066 | TU_settings.CheckValid(); |
1067 | TxnMixGenerator_settings.CheckValid(); |
1068 | } |
1069 | |
1070 | void CheckCompliant(void) { |
1071 | BV_settings.CheckCompliant(); |
1072 | CP_settings.CheckCompliant(); |
1073 | MW_settings.CheckCompliant(); |
1074 | SD_settings.CheckCompliant(); |
1075 | TL_settings.CheckCompliant(); |
1076 | TO_settings.CheckCompliant(); |
1077 | TU_settings.CheckCompliant(); |
1078 | TxnMixGenerator_settings.CheckCompliant(); |
1079 | } |
1080 | } * PDriverCETxnSettings; |
1081 | |
1082 | } // namespace TPCE |
1083 | |
1084 | #endif //#ifndef DRIVER_PARAM_SETTINGS_H |
1085 | |