Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

move to "How to" for MOEX Spectra MD Adapter 


MOEX Market Data Multicast FIX/FAST Platform uses custom UTCTimeOnly, UTCTimestamp format in the 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

MOEX Spectra Market Data Adapter handles this format in the following way: TBD

...

Example of handling time from MDEntryTime

Code Block
languagecpp
titleApplication.cpp
collapsetrue
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);
			// ..
		}
	}	
	// ...
}

...

MOEX Spectra Market Data Adapter handles Sequence Reset message in the following way:

  1. A Sequence Reset message received in Incremental feed initiates recovery mechanism for all subscribed instruments. 
    In this case, MOEX Spectra Market Data Adapter

    fires OnRecoveryStarted (link) and the callback OnBookReset (link)

    fires Spectra::InstrumentListener::onRecoveryStarted() and Spectra::InstrumentListener::onBookReset() callbacks.

  2. Sequence filtering mechanism isn't applied to Sequence Reset messages. 
    Therefore, OnRecoveryStarted and OnBookReset callbacks would be fired for each sequence reset message and even more than once due to A-B arbitrage. 

...

titleNote

...