Java Stock Trend Analysis Program :)

Reply

Join Date: Jul 2005
Posts: 4,845
Reputation: joshSCH is on a distinguished road 
Solved Threads: 9
joshSCH's Avatar
joshSCH joshSCH is offline Offline
Banned

Java Stock Trend Analysis Program :)

 
0
  #1
Jun 8th, 2007
Alright guys.. I'm back in the java forums for help/suggestions. I'm sure one of the Daniweb java programming geniuses will be able to decide if this idea is too difficult or needs to be revised.

I was thinking of writing a stock trend analysis program. There will be a stock object that contains an array of 10 doubles, each of which contain a dollar amount for the value of a specific stock. Every 6 seconds, a double is recorded from a quote streaming program provided by a broker. After all 10 doubles have been entered into the array (1 minute later), the program will evaluate the current angle of the slope, the curve's concavity, the integrated area of the curve between position 0 of the array and position 9. Based on this information, the stock is then sorted by whether or not it is a priority*, then by the angle of the slope.

Each object stock will contain:
int open- value at which the specific stock opened at
int volume- volume of the current traded shares of the day
int integrate- value of the integral from array position 0 to position 9
int slope- slope of the curve measured between positions 8 and 9 of the array.. this will be an angle between -90 degrees and 90 degrees.

String symbol- that specific stock's symbol
boolean priority- evaluates to true if the stock's concavity has just shifted, the value of position 9 in the array is less than the opening stock value, and if the slope is rising/falling depending on concavity.

On execution, the program will immediately retrieve information regarding every stock, (open, symbol), and saves every stock to an arraylist of stock objects

Next, the program will output everything to a graphical interface (probably a table)

Finally, the program will begin retrieving stock data from the broker, and update the table every minute.


What do yall think? I could easily write everything.. except the streamreader that communicates with the broker.. I have yet to discover how to do this.. The brokerage firm I use actually uses java for its instant quote streamer data, so hopefully that will make things less complicated.. but if you have any suggestions, know how to write a streamreader, or know of a program like this that has already been created then please post
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,120
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 471
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is online now Online
Code tags enforcer

Re: Java Stock Trend Analysis Program :)

 
0
  #2
Jun 9th, 2007
>Next, the program will output everything to a graphical interface (probably a table)
would be nicer if you can give outout in form of graph with something like JGraph, maybe??? If so, you would like to keep your calculated values in DB (in case let say, in middle of the day system crash, you will only loose data which been currently processed and data send to you while recovering from crash)
I think I can be good exercise
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4,845
Reputation: joshSCH is on a distinguished road 
Solved Threads: 9
joshSCH's Avatar
joshSCH joshSCH is offline Offline
Banned

Re: Java Stock Trend Analysis Program :)

 
0
  #3
Jun 9th, 2007
ah good advice.. I wasn't even thinking about what would happen in case of a crash. Yea, I'll have to see what swing component would work best..

I really have no clue how to communicate with my broker's stock streamer applet..
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4,845
Reputation: joshSCH is on a distinguished road 
Solved Threads: 9
joshSCH's Avatar
joshSCH joshSCH is offline Offline
Banned

Re: Java Stock Trend Analysis Program :)

 
0
  #4
Jun 9th, 2007
The Scottrader Streaming Quotes applet connects via socket (ports 80 and 443).

How can I communicate with this applet?
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,581
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 461
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Java Stock Trend Analysis Program :)

 
0
  #5
Jun 10th, 2007
Maybe these links would give you an idea.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4,845
Reputation: joshSCH is on a distinguished road 
Solved Threads: 9
joshSCH's Avatar
joshSCH joshSCH is offline Offline
Banned

Re: Java Stock Trend Analysis Program :)

 
0
  #6
Jun 10th, 2007
thanks.. but from what I've read, I would have to know specifics about the program to invoke specific methods and such.. and I seriously doubt they will let me have a look at the source

..but, I believe there is a way via secure http that I can access the information that I want.. I am currently looking into this, and it seems relatively easy..

if anyone finds out a way in which one can communicate with a java program w/out directly knowing its source code and methods, then please inform me. Thanks
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Java Stock Trend Analysis Program :)

 
2
  #7
Jun 10th, 2007
I could tell you a lot about that, but can't because of contractual obligations.
My work involves (among other things) maintaining a piece of software that generates analysis charts from streaming stockmarket information...

We use our own systems for capturing (which I don't maintain), filtering/retrieving from the database/stream (which I help maintain), and presenting (which I do maintain) the data.

It's far from a trivial task to do all that. Our software is maintained by a team of some 25 people fulltime, plus another dozen or so to maintain the database and hardware.
And that doesn't include the people sending us the information (stock exchanges, banks, investment firms, etc.).

We use JFreeChart (on the Java side, we also have .NET and C++ software) for charting, with some ten thousand lines of custom code to generate the data to be charted and customise the charts every which way.

I do hope you define "every stock" as "every stock from a list we're interested in"?
We DO have every stock (from the exchanges we capture, something like a hundred of them I think) and there's tens of thousands of the buggers.
Add options, futures, warrants, bonds, CDS, CDX, currency futures, etc. etc. and we are now working with roughly 2 million instruments.

The only way to talk to a Java program (or any program for that matter) is to know its public API (if it has one) and how to talk to it (RMI, SOAP, COM, etc. etc.).
For this kind of information that's almost certainly quite well hidden, and the public interface you see in that applet won't have any means to talk to it from software. It will in fact itself talk to another piece of software on their servers to retrieve the information over a secure channel, probably RMI or SOAP.

To give you an idea of the cost of that data:
We market our data at an initial price of several hundred dollars per workstation per year plus a flat fee of I think $1 per instrument per workstation per month.
Things are sold in packages (an instrument type for an exchange for example).
The money involved is tremendous. Deals can run into the hundreds of thousands of dollars, even millions of dollars, per year.

If you work for a company that has a business need to get the data, you'll be able to get budget to get the data legally.
If not you're likely going to have to resort to some simulated system instead, which would be good to have anyway for testing purposes so you can have predictable data for testing.

If you're serious about getting such data and can get the budget I may be able to bring you into contact with some of our account managers. But only if you're dead serious please, this business is no joke and me (and them) are busy enough as it is.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 4,845
Reputation: joshSCH is on a distinguished road 
Solved Threads: 9
joshSCH's Avatar
joshSCH joshSCH is offline Offline
Banned

Re: Java Stock Trend Analysis Program :)

 
0
  #8
Jun 10th, 2007
Originally Posted by jwenting View Post
I could tell you a lot about that, but can't because of contractual obligations.
My work involves (among other things) maintaining a piece of software that generates analysis charts from streaming stockmarket information...

We use our own systems for capturing (which I don't maintain), filtering/retrieving from the database/stream (which I help maintain), and presenting (which I do maintain) the data.

It's far from a trivial task to do all that. Our software is maintained by a team of some 25 people fulltime, plus another dozen or so to maintain the database and hardware.
And that doesn't include the people sending us the information (stock exchanges, banks, investment firms, etc.).

We use JFreeChart (on the Java side, we also have .NET and C++ software) for charting, with some ten thousand lines of custom code to generate the data to be charted and customise the charts every which way.

I do hope you define "every stock" as "every stock from a list we're interested in"?
We DO have every stock (from the exchanges we capture, something like a hundred of them I think) and there's tens of thousands of the buggers.
Add options, futures, warrants, bonds, CDS, CDX, currency futures, etc. etc. and we are now working with roughly 2 million instruments.

The only way to talk to a Java program (or any program for that matter) is to know its public API (if it has one) and how to talk to it (RMI, SOAP, COM, etc. etc.).
For this kind of information that's almost certainly quite well hidden, and the public interface you see in that applet won't have any means to talk to it from software. It will in fact itself talk to another piece of software on their servers to retrieve the information over a secure channel, probably RMI or SOAP.

To give you an idea of the cost of that data:
We market our data at an initial price of several hundred dollars per workstation per year plus a flat fee of I think $1 per instrument per workstation per month.
Things are sold in packages (an instrument type for an exchange for example).
The money involved is tremendous. Deals can run into the hundreds of thousands of dollars, even millions of dollars, per year.

If you work for a company that has a business need to get the data, you'll be able to get budget to get the data legally.
If not you're likely going to have to resort to some simulated system instead, which would be good to have anyway for testing purposes so you can have predictable data for testing.

If you're serious about getting such data and can get the budget I may be able to bring you into contact with some of our account managers. But only if you're dead serious please, this business is no joke and me (and them) are busy enough as it is.
Wow, I do appreciate all that information and time you put into the post.

By "every stock", I meant every single one that is traded daily (even the pink sheets). I planned on having a txt file with all the stock symbols on it, where a program would read them all in... however, if there are that many then perhaps I should limit myself.. I have no clue of how much ram and processor resources that this program will need..

hmm.. I found the URL that executes the java applets (there are actually 3-4 programs that open up simultaneously), and I found this code in the html:
  1. <APPLET height=1 archive=scottraderv4_2_2.jar width=1 code="MainClassApplet.class">
So, I presume the java main class is MainClassApplet.class. Also, the applet connects via socket. Is there not a way to somehow communicate with this applet? If not, is there a way in which I can manipulate and communicate with the server? Since the app does use socket, perhaps there is a way I can ask the server for info myself..

And about your proposal, I'm simply some teen who is just 'discovering' the stock market.. so I don't wish to waste your time or your colleague's time either.. I just thought this program would help my trading strategies a bit.. but, if someone did want to obtain your software, about how much would it cost for the simplest form?
Last edited by joshSCH; Jun 10th, 2007 at 12:02 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,581
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 461
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Java Stock Trend Analysis Program :)

 
0
  #9
Jun 10th, 2007
If this is just a simple and plain educational java project, I would suggest you not to think a lot about it. After all, the aim here is to learn and not to make a professional grade software. I assume you wouldn't have that kind of money to throw around.

Create a dummy 'stock broker' database which would be used pull out data. I am pretty sure the people who are to see this project don't expect you to connect to a real 'Stock broker' when you explain to them the constraints faced.

Other than that, its your call in the end.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Java Stock Trend Analysis Program :)

 
0
  #10
Jun 10th, 2007
best would indeed be to make your own dummy dataset and present that.
If you feel interested you can make some sort of generator even that creates new data based on some trend information and previous values as a simulator, so it appears to have life data.

By having that pretty much external to your main system you can have it so that you could relatively easily create a connector to have your system talk to real datasources instead if and when you get access to them.

And no, you wouldn't have the money it takes as a student.
Even a small contract to supply once daily updates for a few hundred instruments could set you back $10K.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC