Tag Archives: advice

Useful Options advice for trading

Use Options trading advice from NYC trader
Other latest news
Luxury Leather Seat
Dr Paul Cottrell talks about his latest finding using this newer framework
24% Return with Low Drawdown
I also got a 20 minute tutorial how to set this up. This Matlab project should be part of your arsenal

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

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!

Looking for advice on performance difference between DotNET C Sharp and Visual C++ handling memory mapped files

Looking for advice on performance difference between DotNET C Sharp and Visual C++ handling memory mapped files

I am looking for a debate on the difference between these two languages. As for Java, I am under the impression it really offers not much advantage as compared to either language unless you want to run under Linux. To do the equivelant of this under Java, use the NIO framework.

Visual C++ examples:

http://quantlabs.net/academy/forum/technical-forum/are-these-the-best-examples-for-c-memory-mapped-files-and-rapid-in-memory-processing/#p527

C# with performance comparison

http://quantlabs.net/academy/forum/technical-forum/are-these-the-best-examples-for-dotnet-c-sharp-memory-mapped-files-and-rapid-in-memory-processing/#p528

From this benchmark link:

http://www.codeproject.com/Articles/212856/Head-to-head-benchmark-Csharp-vs-NET

I conclude that:
1. C++ can still be 2x time faster than in C# in certain critical number crunching scenarios

2. Dump Mono as that is not even to be used. Stick with Windows Server editions for extra horsepower anf many other advantages for server side features

Other highlights:

C++, on the other hand, reveals absolutely no difference between the template <double> version and the original non-template version

The results are clear. First of all, C++ wins in every case. If you use the x86 JIT, 

Anyway, VC++ wins big this time, typically running twice as fast as .NET, if not more (and Mono brings up the rear again, at 8.6 seconds). My experience suggests that array range checks can’t account for such a big difference, but investigation is hindered because I still don’t know how to look at C#’s optimized assembly. Go ahead and laugh at me. Ha!

The first time I ran this “Polynomials” benchmark in C# and C++ (VS 2008, x86), the result was that C++ finished in 0.034 seconds, and C# in 7.085 seconds, making C++ was 208 times faster! Of course, other than the C++ DEBUG hash_map test that took over 10 hours, this was the most extreme result I had ever seen. The C++ result seemed impossible: the outer loop does 10 million iterations and the two inner loops do 100 iterations each, for a total of 2 billion iterations. There was no way so much work could be done in 0.034 seconds on a 2.83 GHz processor. Indeed, looking at the assembly of the outer loop, you can see that the compiler had done something amazing:

Strangely, however, the MS STL’s map<K,V> is actually faster than its hashtable (hash_map or unordered_map), although not as fast as my hash_map. In the .NET world, SortedDictionary is slower than Dictionary as you would expect… but does it have to be this much slower?

C++ wins by a landslide! C++’s map<K,V> is quite fast, while C#’s SortedDictionary<K,V> is quite slow. 

There’s no clear winner for this test. Generally, C# did a better job in the “double” test (even when C++ is allowed to use SSE2), but a worse job in the FPL8 and FPL16 tests. C# is tied with C++ in the float test, until you enable SSE which causes C++ to win

 

Evidently, C++ is faster than C# if you read the whole file as one block. This makes sense, because .NET actually has to do more work in these tests: it is decoding UTF-8 to UTF-16. Standard C++, in contrast, doesn’t support conversion between text encodings, and these tests use “char” strings (not wchar_t), so the only extra work C++ has to do is to convert line endings (\r\n to \n), work which C# does too.

It is therefore peculiar that C# wins the second test, reading line-by-line (ReadLine() in C# vs getline() orfgets() in C++). It occurs to me I could have optimized the FILE* version better; for example, fgets() does not return the string length. So, to eliminate the '\n' at the end of the string (necessary to make the code’s behavior equivalent to the other two versions), I call strlen() to get the string length, then change the last character to ‘\0’. It might have been faster to convert to std::string first (which determines the string length) and then remove the last character.

***If you use P/Invoke a lot, though, it’s important to consider how long it takes to cross the boundary between C# and C++.

Now, these results are not terrible. But non-P/Invoke calls are much faster, as you’ll see below.

 

 

Join my FREE newsletter to learn more which is better 

 

A comment cam in from a newsletter subscriber so thanks to him:

 

I’ve done this in C#.  I did not do it in C++ as for my needs C# performance was more than sufficient for this case.
When used in conjunction with something like .NET’s AutoResetEvent which can be shared across multiple processes it is surprisingly fast.  So if you are using it for something like inter process communication it works quite well!
Now with respect to how it compares to C++, I am not sure but you could probably test this out pretty quickly.  My guess is that the underlying parts which handle this might even be written in C/C++ and .NET is using p/invoke into these OS DLL’s to offer the functionality.  A simple test might be writing in 100 million objects and seeing how each perform.
Keep in mind that you can mix native/managed fairly easily through the use of C++/CLI or P/Invoke.  Both work very well.
I find C++ to require a bit more effort than C# and a lot more than F# so it’s best saved for algorithms that REALLY benefit from it and even than you can offload to the native side where necessary.  You can always use C++/CLI to wrap your native code and hold a pointer to whatever your native class might be.  The only penalty you are faced with in this case is the additional chatter that might be taking place between the native/managed boundary.
One scenario where managed simply might not work is if it critical that the operation you are performing MUST take place within a specific tolerance level as you are vulnerable to garbage collection operations (but even in this case there is room to tune).
Hopefully you find this useful!

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

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!

Here is some Mathematicians Against Fraudulent Financial and Investment Advice

Here is some Mathematicians Against Fraudulent Financial and Investment Advice

This topic is a first for this site! Important I would assume but thanks to the my usual NYC contact for sending this.

http://www.m-a-f-f-i-a.org/

Learn how we will implement this through our FREE newsletter

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

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!

Goldman’s advice to buy equities gives me the creeps!

Goldman’s advice to buy equities gives me the creeps!

“We think it’s time to say a ‘long good-bye’ to bonds, and embrace the ‘long good buy’ for equities” announces Goldman Sachs! This sort of pronouncement has the ability to turn someone who’s been a diehard bull since 2010 into a cowering bear. Read the rest using link. Cheers!

 

Goldman Sachs advice scares the beejeebies out of me! maverickinvestors.com

“We think it’s time to say a ‘long good-bye’ to bonds, and embrace the ‘long good buy’ for equities” announces Goldman Sachs! This sort of pronouncement has the ability to tur…

 

]Good post. I think it’s getting harder and harder to trust their advice these days.

 

Anyone who trusts Goldman Sachs for any advice needs to seek another type of advice and preferably with lots of meds attached. What these jokers are after is liquidity and someone to soak up the losses on the other side of the arbitrage opportunities. Investors are backing off and volume has been light. Not conducive to the quants out there looking to high frequency the beejeepers out of equities. Fresh meat is needed to fuel the fires. Of course they might get in trouble for conflicts of interest and pay lets say oh…. 10% of their profits in fines. Clearing 90% which covers the executive bonus pools and pads the year end returns. Securities regulators get a nice fat fine on the books to fund their operations and everyone is happy…oh except for the fresh meat.

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

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!

Mark Joshi’s advice to wannabe quants quantturk.com

Mark Joshi’s advice to wannabe quants quantturk.com

Proffesor Joshi, a researcher and consultant on mathematical finance shares his valuable advices for wannabe quants in the following link: http://www.markjoshi.com/downloads/advice.pdf-
Follow LukaszLukasz Staniec • Well written, thank you, always wanted to know the different specializations of the variety of quants

 

HOW DO YOU START A PROFITABLE TRADING BUSINESS? Read more NOW >>>

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!