Venice 0.7beta

org.mov.quote
Class EODQuote

java.lang.Object
  extended by org.mov.quote.EODQuote
All Implemented Interfaces:
Quote

public class EODQuote
extends java.lang.Object
implements Quote

Representation of an end-of-day stock quote for a given stock on a given date.

Author:
Andrew Leppard

Field Summary
 
Fields inherited from interface org.mov.quote.Quote
ASK, BID, DAY_CLOSE, DAY_HIGH, DAY_LOW, DAY_OPEN, DAY_VOLUME
 
Constructor Summary
EODQuote(Symbol symbol, TradingDate date, int day_volume, double day_low, double day_high, double day_open, double day_close)
          Create a new end-of-day stock quote for the given date.
 
Method Summary
 boolean equals(EODQuote quote)
          Compare the two stock quotes for equality.
 boolean equals(java.lang.Object quote)
          Compare the two stock quotes for equality.
 TradingDate getDate()
          Return the quote date.
 double getDayClose()
          Return the day close.
 double getDayHigh()
          Return the day high.
 double getDayLow()
          Return the day low.
 double getDayOpen()
          Return the day open.
 int getDayVolume()
          Return the volume.
 double getQuote(int quote)
          Get a single quote.
 Symbol getSymbol()
          Return the stock's symbol.
 void setDate(TradingDate date)
          Set the quote date.
 void setSymbol(Symbol symbol)
          Set the symbol for this quote.
 java.lang.String toString()
          Return a string representation of the stock quote.
 void verify()
          Clean up the quote.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EODQuote

public EODQuote(Symbol symbol,
                TradingDate date,
                int day_volume,
                double day_low,
                double day_high,
                double day_open,
                double day_close)
Create a new end-of-day stock quote for the given date.

Parameters:
symbol - the stock symbol
date - the date of this stock quote
day_volume - the number of shares traded on this date
day_low - the lowest quote on this date
day_high - the highest quote on this date
day_open - the opening quote on this date
day_close - the closing quote on this date
Method Detail

verify

public void verify()
            throws QuoteFormatException
Clean up the quote. This fixes any irregularities that might exist in the quote, such as the day low not being the lowest quote.

Throws:
QuoteFormatException - if there were any problems with the quote

getSymbol

public Symbol getSymbol()
Return the stock's symbol.

Specified by:
getSymbol in interface Quote
Returns:
the symbol

getDate

public TradingDate getDate()
Return the quote date.

Specified by:
getDate in interface Quote
Returns:
the date

getDayVolume

public int getDayVolume()
Return the volume.

Specified by:
getDayVolume in interface Quote
Returns:
the volume

getDayLow

public double getDayLow()
Return the day low.

Specified by:
getDayLow in interface Quote
Returns:
the day low

getDayHigh

public double getDayHigh()
Return the day high.

Specified by:
getDayHigh in interface Quote
Returns:
the day high

getDayOpen

public double getDayOpen()
Return the day open.

Specified by:
getDayOpen in interface Quote
Returns:
the day open

getDayClose

public double getDayClose()
Return the day close.

Specified by:
getDayClose in interface Quote
Returns:
the day close

setSymbol

public void setSymbol(Symbol symbol)
Set the symbol for this quote.

Parameters:
symbol - the stock symbol

setDate

public void setDate(TradingDate date)
Set the quote date.

Parameters:
date - the date

equals

public boolean equals(java.lang.Object quote)
Compare the two stock quotes for equality.

Overrides:
equals in class java.lang.Object
Parameters:
quote - the quote to compare against
Returns:
1 if they are equal; 0 otherwise

equals

public boolean equals(EODQuote quote)
Compare the two stock quotes for equality.

Parameters:
quote - the quote to compare against
Returns:
1 if they are equal; 0 otherwise

getQuote

public double getQuote(int quote)
                throws java.lang.UnsupportedOperationException
Description copied from interface: Quote
Get a single quote.

Specified by:
getQuote in interface Quote
Parameters:
quote - the quote type: Quote.DAY_OPEN, Quote.DAY_CLOSE, Quote.DAY_HIGH, Quote.DAY_LOW, Quote.DAY_VOLUME, Quote.BID, or Quote.ASK
Throws:
java.lang.UnsupportedOperationException - if the quote type is not supported by the quote. For example, end of day quotes do not contain bid or ask prices.

toString

public java.lang.String toString()
Return a string representation of the stock quote.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the stock quote.

Venice 0.7beta