org.mov.quote
Class QuoteBundleFunctionSource
java.lang.Object
org.mov.quote.QuoteBundleFunctionSource
- All Implemented Interfaces:
- QuoteFunctionSource
public class QuoteBundleFunctionSource
- extends java.lang.Object
- implements QuoteFunctionSource
Allow the QuoteFunctions
package to use quotes directly from
a QuoteBundle
. The following code shows an exmaple of how to
call a quote function from a Gondola expression:
QuoteBundleFunctionSource source =
new QuoteBundleFunctionSource(quoteBundle, symbol, Quote.DAY_CLOSE, day, offset,
period);
return QuoteFunctions.rsi(source, period);
- Author:
- Andrew Leppard
- See Also:
QuoteFunctions
,
Expression
Method Summary |
double |
getValue(int index)
Return the quote value on the given date. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
QuoteBundleFunctionSource
public QuoteBundleFunctionSource(QuoteBundle quoteBundle,
Symbol symbol,
int quoteKind,
int day,
int offset,
int period)
- Create a new quote function source that uses quotes directly from a
QuoteBundle
.
- Parameters:
quoteBundle
- the quote bundle containing the quotessymbol
- the symbol of the quotes to accessquoteKind
- the quote kind, one of Quote.DAY_OPEN
, Quote.DAY_CLOSE
,
Quote.DAY_LOW
, Quote.DAY_HIGH
, Quote.DAY_VOLUME
day
- the day and offset arguments construct the offset of the current date in
the quote bundle we are examining. This will be the last date accessed
by the quote function.offset
- see aboveperiod
- the number of quote dates available from this source
getValue
public double getValue(int index)
throws EvaluationException
- Description copied from interface:
QuoteFunctionSource
- Return the quote value on the given date. The quote function source
contains a set of quotes which can be accessed from offset 0, which
is the earliest date, to the number of quotes in the source minus one.
Typically a quote source is set up to contain a fixed number of quotes,
each of which is used by a quote function.
- Specified by:
getValue
in interface QuoteFunctionSource
- Parameters:
index
- the offset of the date in the quote source.
- Returns:
- the quote value or
NaN
if the quote is missing / not available
- Throws:
EvaluationException
- if QuoteBundleFunctionSource
is not
allowed access to a quote. See GPQuoteBundle
.