com.purpletech.math
Class DoubleSeries
java.lang.Object
|
+--com.purpletech.math.DoubleSeries
- public class DoubleSeries
- extends java.lang.Object
Maintains a running average and other calculations.
|
Method Summary |
void |
add(double val)
Note: not synchronized! Use only within a single thread,
or inside a single thread-safe object. |
double |
getAverage()
|
double |
getMax()
|
double |
getMin()
|
double |
getSum()
|
double |
getVolatility()
volatility = (sum((x[i] - a)^2))/(n-1)
where x[i] = closing price at tick i
a = average (mean) of all x's
n = total number of ticks
sum = sum for all n ticks
|
static void |
main(java.lang.String[] args)
|
int |
size()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DoubleSeries
public DoubleSeries(int len)
add
public void add(double val)
Note: not synchronized! Use only within a single thread,
or inside a single thread-safe object.
getSum
public double getSum()
size
public int size()
getAverage
public double getAverage()
getMin
public double getMin()
getMax
public double getMax()
getVolatility
public double getVolatility()
volatility = (sum((x[i] - a)^2))/(n-1)
where x[i] = closing price at tick i
a = average (mean) of all x's
n = total number of ticks
sum = sum for all n ticks
- Returns:
- the volatility. undefined for a series of 0 or 1 size
main
public static void main(java.lang.String[] args)