CPU Intensive Trading System

Discussion in 'Hardware' started by naifwonder, Feb 27, 2008.

  1. I have been working on a system for some time now, and have finally gotten some of it coded. The only problem is that I cannot progress further into the development process because my computer cannot handle the amount of calculations it needs to make. My computer has a Pentium 4 3.06 ghz processor and 1gb ram.

    To better explain what the issue is, I will explain a few details about the system itself. The system uses an algorithm I created to calculate where the market will be headed for the next few ticks. The output would look something like this

    Time (H:M:S)| Projected Move
    12:30:07 PM | + 5 ticks
    12:30:08 PM | + 4 ticks
    12:30:10 PM | + 5 ticks
    12:30:13 PM | + 6 ticks

    The above output tells the time the signal was generated, and the projected move for the market at that time. The output is stored to a database for future reference. I also have a GUI setup to display the outputs to me in real-time. Now comes the problem. The system is making the calculations just fine, however, I cannot get the output in real-time because it lags. Instead of seeing the signal for 12:30:08 at that exact time, I am seeing it a minute later. Basically, the system is lagging by a minute. As the system runs, the lag time increases incrementally.

    I have tried optimizing the code, but the lag is still there. It is imperative that I can access the signals in real-time without any lag to use the system properly. At this point, it seems that a more powerful computer might be the solution. As such, does anyone have any recommendations as to where one could find such a computer?

    The options are so vast that I am having trouble sifting through it all. I would greatly appreciate any feedback I can get on this matter - recommended manufacturers, should I get a desktop or a server PC, amount/type of ram, processor type/speed, etc. If possible, I would like to have large storage capacity, but that is not the most important thing for me at the moment. By large, I mean at least 500GB of hard drive space. I would like to keep the price tag for the computer within $2,700, but if needed, I am willing to go to $3,700.
     
  2. MGJ

    MGJ

    Is it correct to say that your code needs to be sped up by a factor of 60? (needs to run in 1 second, actually does run in 60 seconds).

    Factors of 1.3 are easy to get. Factors of 2 are possible. Factors of 4, maybe. Factors of 60? You need a new algorithm.
     
  3. In terms of what calculations are run, the algorithm is in its empirical form and cannot be simplified any further. I am trying to make it run a bit faster, but code can only go so far before the hardware needs an upgrade.
     
  4. onelot

    onelot

    throwing some money at a new computer isn't going to do anything if you don't know why/where your code is slow.

    invest some money in a good profiler and figure out exactly why your signals are 1min delayed. dev-partner has some good tools.
     
  5. The problem is no the algorithm.

    The problem is the time frame you are functioning on.

    Instead of a few ticks, try changing it so that it calculates the 2 to 4 major moves that the market makes every day. Then you would have plenty of time, and the lag would be inconsequential.

    See what I mean?

    Your thoughts ...
     
  6. ... is of course the right answer.

    To the OP - it might not be your prediction algorithm that is the bottleneck. Have a look at the database and GUI performance.

    However, your CPU is old and you will get a lot better performance out of recent Intel C2Ds. The new 45nm chips with 6 Mb L2 cache look very attractive and very reasonably priced. You should be able to put together a decent box for under $1K.
     
  7. can you rewrite some of the code to run in a multi-thread environment?
     
  8. Thank you. I will try that and hopefully I can further streamline things.

    I'll check out the database link to see if that is the problem. Thank you.

    However, I still feel that a new computer would be a good investment at the moment and would like to continue looking further into that. It would open up more options for me as far as the quantity of data I can include in my research.
     
  9. The system was written in C#, and to be honest, I am still relatively new to the language (have only been coding in it for about a month). I used to do a lot of programming in PHP for web development, which is why I managed to pick up on C# so quickly. I am not familiar with running code in a multi-thread environment. I will read up on it today. If you have any resources that you think I should check out, I will take a look at them.

    Also, just as a note if it helps to know - the GUI and the application that actually processes the algorithm are separate. If I choose to, I can run the GUI on one computer and have the system itself run on another computer.
     
  10. #10     Feb 28, 2008