finance.stocks
Class StockUtils

java.lang.Object
  extended by finance.stocks.StockUtils

public class StockUtils
extends java.lang.Object

User: lyon Date: Jul 9, 2007 Time: 12:56:05 PM Copyright DocJava, Inc. 2005.


Constructor Summary
StockUtils()
           
 
Method Summary
static double[] getAccumulation(java.lang.String symbol, java.util.Date startDate, java.util.Date endDate)
          This routine computes the accumulation by taking the priceDelta * Volume and adding it until the end-date

priceDelta = closePrice - openPrice
an accumulation > 0 indicates the stock is under accumulation.

static double[] getDeltaP(java.lang.String symbol, java.util.Date startDate, java.util.Date endDate)
           
static java.util.Date getNextTradingDate(java.util.Date startDate)
          This will return the next trading day, provided that it has already occured.
static java.util.Date[] getNPreviousTradingDates(java.util.Date endDate, int n)
          Look back 2*n calendar days and extract the n trading days previous to the endDate.
static double[] getTurnover(java.lang.String symbol, java.util.Date startDate, java.util.Date endDate, int period)
           
static void graphAccumulation()
           
static void graphAccumulation(java.lang.String symbol, java.util.Date startDate, java.util.Date endDate)
           
static void graphDeltaP(java.lang.String symbol, java.util.Date startDate, java.util.Date endDate)
           
static void graphPrice()
          EODQuotes.graphGui - prompts the user for symbol, start date and end date.
static void graphPrice(java.lang.String symbol, java.util.GregorianCalendar start, java.util.GregorianCalendar end)
           
static void graphTurnOver()
           
static void graphTurnOver(java.lang.String symbol, java.util.Date startDate, java.util.Date endDate, int period)
           
static void graphVolume()
           
static void main(java.lang.String[] args)
           
static void printCV(java.lang.String symbol, int daysPrior, java.util.Date endDate)
          Compute the coeffient of variation daysPrior to the endDate for the stock.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StockUtils

public StockUtils()
Method Detail

graphPrice

public static void graphPrice()
EODQuotes.graphGui - prompts the user for symbol, start date and end date.


graphPrice

public static void graphPrice(java.lang.String symbol,
                              java.util.GregorianCalendar start,
                              java.util.GregorianCalendar end)
                       throws java.text.ParseException,
                              java.io.IOException
Throws:
java.text.ParseException
java.io.IOException

graphVolume

public static void graphVolume()
                        throws java.text.ParseException,
                               java.io.IOException,
                               javax.swing.text.BadLocationException
Throws:
java.text.ParseException
java.io.IOException
javax.swing.text.BadLocationException

graphTurnOver

public static void graphTurnOver()
                          throws java.text.ParseException,
                                 java.io.IOException,
                                 javax.swing.text.BadLocationException
Throws:
java.text.ParseException
java.io.IOException
javax.swing.text.BadLocationException

graphTurnOver

public static void graphTurnOver(java.lang.String symbol,
                                 java.util.Date startDate,
                                 java.util.Date endDate,
                                 int period)
                          throws java.io.IOException,
                                 javax.swing.text.BadLocationException,
                                 java.text.ParseException
Throws:
java.io.IOException
javax.swing.text.BadLocationException
java.text.ParseException

getTurnover

public static double[] getTurnover(java.lang.String symbol,
                                   java.util.Date startDate,
                                   java.util.Date endDate,
                                   int period)
                            throws java.io.IOException,
                                   javax.swing.text.BadLocationException,
                                   java.text.ParseException
Throws:
java.io.IOException
javax.swing.text.BadLocationException
java.text.ParseException

getAccumulation

public static double[] getAccumulation(java.lang.String symbol,
                                       java.util.Date startDate,
                                       java.util.Date endDate)
                                throws java.io.IOException,
                                       javax.swing.text.BadLocationException,
                                       java.text.ParseException
This routine computes the accumulation by taking the priceDelta * Volume and adding it until the end-date

priceDelta = closePrice - openPrice
an accumulation > 0 indicates the stock is under accumulation.

Parameters:
symbol -
startDate -
endDate -
Returns:
Throws:
java.io.IOException
javax.swing.text.BadLocationException
java.text.ParseException

getDeltaP

public static double[] getDeltaP(java.lang.String symbol,
                                 java.util.Date startDate,
                                 java.util.Date endDate)
                          throws java.io.IOException,
                                 javax.swing.text.BadLocationException,
                                 java.text.ParseException
Throws:
java.io.IOException
javax.swing.text.BadLocationException
java.text.ParseException

graphAccumulation

public static void graphAccumulation()
                              throws java.text.ParseException,
                                     java.io.IOException,
                                     javax.swing.text.BadLocationException
Throws:
java.text.ParseException
java.io.IOException
javax.swing.text.BadLocationException

graphAccumulation

public static void graphAccumulation(java.lang.String symbol,
                                     java.util.Date startDate,
                                     java.util.Date endDate)
                              throws java.io.IOException,
                                     javax.swing.text.BadLocationException,
                                     java.text.ParseException
Throws:
java.io.IOException
javax.swing.text.BadLocationException
java.text.ParseException

graphDeltaP

public static void graphDeltaP(java.lang.String symbol,
                               java.util.Date startDate,
                               java.util.Date endDate)
                        throws java.io.IOException,
                               javax.swing.text.BadLocationException,
                               java.text.ParseException
Throws:
java.io.IOException
javax.swing.text.BadLocationException
java.text.ParseException

printCV

public static void printCV(java.lang.String symbol,
                           int daysPrior,
                           java.util.Date endDate)
                    throws java.text.ParseException,
                           java.io.IOException
Compute the coeffient of variation daysPrior to the endDate for the stock.

Parameters:
symbol -
daysPrior -
endDate -
Throws:
java.text.ParseException
java.io.IOException

getNPreviousTradingDates

public static java.util.Date[] getNPreviousTradingDates(java.util.Date endDate,
                                                        int n)
                                                 throws java.text.ParseException,
                                                        java.io.IOException
Look back 2*n calendar days and extract the n trading days previous to the endDate. We use days that have valid spyders trading.

Parameters:
endDate - start of the look back.
n - exact number of valid trading days (not holidays).
Returns:
date array with valid trading days.
Throws:
java.text.ParseException
java.io.IOException

getNextTradingDate

public static java.util.Date getNextTradingDate(java.util.Date startDate)
                                         throws java.text.ParseException,
                                                java.io.IOException
This will return the next trading day, provided that it has already occured. It will not work into the future! Nor will it work within 1 week of the future. Lots of limits here!

Parameters:
startDate -
Returns:
next trading date
Throws:
java.text.ParseException
java.io.IOException

main

public static void main(java.lang.String[] args)
                 throws java.text.ParseException,
                        java.io.IOException,
                        javax.swing.text.BadLocationException
Throws:
java.text.ParseException
java.io.IOException
javax.swing.text.BadLocationException