• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

.NET HFT systems

  • Thread starter Thread starter Tsotne
  • Start date Start date
Joined
1/13/11
Messages
1,362
Points
93
C++ is undoubtedly the king in algo systems. I wonder if anyone can point to .NET made trading system which has been written completely on .NET and comment on latency and comparison with other technology made systems.
 
Tsotne, "C++ is undoubtedly the king in algo systems" How true is this statement? Well, I know C++, Java and other prog lang. C++ is a good prog language no doubt, and I like it just because it's a little harder than other languages, and has a learning curve to master it. In contrast Java is much easier and clearer which makes it accessible for large crowds ( smart and less smart ppl) and some of them are not fun to work with. But in reality, you can do in Java anything you can do in C++. So your statement is not fully true, and a lot of people that claim that have a historical cause, and they have C++ background and they want to defend it hard which is understandable
 
Tsotne, "C++ is undoubtedly the king in algo systems" How true is this statement? Well, I know C++, Java and other prog lang. C++ is a good prog language no doubt, and I like it just because it's a little harder than other languages, and has a learning curve to master it. In contrast Java is much easier and clearer which makes it accessible for large crowds ( smart and less smart ppl) and some of them are not fun to work with. But in reality, you can do in Java anything you can do in C++. So your statement is not fully true, and a lot of people that claim that have a historical cause, and they have C++ background and they want to defend it hard which is understandable

I don't there is any kind of programming language that is handicapped compared to other in terms of "you can't do something in it".
The major difference is how easy it is to implement something on each language.
 
But in reality, you can do in Java anything you can do in C++.

Depends on your definition of High Frequency, if your alpha comes from having bounded latency at the micro second level, Java is not a good decision (because of the non deterministic garbage collection). If your latency have to be bounded at the millisecond(s) level, after some tweaking of the VM Java is just fine.
 
Am not in HFT programming, but if you want real time programming, Jave has a whole specification for real time Java, and you can bound your latency to micro-second not millisecond. Moreover its garbage collection is deterministic and also the threads priorities's problem is solved with RTJ
http://www.devx.com/Java/Article/35246/1954
 
Tsotne, "C++ is undoubtedly the king in algo systems" How true is this statement? Well, I know C++, Java and other prog lang. C++ is a good prog language no doubt, and I like it just because it's a little harder than other languages, and has a learning curve to master it. In contrast Java is much easier and clearer which makes it accessible for large crowds ( smart and less smart ppl) and some of them are not fun to work with. But in reality, you can do in Java anything you can do in C++. So your statement is not fully true, and a lot of people that claim that have a historical cause, and they have C++ background and they want to defend it hard which is understandable

This is a mistaken impression. Many languages "can do anything that can be done in C++" but there are performance, speed issues which have been discussed million times here and it's not worth to go through once again. But C++ is an ideal language for algos and has more power than many other languages which beat C++ in terms of GUI, ease with DB integration, etc. So the statement: "C++ is undoubtedly the king in algo systems" is true.
 
Depends on your definition of High Frequency, if your alpha comes from having bounded latency at the micro second level, Java is not a good decision (because of the non deterministic garbage collection). If your latency have to be bounded at the millisecond(s) level, after some tweaking of the VM Java is just fine.

BTW, in .NET languages you can control the garbage collector occurrence manually (not fully though) but it requires careful predictions when it might hit in.

Thanks everyone for your interesting inputs, but let's not deviate from the topic.
 

Take C# and C++ for comparison in terms of algo performance. That's what I meant. For more info, consult Daniel Duffy, Dominic and other professionals. Even for more info, search for professional comments about the power of different languages in algo systems.
 
Take C# and C++ for comparison in terms of algo performance. That's what I meant. For more info, consult Daniel Duffy, Dominic and other professionals. Even for more info, search for professional comments about the power of different languages in algo systems.

This answer is very short sighted and not really complete. C++ is good for the pieces of the code that need to be extremely fast (microsecond fast) and when you need sub-ms speed. You will pay a price for this, longer development time, complex debugging and higher probability of errors.

So, it is better to develop on a high level language far remove from bare metal (IMHO, C++ is 2 levels out bare metal. C is one level and ASM is bare metal) that will prevent you for hurting yourself (C++ let you hurt yourself... and the ones around you). Then, use C++ for those critical speed pieces. Hence, C++ is far from ideal.
 
C++ is undoubtedly the king in algo systems. I wonder if anyone can point to .NET made trading system

Isn't .Net offered in a C++ flavour? Do you mean a C# .NET trading system versus a non-.Net C++ one?
 
Few random replies about the topic.

>> Java has a whole specification for real time Java, and you can bound your latency to micro-second not millisecond.

RTJ and any other real time specifiation have nothing to do with speed. Read time is always about guarantees and never about speed of execution. If you can guarantee that under any circumstances you can complete required operations in 1 hour (whatever other processes will do with your system) then we can speak about real time environment.

>> If your latency have to be bounded at the millisecond(s) level, after some tweaking of the VM Java is just fine.
It's possible to achieve performance at the level of few dozens of nanoseconds with Java (and C#). I posted about it few days ago.
http://www.quantnet.com/forum/threads/disruptor-concurrent-programming-framework.6862/

On processors at moderate clock rates we have seen over 25 million messages per second and latencies lower than 50 nanoseconds. This is very close to the theoretical limit of a modern processor to exchange data between cores.
Just write cache friendly code, don't allocate on the heap a lot (pre allocation is your friend), reduce contention for shared memory, try to avoid memory fences (especially on the boxes with few CPUs), reuse already allocated chunks of memory, avoid "false sharing" and you can process data at the stated above speed.
 
personally I like C++, but please stop saying it's faster than Java, It was the case years ago ( Think JIT). As for garbage collection, C# and Java handle the objects the same way ( Yes, you can nullify your objects to help for GC to start, or suggest for the system to start gc but it's not guaranteed to do so). Moreover the next version of Java (Java 7) will implement a new GC algorithm (G1) garbage first instead of Mark and sweep algorithm used till now, and this will make Java even faster unless the programmer writes a very bad and memory consuming programs.
 
In .NET systems exclude all .NET supporting but independently functional languages like C++. I mainly meant for C#. GC is not the only thing interrupting the program flow and there are many ways to prevent GC to occur but not important here. Count only speed in performance when we call C++ a leader in high speed algos and not the development time which has to be given up while programming in low level language. That's why I'm seeking if it is common and which softwares exists made in C# particularly and Java. Not that much interested in nanoseconds (although that's why I meant C++ as king in such systems). But all in all, if speed is not the greatest concern then why do most MFE programs require you to have C++ background and teach you mainly (if not only) that language there?!
 
if speed is not the greatest concern then why do most MFE programs require you to have C++ background and teach you mainly (if not only) that language there?!

Legacy code, interviewers, getting a job in big old financial institution.
 
Legacy code, interviewers, getting a job in big old financial institution.

Weird no? If something better exists (and C++ is not more powerful than that as you say) , then why scratch head with ugly syntax, ugly memory management, complex programming constructs, error prone script, etc, etc. whoever you are - "interviewer, big old financial institution", etc. considering that speed is not the concern...Why don't those institutions change the road to modern PLs then?
 
Weird no? If something better exists (and C++ is not more powerful than that as you say) , then why scratch head with ugly syntax, ugly memory management, complex programming constructs, error prone script, etc, etc. whoever you are - "interviewer, big old financial institution", etc. considering that speed is not the concern...Why don't those institutions change the road to modern PLs then?

Welcome to the real world!!

How much do you think is going to cost them to change? Also, on average, people are afraid of new things and changes, too much risk involved, etc, etc.
 
Welcome to the real world!!

How much do you think is going to cost them to change? Also, on average, people are afraid of new things and changes, too much risk involved, etc, etc.

This is not first and not last. Seems inevitable in future. If some of the competitors in a particular field switch to modern day programming bringing the advantage to their operations, others will be forced to follow their foot steps.
 
Alain got it right, and that's what I have been saying. All those motto of C++ is the best came from people that have been using C++ for 20 or 30 years, so it's not easy to give it up. Plus the legacy code in C/C++ which doesn't make sense to change it. However C++ is a nice language to separate you from the crowd. But talking about performance, is talking about the running time of your algorithm is it O(n2) or O(n).. is it parallelized ?...
Check out Fortran and functional languages
Here is a nice article about that: http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php
 
Back
Top