|
Venice 0.7beta | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mov.chart.GraphableQuoteFunctionSource
public class GraphableQuoteFunctionSource
Allow the QuoteFunctions package to use quotes directly
from a Graphable. The following code, from
MovingAverageGraph shows an example of how to call
a quote function from a graph:
Graphable movingAverage = new Graphable();
TradingDate date = (TradingDate)source.getStartX();
GraphableQuoteFunctionSource quoteFunctionSource
= new GraphableQuoteFunctionSource(source, date, period);
for(Iterator iterator = source.iterator(); iterator.hasNext();) {
date = (TradingDate)iterator.next();
quoteFunctionSource.setStartDate(date);
try {
double average = QuoteFunctions.avg(quoteFunctionSource, period);
movingAverage.putY(date, new Double(average));
}
catch(EvaluationException e) {
}
}
QuoteFunctions| Constructor Summary | |
|---|---|
GraphableQuoteFunctionSource(Graphable graphable,
TradingDate date,
int period)
Create a new quote function source that uses quotes directly from a Graphable. |
|
| Method Summary | |
|---|---|
double |
getValue(int index)
Return the quote value on the given date. |
void |
setDate(TradingDate date)
Set the current date. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GraphableQuoteFunctionSource(Graphable graphable,
TradingDate date,
int period)
Graphable.
graphable - the graphable containing the quotesdate - the current date, the previous quotes for period number of days
will be accessedperiod - the number of quote dates available from this source| Method Detail |
|---|
public void setDate(TradingDate date)
date - the current date
public double getValue(int index)
throws EvaluationException
QuoteFunctionSource
getValue in interface QuoteFunctionSourceindex - the offset of the date in the quote source.
NaN if the quote is missing / not available
EvaluationException - if QuoteBundleFunctionSource is not
allowed access to a quote. See GPQuoteBundle.
|
Venice 0.7beta | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||