// cmvc_id = %Z% %W% %I% %E% %U% #ifndef histgenIMPLEMENTATION #define histgenIMPLEMENTATION #include #include #include #include #include #include #include "RandGen.H" #include "cal.H" #include "Time.H" inline int max(int a, int b) { return (a>b)?a:b; } inline int min(int a, int b) { return (a " << endl; return 1; } int n = atoi(av[1]); int t = atoi(av[2]); int tps = (n*t)/28800; // ticks per second tps++; cout << "Ticks per second: " << tps << endl; // Generation of base info int nex = 5; char *ex[] = { "NY", "O", "AM", "LN", "TK"}; int nsic = 10; char *sic[] = { "COMPUTERS", "CHEMICALS", "FINANCIAL", "INDUSTRIAL", "PHARMACEUTICALS", "MEDICAL", "BANKING", "SOFTWARE", "ENTERTAINMENT", "CONSTRUCTION" }; char *cu[] = { "USD", "DEM", "JPY", "FFR", "GBP"}; int ncu = 5; char *spr[] = { "AAA", "AA", "A", "BBB", "BB", "B", "CCC", "CC", "C"}; int nspr = 9; unsigned int rnum; char id[100]; char descr[256]; char *crdate = "3/11/1999"; for (i=0; i 5)? +1:-1; bp[sec] = (dir*rg(0,3)*tick)+bp[sec]; int bs = rg(1,100) * 100; pricefile << "Id: " << id; pricefile << ",SeqNo: " << ++seq[sec]; pricefile << ",TradeDate: " << cal; pricefile << ",TimeStamp: " << tm; pricefile << ",BidPrice: " << bp[sec]; pricefile << ",BidSize: " << bs; pricefile << ",Type : Q" << endl; break; } case 3: // cancel/correct as a trade { if (rg(0,100) < 5) break; double tp = bp[sec]; int ts = rg(1,100) * 100; pricefile << "Id: " << id; pricefile << ",SeqNo: " << seq[sec]; pricefile << ",TradeDate: " << cal; pricefile << ",TimeStamp: " << tm; pricefile << ",TradePrice: " << tp; pricefile << ",TradeSize: " << ts; pricefile << ",Type : CT" << endl; break; } default: break; } } // Go to the next second tm++; } pricefile.close(); } #endif