Herb Sutter has published his C++ and Beyond talk on Const and Mutable in C++ 11.
Treat market data with caution
Stale market data occurred yesterday on the Nasdaq, according to TheTradeNews.com:
As a result of the error, market data for many Nasdaq-listed stocks did not refresh for around 15 minutes, rendering some consolidated tape data unreliable. The issue was resolved at around 13.53 EST, according to a Nasdaq OMX statement.
Filed under Finance
News on US Circuit Breakers
TheTradeNews.com reports that the rollout of new circuit breakers could be delayed to allow firms longer to implement them.
The new limit up-limit down (LULD) and market-wide circuit breakers are scheduled for introduction on 4 February but could be delayed until 6 April, pending approval by the Securities and Exchange Commission (SEC). Testing for the enhanced circuit breakers is expected to commence on 26 January.
Here’s how it’s supposed to work:
Under the current proposals, if the national best offer of a stock equals the lower price band, or if the national best bid of a stock equals the upper price band, trading in that stock will enter a ‘limit state’.
In a limit state, trades at the upper or lower limit must be adjusted or cancelled within 15 seconds to prevent a pause to trading of that stock. The length of a pause will depend on the liquidity characteristics of the stock in question, currently five minutes for S&P 500 and Russell 1000 constituents and at 10 minutes for most other securities.
Trades that are entered outside of the price band set for a stock will be rejected or adjusted to an appropriate price, at the discretion of the broker entering the trade.
Filed under Finance
QuickCheck for C++
I’ve used FsCheck with XUnit for writing and running unit tests, so will be interested to see how the concepts translate to C++ in QuickCheck++ and AutoCheck.
Filed under C++, Programming
Impact of volatile and atomic on performance
Marc Brooker posted an interesting breakdown on the performance impact on use of volatile and atomic. He also points out that volatile alone doesn’t prevent concurrency issues – if you need synchronisation, then you need atomic.
Filed under C++
Dark Pools in the news
Two dark pools are in the news:
The two cases differ decidedly, according to industry pros. In the Pipeline case, the settlement was based on fraud and resulted in direct charges against individuals. Pipeline failed to disclose that more than 97 percent of orders in its dark pool at times were filled by a trading operation affiliated with the firm.
LeveL ATS is rebounding as 2012 comes to a close. It says clients are returning since its parent firm, eBX LLC, paid an $800,000 fine and settled charges that LeveL failed to properly safeguard information on customers’ unexecuted orders, which were stored and allegedly reused in a smart order router.
In the same article, news on brokers who are analysing the profile of those trading in their dark pools, e.g. The Light Pool by Credit Suisse:
The alternative system classifies users by how they trade. The venue categorizes participants, helping mutual funds, hedge funds, pensions and endowments trade only with parties they are comfortable with.
Filed under Finance
The Future of Life – from Biology to the Biosphere
I was fortunate to attend this excellent presentation by Stephen Emmott at the Institute of Engineering and Technology, London in December. They’ve now made the video available:
![]() |
The Future of Life: From Biology to the Biosphere Stephen Emmott The Future of Life Evening Lecture, 2012-12-13 00:00:00.0 IT Channel |
Filed under Technology, Video
Delegating Constructors in C++11
Here’s some code that tries out C++ 11 delegating constructors. These were announced as part of Visual Studio in the November CTP and avoid the need to refactor common code out of constructors into an “init” function. There are examples of their use in Stephan Levavej’s excellent video series too.
class Request
{
public:
enum class Priority{ High, Medium, Low };
static const Priority defaultPriority(){ return Priority::Low; }
// Constructor with all parameters fully specified
Request( Priority priority, const std::string& requestId ) :
m_priority( priority ),
m_requestId( requestId )
{
std::cout
<< "Request( Priority priority, const std::string& requestId ) called: "
<< "RequestId " << m_requestId << ", "
<< "Priority " << toString( m_priority ) << "\n";
}
// Delegate to fully specified constructor above
Request( const std::string& requestId ) :
Request( defaultPriority(), requestId )
{
std::cout
<< "Request( const std::string& requestId ) called: "
<< "RequestId " << requestId << "\n";
}
// Contrived example to demonstrate chaining delegating constructors
Request( const std::vector<int>& requestId ) :
Request( toString( requestId ) )
{
std::cout << "Request( const std::vector<int>& requestId ) called\n";
}
// Contrived example to show that ~Request() is called if the delegating constructor completed
Request( Priority priority ) :
Request( priority, "Empty" )
{
throw std::exception( "This constructor is deprecated, RequestId field is now mandatory." );
}
~Request()
{
std::cout
<< "~Request() called:"
<< "RequestId " << m_requestId << ", "
<< "Priority " << toString( m_priority ) << "\n";
}
private:
std::string toString( const std::vector<int>& requestId )
{
std::string tmpId;
for (auto elem : requestId)
{
if ( elem < 0 || 9 < elem )
throw std::exception("Invalid request id, should be digits");
tmpId.push_back(static_cast<char>(elem + '0'));
}
return tmpId;
}
std::string toString( Priority p )
{
if (p == Priority::Low ) return "Low";
else if ( p == Priority::Medium ) return "Medium";
else if ( p == Priority::High ) return "High";
else
throw std::exception( "Unexpected Priority" );
}
Priority m_priority;
const std::string m_requestId;
};
And here’s a program that exercises the Request class (this uses musingstudio::initialize to conveniently initialize a standard container):
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "\nCall fully specified constructor\n";
Request fullySpecified( Request::Priority::High, "HeartTransplant-749553" );
std::cout << "\nCall a delegating constructor\n";
Request defaultPriority( "BookDelivery-5542" );
std::cout << "\nCall chained delegating constructors\n";
Request legacy( musingstudio::initialize<std::vector<int>>( { 1, 6 } ) );
std::cout << "\nThis should throw without executing the destructor...\n";
try
{
// This should throw due to -ve input, but does NOT execute ~Request()
// because no constructor call completed
Request invalid( musingstudio::initialize<std::vector<int>>( {-1} ) );
}
catch( const std::exception& exc )
{
std::cout << "ERROR: " << exc.what() << std::endl;
}
std::cout << "\nThis should throw and execute the destructor...\n";
try
{
// This will throw because no requestId is not specified
// (contrived example to show that ~Request() is executed
// because the delegating constructor succeeded).
Request noRequestId( Request::Priority::Low );
}
catch( const std::exception& exc )
{
std::cout << "ERROR: " << exc.what() << std::endl;
}
std::cout << "\nRemaining destructors...\n";
return 0;
}

As with other Nov CTP features, Visual Studio intellisense hasn’t caught up yet, so expect to see red squiggly lines all over the code if you try this out.
What’s interesting is that it’s now possible for ~Request() to be called if a constructor fails to complete, as long as the delegatee (inner) constructor does complete.
Filed under C++ Code
Money and Speed: Inside the Black Box
HFT Review publicized this excellent video by Marije Meerman on the flash crash:
In her latest film ‘Money and Speed: Inside the Black Box’ she continues this format, talking of High Frequency Trading and the ‘Flash Crash’ of 6th May 2010 through the eyes of the regulators and market participants.
Paul Wilmott is one of the contributors.
Setting max_load_factor to infinity in an unordered_set (to avoid re-hashing)
This StackOverflow post was cited on the ISO C++ blog. Interesting that they set the max_load_factor to std::numeric_limits::infinity(), but the crux of the question is whether it’s ok to iterate over the newly inserted items as well as the original items.
Filed under C++



