|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.fisincorporated.stockanalysis.StockAverager
Provides static methods for taking a Stock object or stock data and returning moving average, weekly max, mins, etc. A rather eclectic assortment created for use in learning Jess
| Constructor Summary | |
StockAverager()
|
|
| Method Summary | |
static float[] |
calcComparativeRelativeStrength(Stock crsStock,
Stock baseStock,
int start,
int numberPoints)
Calculate Comparitive Relative Strength http://www.marketscreen.com/help/AtoZ/default.asp? |
static float[] |
calcLinearRegression(float[] values,
int start,
int numberPoints)
Caculate linear regression of prices (basically used to get slope) Doing the basic Y = mx + b m - slope, b - intercept http://phoenix.phys.clemson.edu/tutorials/excel/regression.html |
static float[] |
calcLinearRegression(long[] values,
int start,
int numberPoints)
Caculate linear regression of prices (basically used to get slope) Doing the basic Y = mx + b m - slope, b - intercept http://phoenix.phys.clemson.edu/tutorials/excel/regression.html |
static Stock |
calcMovingAverage(Stock stock,
int average)
|
static float[] |
calcOnBalanceVolume(Stock stock,
int start,
int numberPoints)
Calculate a stocks On Balance Volume http://www.marketscreen.com/help/AtoZ/default.asp? |
static boolean[] |
findWeekEndDates(java.lang.String[] dates)
Determine the last date for each week that stock prices are available. |
static Stock |
getMonthlyHighLowPrices(Stock oldStock,
int numberPeriods)
Return the period open, highest high, lowest low, period close, and total period volume |
static float[] |
getPeriodValues(float[] oldValues,
boolean[] datesToUse,
int numberPeriods)
Return an array with values from the passed in array |
static float[] |
getPeriodValues(float[] oldValues,
int numberPeriods)
|
static long[] |
getPeriodValues(long[] oldValues,
boolean[] datesToUse,
int numberPeriods)
Return an array with values from the passed in array |
static long[] |
getPeriodValues(long[] oldValues,
int numberPeriods)
|
static Stock |
getPeriodValues(Stock oldStock,
char period,
int numberPeriods)
'Summarize' the stock by taking last n periods If the stock passed in has fewer than numberPeriods data points then first (stock.length - numberPeriods) will be zero If the stock passed in has more than numberPeriods data points then only the last 'numberPeriods' data points will be used For a weekly period take the last day in each week. |
static java.lang.String[] |
getPeriodValues(java.lang.String[] oldValues,
boolean[] datesToUse,
int numberPeriods)
|
static java.lang.String[] |
getPeriodValues(java.lang.String[] oldValues,
int numberPeriods)
|
static Stock |
getWeeklyHighLowPrices(Stock oldStock,
int numberPeriods)
Return the period open, highest high, lowest low, period close, and total period volume Note that dates/price/volume returned only, all other stock properties unassigned. |
static void |
main(java.lang.String[] args)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public StockAverager()
| Method Detail |
public static void main(java.lang.String[] args)
public static Stock getPeriodValues(Stock oldStock,
char period,
int numberPeriods)
throws java.lang.Exception
oldStock - Stockperiod - 'd' - daily period, 'w' - weekly periodnumberPeriods - Number of periods (daily or weekly) to return
java.lang.Exception
public static float[] getPeriodValues(float[] oldValues,
boolean[] datesToUse,
int numberPeriods)
oldValues - old arraydatesToUse - if true take corresponding oldValuenumberPeriods - size of new array
public static float[] getPeriodValues(float[] oldValues,
int numberPeriods)
oldValues - array of floatnumberPeriods - int number of periods (values) to take starting from
oldValues.length - 1 to (oldValues.length - numberPeriods)
public static long[] getPeriodValues(long[] oldValues,
boolean[] datesToUse,
int numberPeriods)
oldValues - old arraydatesToUse - if true take corresponding oldValuenumberPeriods - size of new array
public static long[] getPeriodValues(long[] oldValues,
int numberPeriods)
oldValues - array of longnumberPeriods - int number of periods (values) to take starting from
oldValues.length - 1 to (oldValues.length - numberPeriods)
public static java.lang.String[] getPeriodValues(java.lang.String[] oldValues,
boolean[] datesToUse,
int numberPeriods)
public static java.lang.String[] getPeriodValues(java.lang.String[] oldValues,
int numberPeriods)
public static boolean[] findWeekEndDates(java.lang.String[] dates)
dates - Dates in ISO format 'YYYY/MM/DD'
public static Stock getWeeklyHighLowPrices(Stock oldStock,
int numberPeriods)
oldStock - numberPeriods - to return
public static Stock getMonthlyHighLowPrices(Stock oldStock,
int numberPeriods)
oldStock - numberPeriods - to return
public static Stock calcMovingAverage(Stock stock,
int average)
public static float[] calcLinearRegression(float[] values,
int start,
int numberPoints)
values - (prices)start - int Starting point in array of valuesnumberPoints - int Number points to use in regression
public static float[] calcLinearRegression(long[] values,
int start,
int numberPoints)
values - (volume)start - int Starting point in array of valuesnumberPoints - int Number points to use in regression
public static float[] calcOnBalanceVolume(Stock stock,
int start,
int numberPoints)
stock - Stock objectstart - int Starting point (index) into Stock prices volumesnumberPoints - int Number points to use in OBV calc
public static float[] calcComparativeRelativeStrength(Stock crsStock,
Stock baseStock,
int start,
int numberPoints)
crsStock - - Stock for which to calculate relative strengthbaseStock - - Stock/index to use as 'base' for CRS calculationstart - - starting point (index) to start calculationnumberPoints - - number of points over which to do calculation
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||