com.fisincorporated.stockinfoserver
Class Stock

java.lang.Object
  extended bycom.fisincorporated.stockinfoserver.Stock
All Implemented Interfaces:
java.io.Serializable

public class Stock
extends java.lang.Object
implements java.io.Serializable

Holds stock price/volume data plus various technical and fundamental data using RatingCriteria (currently from TC2000) or from Yahoo

Author:
Eric Foertsch - FIS Incorporated
See Also:
Serialized Form

Constructor Summary
Stock()
           
Stock(java.lang.String symbol)
          Assign symbol to this Stock
 
Method Summary
 void addPrice(java.lang.String date, float open, float high, float low, float close, long daysVolume)
          Add a days stock price/volume The days should be added in oldest to most recent order
 void addPrice(java.lang.String date, java.lang.String open, java.lang.String high, java.lang.String low, java.lang.String close, java.lang.String daysVolume)
          Add a days stock price/volume The days should be added in oldest to most recent order
 void addPropertyChangeListener(java.beans.PropertyChangeListener p)
          Added is case Stock object used in JESS
 void addRatingCriteria(java.lang.String ratingName, boolean isChoice, java.lang.String ranking, java.lang.String lowestPossibleValue, java.lang.String highestPossibleValue)
          Add fundamental or technical criteria (RatingCriteria) for this Stock The values currently come from TC2000
 void addStockAnalysis(java.lang.String analysisName, Stock stock)
          Use to keep additional, perhaps summarized stock info, eg. moving average, weekly high low close etc.
 java.lang.String dumpStockDataToString()
          Used for debug purposes
 float getClosePrice(int i)
           
 float[] getClosePrices()
           
 java.lang.String getCompanyName()
           
 java.lang.String getDate(int i)
           
 java.lang.String[] getDates()
           
 java.lang.String getExchange()
          Get the exchange this stock trades on
 float getHighPrice(int i)
          Returns the high price for row i for this Stock
 float[] getHighPrices()
          Returns the array of high prices for this Stock
 float getLowPrice(int i)
           
 float[] getLowPrices()
           
 int getNumberOfDays()
           
 float getOpenPrice(int i)
           
 float[] getOpenPrices()
           
 long getRanking(java.lang.String criteria)
          Return stock ranking for this criteria (from TC200).
 RatingCriteria getRatingCriteria(java.lang.String criteria)
          Return a RatingCriteria based on the criteria name
 Stock getStockAnalysis(java.lang.String analysisName, int period)
          Get additional, perhaps summarized stock info eg. moving average, weekly high low close etc
 java.lang.String getStockErrorMsg()
           
 java.lang.String getSymbol()
           
 long getVolume(int i)
           
 long[] getVolumes()
           
 boolean isValidData()
          Return true if all stock data loaded OK.
 boolean meetsCriteria(java.lang.String criteria)
          Returns true if Stock contains requested criteria (must be
 void removePropertyChangeListenter(java.beans.PropertyChangeListener p)
          Added is case Stock object used in JESS
 void setClosePrice(int i, float closePrice)
           
 void setClosePrices(float[] closePrices)
           
 void setCompanyName(java.lang.String companyName)
          Sets the company name for this stock
 void setDate(int i, java.lang.String date)
           
 void setDates(java.lang.String[] dates)
           
 void setExchange(java.lang.String exchange)
          Set the exchange - NYSE, NASDAQ, etc for this stock
 void setHighPrice(int i, float highPrice)
           
 void setHighPrices(float[] highPrices)
           
 void setLowPrice(int i, float lowPrice)
           
 void setLowPrices(float[] lowPrices)
           
 void setNumberOfDays(int numberOfDays)
          Indicate the number of days of price/volume that this stock must hold Used to allocate arrays holding price/volume prior to adding via other methods
 void setNumberOfDays(java.lang.String strNumberOfDays)
          Indicate the number of days of price/volume that this stock must hold Used to allocate arrays holding price/volume prior to adding via other methods
 void setOpenPrice(int i, float openPrice)
           
 void setOpenPrices(float[] openPrices)
           
 void setStockErrorMsg(java.lang.String errorMsg)
           
 void setSymbol(java.lang.String symbol)
          Sets the symbol for this Stock
 void setValidData(boolean validData)
          Indicate if the Stock contains valid data
 void setVolume(int i, long volume)
           
 void setVolumes(long[] volumes)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Stock

public Stock()

Stock

public Stock(java.lang.String symbol)
Assign symbol to this Stock

Parameters:
symbol -
Method Detail

getSymbol

public java.lang.String getSymbol()
Returns:
symbol

setSymbol

public void setSymbol(java.lang.String symbol)
Sets the symbol for this Stock

Parameters:
symbol -

setCompanyName

public void setCompanyName(java.lang.String companyName)
Sets the company name for this stock

Parameters:
companyName -

getCompanyName

public java.lang.String getCompanyName()
Returns:
companyName

getNumberOfDays

public int getNumberOfDays()
Returns:
Number of days of price/volume for this Stock

setNumberOfDays

public void setNumberOfDays(java.lang.String strNumberOfDays)
Indicate the number of days of price/volume that this stock must hold Used to allocate arrays holding price/volume prior to adding via other methods

Parameters:
strNumberOfDays -

setNumberOfDays

public void setNumberOfDays(int numberOfDays)
Indicate the number of days of price/volume that this stock must hold Used to allocate arrays holding price/volume prior to adding via other methods

Parameters:
numberOfDays -

addPrice

public void addPrice(java.lang.String date,
                     java.lang.String open,
                     java.lang.String high,
                     java.lang.String low,
                     java.lang.String close,
                     java.lang.String daysVolume)
Add a days stock price/volume The days should be added in oldest to most recent order

Parameters:
date - - in 'YYYY/MM/DD' format
open -
high -
low -
close -
daysVolume -

addPrice

public void addPrice(java.lang.String date,
                     float open,
                     float high,
                     float low,
                     float close,
                     long daysVolume)
Add a days stock price/volume The days should be added in oldest to most recent order

Parameters:
date - - in 'YYYY/MM/DD' format
open -
high -
low -
close -
daysVolume -

addRatingCriteria

public void addRatingCriteria(java.lang.String ratingName,
                              boolean isChoice,
                              java.lang.String ranking,
                              java.lang.String lowestPossibleValue,
                              java.lang.String highestPossibleValue)
Add fundamental or technical criteria (RatingCriteria) for this Stock The values currently come from TC2000

Parameters:
ratingName -
isChoice -
ranking -
lowestPossibleValue -
highestPossibleValue -

getRatingCriteria

public RatingCriteria getRatingCriteria(java.lang.String criteria)
Return a RatingCriteria based on the criteria name

Parameters:
criteria - - Name of rating criteria
Returns:
- RatingCriteria

meetsCriteria

public boolean meetsCriteria(java.lang.String criteria)
Returns true if Stock contains requested criteria (must be

Parameters:
criteria - Name of criteria (In TC2000 this is a 'choice' criteria
Returns:
boolean true if the stock meets the requested criteria, else false

getRanking

public long getRanking(java.lang.String criteria)
Return stock ranking for this criteria (from TC200). The ranking is from 0 to 99.

Parameters:
criteria - Name of criteria (eg. 1st qtr EPS)
Returns:
- ranking among all other stocks

setExchange

public void setExchange(java.lang.String exchange)
Set the exchange - NYSE, NASDAQ, etc for this stock

Parameters:
exchange - the exchange this stock trades on

getExchange

public java.lang.String getExchange()
Get the exchange this stock trades on

Returns:
- the exchange this stock trades on

isValidData

public boolean isValidData()
Return true if all stock data loaded OK. If false then you should not depend on the data for this stock

Returns:
true/false

dumpStockDataToString

public java.lang.String dumpStockDataToString()
Used for debug purposes

Returns:
- string of all data for this stock

getDates

public java.lang.String[] getDates()
Returns:
String of dates in ISO YYYY/MM/DD format

setDates

public void setDates(java.lang.String[] dates)
Parameters:
dates - The dates to set.

getDate

public java.lang.String getDate(int i)

setDate

public void setDate(int i,
                    java.lang.String date)
Parameters:
date - The date to set.

getOpenPrices

public float[] getOpenPrices()
Returns:
Returns the openPrices.

setOpenPrices

public void setOpenPrices(float[] openPrices)
Parameters:
openPrices - The openPrices to set.

getOpenPrice

public float getOpenPrice(int i)
Returns:
Returns the openPrice.

setOpenPrice

public void setOpenPrice(int i,
                         float openPrice)
                  throws java.lang.ArrayIndexOutOfBoundsException
Parameters:
openPrice - The openPrice to set.
Throws:
java.lang.ArrayIndexOutOfBoundsException

getHighPrices

public float[] getHighPrices()
Returns the array of high prices for this Stock

Returns:
Returns the highPrices.

setHighPrices

public void setHighPrices(float[] highPrices)
Parameters:
highPrices - The highPrices to set.

getHighPrice

public float getHighPrice(int i)
Returns the high price for row i for this Stock

Returns:
Returns the highPrice.

setHighPrice

public void setHighPrice(int i,
                         float highPrice)
                  throws java.lang.ArrayIndexOutOfBoundsException
Parameters:
i - int The row number for the highPrice to set.
highPrice - The highPrice to set.
Throws:
java.lang.ArrayIndexOutOfBoundsException

getLowPrices

public float[] getLowPrices()
Returns:
Returns the lowPrices.

setLowPrices

public void setLowPrices(float[] lowPrices)
Parameters:
lowPrices - The lowPrices to set.

getLowPrice

public float getLowPrice(int i)
Returns:
Returns the lowPrice.

setLowPrice

public void setLowPrice(int i,
                        float lowPrice)
                 throws java.lang.ArrayIndexOutOfBoundsException
Parameters:
lowPrice - The lowPrice to set.
Throws:
java.lang.ArrayIndexOutOfBoundsException

getClosePrices

public float[] getClosePrices()
Returns:
Returns the closePrices.

setClosePrices

public void setClosePrices(float[] closePrices)
Parameters:
closePrices - float[] - The closePrices to set.

getClosePrice

public float getClosePrice(int i)
Returns:
Returns the closePrice.

setClosePrice

public void setClosePrice(int i,
                          float closePrice)
                   throws java.lang.ArrayIndexOutOfBoundsException
Parameters:
closePrice - The closePrice to set.
Throws:
java.lang.ArrayIndexOutOfBoundsException

getVolumes

public long[] getVolumes()

setVolume

public void setVolume(int i,
                      long volume)
               throws java.lang.ArrayIndexOutOfBoundsException
Parameters:
i - - int The row number forwhich volume to set.
volume - - long The volumes to set.
Throws:
java.lang.ArrayIndexOutOfBoundsException

getVolume

public long getVolume(int i)

setVolumes

public void setVolumes(long[] volumes)
Parameters:
volumes - The volumes to set.

getStockErrorMsg

public java.lang.String getStockErrorMsg()
Returns:
Returns the stockErrorMsg.

setStockErrorMsg

public void setStockErrorMsg(java.lang.String errorMsg)

setValidData

public void setValidData(boolean validData)
Indicate if the Stock contains valid data

Parameters:
validData - true if valid data, false otherwise

addStockAnalysis

public void addStockAnalysis(java.lang.String analysisName,
                             Stock stock)
Use to keep additional, perhaps summarized stock info, eg. moving average, weekly high low close etc. Perhaps from StockAverager

Parameters:
analysisName - - Arbitrary name for the type of analysis done on this stock
stock - - contains the summarized (avg, weekly high/low close, etc) price/volume

getStockAnalysis

public Stock getStockAnalysis(java.lang.String analysisName,
                              int period)
Get additional, perhaps summarized stock info eg. moving average, weekly high low close etc

Parameters:
analysisName - Type of analysis done and stored with this stock
period - To make type of analysis unique
Returns:
Stock object containing the analysis

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener p)
Added is case Stock object used in JESS

Parameters:
p - propertyChangeListener

removePropertyChangeListenter

public void removePropertyChangeListenter(java.beans.PropertyChangeListener p)
Added is case Stock object used in JESS

Parameters:
p - propertyChangeListener