...
Info |
---|
this approach allows keeping original version of configuration files. |
How to get MDEntryTime with nano second precision.
move to "How to" for MOEX Spectra MD Adapter
MOEX Spectra uses custom UTCTimeOnly, UTCTimestamp format in FAST messages.
Find more details in official documentation: http://ftp.moex.com/pub/FAST/Spectra e.g. http://ftp.moex.com/pub/FAST/Spectra/docs/spectra_fastgate_en.pdf
Example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
void ConvertTimeToStr(System::u64 entry, std::string* strTime)
{
static std::size_t const TIME_LENGTH = sizeof( "HHMMSSsssssssss" ) - 1;
std::stringstream stream;
stream << entry; // convert u64 to std::string.
std::string time(stream.str());
if (TIME_LENGTH > time.size())
time.insert(0, TIME_LENGTH - time.size(), '0');
strTime->assign(time, 0, 2); // HH
strTime->append( ":");
strTime->append(time, 2, 2); // MM
strTime->append( ":");
strTime->append(time, 4, 2); // SS
strTime->append( ".");
strTime->append(time, 6, 9); // sssssssss
}
bool InstrumentHandler::onIncrement( Spectra::SpectraSubscriptionItem const& subsItem, Engine::FIXMessage const* const* msgs, size_t incrementsCount )
{
// ...
for( ; i < incrementsCount; ++i ) {
const Engine::FIXGroup& gr = msgs[i].getAsGroup( FIXFields::NoMDEntries );
for( int j = 0; j < gr.size(); ++j ) {
const Engine::TagValue& entry = *gr.getEntry(j);
std::string timeNs;
if (entry.hasValue(FIXFields::MDEntryTime))
ConvertTimeToStr(entry.getAsUInt64(FIXFields::MDEntryTime), &timeNs);
// ..
}
}
// ...
} |