Tag Archives: event driven

C++ event driven meta programming libraries

C++ event driven programming libraries

This is very critical for a high speed system but also must be done efficiently. After watching the latest Stuart Kozola webinar on this for Matlab:


You need to understand how critical this ios for efficiency in your code for high performing trading systems. I am looking at ways to optimize that with these many choices. There is event driven metaprocessing which is even more complex but faster since the system will be state free.

Event driven C++ Metaprograming

I would recommend to look my about link. Also realize that this is one of the key advantages you use C++ since neither Python or R is built for this. Also, you cannot use any language that has a garbage collector like C# or Java. I am sure you could but you better really need to understand the mechanics of these languages to keep the garbage collector at bay.

Just a note, this is the best link but Windows based only: http://www.husseinsspace.com/teaching/udw/1996/cnotes/chapsix.htm

Even more added links:


In my view, the most interesting aspect of constexpr is its speed. constexpr functions can perform compile-time computations at lightening speed. To compare the performance I implemented an is_prime algorithm in 3 different ways

…. As long as parameter number is an integral constant, this constexpr version will compute the result at compile-time (C++11 compilers only)


Examples like this make the code bloated and unreadable http://www.codeproject.com/Articles/3743/A-gentle-introduction-to-Template-Metaprogramming

To be honest my link above that contains this site is the best: http://bartoszmilewski.com/category/metaprogramming/

Join my FREE newsletter to learn which C++ tricks are used for high frequency trading 




NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Event driven C++ Metaprograming

Event driven C++ Metaprograming

I am just understanding the power of this. I have seen this is in a few multimillion dollar trading systems. It was also highlighted by Stuart Kozola’s latest Matlab automated trading webinar video. This is the fastest way to implement a HFT system. It is also complicated to learn





These 2 uses modern metapgrogramming


C++17: I See a Monad in Your Future!

Functional Data Structures in C++: Lists

Here is som books for c++ and .NET



Join my FREE newsletter to see how to implement the fastest types of design patterns for HFT


NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Is Python still the best programming environment to backtest your event driven data?

Is Python still the best programming environment to backtest  your event driven data?

I still prefer Matlab for backtesting. It is easier and most likely faster to pick up but what do I know.


Thanks to the NYC Contact for this.

Join our FREE newsletter to Learn how we backtest around here with Matlab

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

More on most profitable in HFT among market making, event driven and stat arb? C++ vs C# vs Matlab vs Java and RenTec low latency


More on most profitable in HFT among market making, event driven and stat arb? C++ vs C# vs Matlab vs Java and RenTec low latency


there were discussion about c++ or matlab and java/c#. Everybody accepted that matlab is powerful to solve issues of numeric and statistic, etc. But when they use it in HFT situation, it’s recognized very slow. Then some people thought c++ was better and others thought a combination of matlab and java or c# could get speedier. I thought many were doubtful about connectivity between the two. A few were successful and said they used their own one for HFT. What do you think of this discussion?




could you please expand the concept of predatory algorithms?
Is it just normal bid offer size manipulation that you are talking about?



About statarb there is a problem of decreasing profitability over time as more and more players do the same. I am talking about plain simple pair trading (any asset class) not more complex relationships with fundamentals.





MATLAB is great for developing and algo and testing In my experience they are powerful yet do not go hand in hand with HFT. If you have something you feel works, get it developed in another environment. Which environment? Well, it all depends on what you are trying to accomplish. If a program is written by a highly skilled C++ programmer (and I mean HIGHLY skilled), then yes it can be extremely fast. But is it scalable? How does it work on one processor vs 30 processors? How long will development take? How easily can you modify it? You need to consider all these things before giving a proper answer.

We program with C# in a .NET environment because it is extremely fast, highly scalable and what would take a good programmer 3 months in C++, takes us days to do the same thing because Microsoft has already pre-built a lot in C#. Everything in C++ has to be built from the ground up. We also have a PHD student working on a project that will prove F# is a far better language to scale algorithms with.

If you can’t win, change the rules of the game.

I hope this makes some sense!


thanks for information. I did not know that F# is that better.

it could be the case that the profitability of stat arb is decreasing. It’s a rat race. You have to always optimize parameters as mentioned that the ability to change your parameters to tweak your algorithms real time is crucial. If your watching asset classes be more widened, you could find another arbitrage opportunities, i.g. stocks and FX, stocks and bonds, etc.


A colleague used to work at RenTec. From what I gathered, they use a blend of market making combined with predictive algos. So when they don’t have an edge in predicting price they act like market maker, going for ticks. However, when they get a “predictive” signal, then they take directional exposure.
Some more facts…they are the largest user of Mini SP contract by a huge margin. Two russian ex employees quit and tried to start their own fund. Jim Simons hired lawyers to stop them. I never found out if they ultimately did, but considering they Russian I’d bet they eventually did. The annual research budget for RenTec is 200-300million. One ex employee described some of RenTec strategies as borderline “software hacking”.
RenTec holds the patent for parts of code that is used for some execution software.

Getco,tradebot is just brute force. They make more money because they have lower latency. That’s almost all of their game.

RenTec is light years ahead of them. They have slower connections but still outrade.


great comment! I would have never guessed RenTec is behind in the latency game.

BTW, what do you mean by borderline “software hacking”?

Also if they hold patents, then they must be publicly listed on the US patent website. Would be interesting to look them up…


I wouldn’t say RenTec is behind in latency game, they just don’t solely rely on low latency unlike the others. When you have a predicitive edge over everyone else, you don’t have to rely as much on brute speed. RenTec staff is still composed of mainly researchers not just programmers and IT staff. That pretty much says it all.

The ex employees said “software hacking”. They could just be angry, but who knows. Nothing would surprise me.

They still ahead of everyone else, no matter how you slice it.

The real takeaway is that there have been other shops with multi milion budgets and staff that never made it. It proves that it’s half art, half science.

The original article started here:



NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!

Which do you think is the most profitable in HFT among market making, event driven and stat arb?

Which do you think is the most profitable in HFT among market making, event driven and stat arb?

Many think HFT is profitable, but few only know which is the most profitable. Let’s discuss a piece of the fact.


Interesting question! I think market making used to be a great form of income, yet now they are getting gamed by faster and more sophisticated predatory algorithms which take advantage of the rules they are forced to abide by. We are actually working to help market makers get their edge back with what we call combative algorithms. Event driven trading can really be limited to a couple firms that have the money for Ultra low latency algo’s, and unless you have that you are getting in the market while they are getting out! For the most part I would vote stat arb as being the “most profitable”, just because that is what majority of trading strategies

I found in Wikipedia that two HFT butiques occupy 15~20% of the whole equity transactions in the USA, which is surprising. They started as a market maker and made huge money in 2008. The profitability of market making seems to be dependent on market volatilities. In terms of HFT stat arb, are there giants like the market makers?


which 2?


they are GETCO and TradeBot.


In what sense most profitable? Return on investment? Absolute profits? The question could be formulated better.

Having said that, if I had to put my last savings into either of the HFT firms, I would choose market making. The source of income for market maker is the spread (and rebates). Only uninformed traders will give you the spread if the prices are predictable. If the prices are unpredictable you can prove that as a market maker you are guaranteed profit (in theory).

Event-driven arbitrage and statistical arbitrage require research and predicting. You are betting on statistical relationships, which acutally can break down. Profit is not guaranteed.

Finally, many market makers do in fact engage in statistical and event-driven arbitrage: they are not mutually exclusive. For example, your stat arb system tells you that the spread between Google and Apple is too large and you should short one and buy the other. You take these instructions to your market making part and adjust your quotes (price and size).



On my part, firstly absolute profits, then return on investment. If it’s small profits with high return of investment, it’s not enough for me. If its return of investment is very low despite huge profits, it’s not attractive for me, either.

As you said, a market maker seems to be guaranteed. But he still has a risk to be a uninformed trader in the case of trading with/against an informed (institutional) investor. In order to be more informed, what does he have to do? Research, accurate forecasting and brushing up trading techniques easily pop up. In reality, it’s rare to have all skills in one company. So some company has competents in one area and other has them in another area. That’s my general thought, so I asked “are there giants like the market makers?”. The giant market makers may do well in stat arb or event driven. If you know how they do well in both ereas, please let me know.


I don’t know many giants. I know RenTec is a giant in statistical aribtrage. They have to have world’s highest average IQ of an employee. Without a numerical phd you don’t have a chance with them.

Then there is Citadel. I think they’re big in market making, but I’m not sure. Googling will definately give you some answers.

You are correct that market makers have to reseach something, but it is still different that if you trade purely stat arb. Besides, if price are random, then there is nothing to research and you are guaranteed a profit.


I checked out RecTec webpages and reached to Job Openings page. They want quantitative finance candidates who they say ideally have “A Ph.D. in Computer Science, Mathematics, Physics, Statistics, or a related discipline”. There is no word “a phd in finance”. It seems like computer science is the most important for them. Then I understood the reason why they are a top runner in HFT field.

In terms of how they trade, I didn’t get a clue in the pages unfortunately, cause I couldn’t log in. But time is changing. In1980s, a high IQ guy dropped out from Turtles training course. Nowadays, high IQ guys seem to be successful. Things on the earth must not differ so much from the broard perspective. I am curious what kind of skills they, phds in non finance, have in general.


This thread at Nuclear Phynance is the best source on RenTec:


Also, search for Jim Simmons, the RenTec’s founder. He does not like to give out info about his hedge fund, but there are some interesting interviews with him floating the interwebs.



Would PhDs in RenTec use regression to grasp a price behavior or pattern? Kinds of regression vary from ols (ordinary least square) to ridge. But almost all of them are based on the assumptions of normal distribution, which looks like to have relatively big estimate errors when implementing into practice. I have heard from some statistician that another methods could be better to forecast the future than statistical methods.

In a sense, PhDs in mathematics or physics are advantageous in utilizing regression, cause they understand the fundermentals on the mathematical ( or statistical ) tool. So they could modify or improve it to gain less estimate errors. But nobody knows how. Is there somebody who plays or will play a roll that Donchains did on Turtles.


I found another article about HFT houses and other players. A bit interesting.



thanks for the article. We know the race to zero is occupied by the few firms mentioned in this article and above. Going forward, the only way to compete is to have more flexible algorithms. The ability to change your parameters to tweak your algorithms real time, will ultimately be a longer term solution for success.



NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!