Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a Java based stock trading application, need pointers for technologies to use

I am building an application in Java (with a jQuery frontend) that needs to talk to a third party application. it needs to update the interface every two seconds at the most.

Would it be a good idea to use comets? If so, how do they fit into the picture?

What other means/technologies can I use to make the application better?

The application will poll stock prices from a third party app, write it to a database and then push it to the front end every second, for the polling, I have a timer that runs every second to call the third party app for data, I then have to display it to the front end using JSP or something,

well at this point im not sure if I should use a servlet to write this out to the front end, what would you recommend? how should I go about it?

is there any new technology that I can use instead of servlets?

I am also using Berkeley db to store the data, do you think its a good option? what would be the drawbacks, if any for using berkeley..

im absolutely clueless so any advice will be much appreciated.

Thanks!

edit : I am planning to do this so that a deskop app constantly polls from the thrid part and writes to the database and a web app only reads and displays from the database, this will reduce the load on the web app and all it has to do is read from db.

like image 371
Mponnada Avatar asked Nov 16 '25 18:11

Mponnada


2 Answers

Take a look at using a web application framework instead of Servlets - unless it's a really basic project with one screen. There are lots in the Java world unfortunately and it can be a bit of a minefield. Stick with maybe SpringMVC or Struts 2, the worst part is setting these up, but take a look at a sample application plus a tutorial or two and work from there.

http://www.springsource.org/about

http://struts.apache.org/2.x/index.html

Another option to look at is using a template framework such as Appfuse to get yourself up and running without having to integrate a lot of the framework together, see:

http://appfuse.org/display/APF/AppFuse+QuickStart

It provides you with a template to setup SpringMVC with MySQL as a database plus Spring as an POJO framework. It may be a quick way to get started and up and building a prototype.

Judging by your latency requirement of 2 seconds it would be wise to look at some sort of AJAX framework - JQuery or Prototype/Scriptaculous are both good places to start.

http://jquery.com/

http://www.prototypejs.org/

In terms of other technoloqies to make things better you will want to consider a build system, Ant/Maven are fine with Maven the slightly more complex of the two.

http://ant.apache.org/

http://maven.apache.org/download.html

Also, consider JUnit for testing the application. You might want to consider Selenium for functional testing of the front end.

http://www.junit.org

http://seleniumhq.org/

like image 191
Jon Avatar answered Nov 18 '25 08:11

Jon


Is this really a stock trading application? Or just a stock price display application? I am asking because from your description it sounds like the latter.

How critical is it that data is polled every second? Specifically would it matter if some polls are a second or two late?

If you are building a stock trading application (where the timing is absolutely critical), or if you cannot afford to be delayed on your polling, I'd recommend you have a look at one of the Java Real Time solutions:

  • Sun Java Real-Time System (http://java.sun.com/javase/technologies/realtime/index.jsp)
  • WebSphere Real Time (http://www-01.ibm.com/software/webservers/realtime/)
  • Oracle JRockit Real Time (http://download.oracle.com/docs/cd/E13150_01/jrockit_jvm/jrockit/docs30/index.html)

Other than that, my only advice is that you stick to good OO design practices. For instance, use a DAO to write to your database, this way, if you find that Berkeley DB isn't quite for you, you can switch to a relational database system with relative ease. It also makes it easy for you to move on to some database partitioning solutions (e.g., Hibernate Shards) if you decide you need it.

While I may have my own technology preferences (for instance, I'd choose Spring MVC for the front end as others have mentioned, I'd try and use Hibernate for persistance), I really cannot claim that these would be better than other technologies out there. Go with something you are familiar with, if it fits the bill.

like image 33
Jack Leow Avatar answered Nov 18 '25 08:11

Jack Leow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!