943,802 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 12831
  • Java RSS
You are currently viewing page 1 of this multi-page discussion thread
Jun 8th, 2007
0

Java Stock Trend Analysis Program :)

Expand Post »
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
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jun 9th, 2007
0

Re: Java Stock Trend Analysis Program :)

>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
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004
Jun 9th, 2007
0

Re: Java Stock Trend Analysis Program :)

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..
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jun 9th, 2007
0

Re: Java Stock Trend Analysis Program :)

The Scottrader Streaming Quotes applet connects via socket (ports 80 and 443).

How can I communicate with this applet?
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jun 10th, 2007
0

Re: Java Stock Trend Analysis Program :)

Maybe these links would give you an idea.
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jun 10th, 2007
0

Re: Java Stock Trend Analysis Program :)

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
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jun 10th, 2007
2

Re: Java Stock Trend Analysis Program :)

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.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jun 10th, 2007
0

Re: Java Stock Trend Analysis Program :)

Click to Expand / Collapse  Quote originally posted by jwenting ...
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:
Java Syntax (Toggle Plain Text)
  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.
Reputation Points: 1315
Solved Threads: 10
Banned
joshSCH is offline Offline
4,845 posts
since Jul 2005
Jun 10th, 2007
0

Re: Java Stock Trend Analysis Program :)

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.
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Jun 10th, 2007
0

Re: Java Stock Trend Analysis Program :)

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.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Quick Questions!
Next Thread in Java Forum Timeline: Seeking help in Java Projects





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC