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 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

...

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);
			// ..
		}
	}	
	// ...
}


How Spectra Adapter reacts on Sequence reset messages (

...

35=4)

move to How to use Spectra Application Listener callbacks

The new type of messages (Sequence Reset) was introduced in Spectra 1.4.2

A Sequence Reset message received in incremental feed starts recovery for all subscribed instruments by firing OnRecoveryStarted is calledOnBookReset is called(link) and the callback OnBookReset (link) is fired as well.

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

Info
titleNote

Sequence reset messages causing a recovery in Trades feeds but recovery is unable to be performed there because TCP Recovery mechanism doesn't work in the current version Spectra Adapter.