OnixS C++ CME iLink 3 Binary Order Entry Handler 1.18.9
API Documentation
Loading...
Searching...
No Matches
Audit Trail Generator

The audit trail generator sample is included in the distribution package and is located in the samples directory. This tool can be used to generate the CME audit trail files.

It has the following arguments:

  • LogFileToAnalyse - The path to the *.summary log file that will be used as a source file for audit trail data.
  • OutputFieldDelimiter - The delimiter between fields in the resulting audit file (by default, the comma is used).
  • CMETradeDayStartTimeUtc - The CME trade day start time in UTC (by default, 4:45 CST - 9:45 UTC is used).

Example:

$ AuditTrailGenerator SESSION_NAME.summary


Note
The format of the *.summary log file and audit trail requirements for CME iLink 3 differs from the iLink 2. Therefore, there are two different audit trail generators. This means that the audit trail generator for iLink 2 cannot be used to generate audit trail files for iLink 3.

Source code

using namespace OnixS::CME::iLink3;
using namespace OnixS::CME::iLink3::Tools;
namespace
{
std::vector<std::string> split(const std::string & str, char sep)
{
std::vector<std::string> elems;
std::stringstream ss(str);
std::string item;
while (std::getline(ss, item, sep))
{
elems.push_back(item);
}
return elems;
}
}
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cerr
<< "\nCME Audit Trail Spreadsheet Generator."
"\n\tUsage: [SummaryFileName|DirectoryName] (OutputFieldDelimiter) (CMETradeDayStartTimeUtc)\n\t"
"where CMEStartTradeDayTimeUtc - CME trade day start time in UTC " << std::endl;
return 1;
}
try
{
// The CME trade day start time in UTC (by default, 4:45 CST - 9:45 UTC is used).
unsigned int hour = 9;
unsigned int minute = 45;
if (argc == 4)
{
std::string sTime(argv[3]);
std::vector<std::string> parts = split(sTime, ':');
hour = std::atoi(parts.at(0).c_str());
minute = std::atoi(parts.at(1).c_str());
}
Timestamp cmeTradeDayStartTimeUtc(1970u, Month::January, 1u, hour, minute, 0);
AuditTrailGenerator generator (argv[1], cmeTradeDayStartTimeUtc, argc > 2 ? argv[2][0] : ',');
generator.generate();
}
catch (const std::exception& ex)
{
std::cerr << "EXCEPTION: " << ex.what() << std::endl;
return 1;
}
catch (...)
{
std::cerr << "Unknown error." << std::endl;
return 1;
}
std::clog << "Done." << std::endl;
return 0;
}