|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mov.quote.MixedQuoteBundle
public class MixedQuoteBundle
When a task requires a mix of end-of-day and intra-day stock quotes, it should create an instance of this class which represents all the task's required quotes. This quote bundle is useful for displaying the latest value of stock quotes. If intra-day quotes are not available, then user of this package will transparently see just the end-of-day quotes. Even when intra-day quotes are available, the end-of-day quotes can be used for calculating quote change.
Example:
MixedQuoteBundle quoteBundle = new MixedQuoteBundle(symbols, firstDate, lastDate); try { double = quoteBundle.getQuote("CBA", Quote.DAY_OPEN, 0); } catch(QuoteNotLoadedException e) { //... }
EODQuote
,
IDQuote
,
Quote
,
Symbol
Constructor Summary | |
---|---|
MixedQuoteBundle(java.util.List symbols,
TradingDate firstDate,
TradingDate lastDate)
Create a new mixed quote bundle that contains the end of day quotes from between the two dates given and the current day's intra-day quotes. |
Method Summary | |
---|---|
int |
getFirstOffset()
Return the fast access offset for the earliest quote in the bundle. |
int |
getLastOffset()
Return the fast access offset for the latest quote in the bundle. |
int |
getOffset(Quote quote)
Retrieve the fast access offset from the given quote. |
Quote |
getQuote(Symbol symbol,
int offset)
Get a stock quote. |
double |
getQuote(Symbol symbol,
int quoteType,
int dateOffset)
Get a stock quote. |
double |
getQuote(Symbol symbol,
int quoteType,
int today,
int dateOffset)
Get a stock quote. |
TradingDate |
offsetToDate(int dateOffset)
Convert between a fast access offset to an actual date. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MixedQuoteBundle(java.util.List symbols, TradingDate firstDate, TradingDate lastDate)
symbols
- the symbols to loadfirstDate
- the first end of day quotes to loadlastDate
- the last end of day quotes to loadMethod Detail |
---|
public double getQuote(Symbol symbol, int quoteType, int today, int dateOffset) throws EvaluationException, MissingQuoteException
QuoteBundle
getQuote
in interface QuoteBundle
symbol
- the stock symbolquoteType
- the quote type, e.g. Quote.DAY_OPEN
, Quote.DAY_CLOSE
,
Quote.DAY_LOW
, Quote.DAY_HIGH
, Quote.DAY_VOLUME
today
- fast access offset of current quote, for end-of-day quotes this
is the fast access date offset (see EODQuoteCache
). For
intra-day quotes, it is the fast access time offset (see
IDQuoteCache
).dateOffset
- modifier offset to fast access offset
EvaluationException
- if the script isn't allow access to the quote.
MissingQuoteException
- if the quote was not foundpublic double getQuote(Symbol symbol, int quoteType, int dateOffset) throws MissingQuoteException
QuoteBundle
getQuote
in interface QuoteBundle
symbol
- the stock symbolquoteType
- the quote type, one of Quote.DAY_OPEN
, Quote.DAY_CLOSE
,
Quote.DAY_LOW
, Quote.DAY_HIGH
, Quote.DAY_VOLUME
dateOffset
- fast access offset of current quote, for end-of-day quotes this
is the fast access date offset (see EODQuoteCache
). For
intra-day quotes, it is the fast access time offset (see
IDQuoteCache
).
MissingQuoteException
- if the quote was not foundpublic Quote getQuote(Symbol symbol, int offset) throws MissingQuoteException
QuoteBundle
getQuote
in interface QuoteBundle
symbol
- the stock symboloffset
- fast access offset of current quote, for end-of-day quotes this
is the fast access date offset (see EODQuoteCache
). For
intra-day quotes, it is the fast access time offset (see
IDQuoteCache
).
MissingQuoteException
- if the quote was not foundpublic TradingDate offsetToDate(int dateOffset)
QuoteBundle
offsetToDate
in interface QuoteBundle
dateOffset
- fast access offset, see EODQuoteCache
public int getFirstOffset()
getFirstOffset
in interface QuoteBundle
public int getLastOffset()
getLastOffset
in interface QuoteBundle
public int getOffset(Quote quote) throws WeekendDateException
getOffset
in interface QuoteBundle
quote
- quote
WeekendDateException
- if the date falls on a weekend.
|
Venice 0.7beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |