com.mytrendtimer.trendtimer
Class Model

java.lang.Object
  extended by com.mytrendtimer.trendtimer.Model

public class Model
extends java.lang.Object

This is a implementation of the financial model.

Version:
v0.95.1
Author:
FRM

Field Summary
static int MEDIUM_TERM_STAT_NBR_QUOTES
          Number of quotes to take into account the do the medium term statistic
static java.lang.String OUT_STRENGTH_LOG_FILE_PATH
          The path (relative to baseDir !)
static int SHORT_TERM_STAT_NBR_QUOTES
          Number of quotes to take into account the do the short term statistic
 
Constructor Summary
Model(MyTrendTimer myTTArg, OutFileWritter xmlResultFileObjArg, boolean csvOutputGenerationArg, OutFileWritter CSVFileObjArg, java.util.ArrayList<Line> lineArrayArg, int osc1DaysArg, int osc2DaysArg, int maxDayGapWarnNameArg, int maxDailyPercQuoteChangeWarnNameArg, java.text.DecimalFormat dfVarNbrDigitsNoAposArg, java.text.DecimalFormat dfVarNbrDigitsArg, QuoteSourceFile quoteSourceFileObjArg, SAX2Handler xmlHandlerObjArg, int startChartYearArg)
          This is the constructor for the Model object.
 
Method Summary
 void accumulateResults(long elapsedTimeMillisArg)
          Accumulate result summary in a buffer
 void accumulateStrength()
          Accumulate signal strength in a buffer and dump it into a file
 void calcAllStats()
          Calc and Write all the stats statShortTerm, statMediumTerm, statCurrentYear, statPreviousYear
 void calcAndWriteStatCurrentYear(OutFileWritter xmlResultFileObjArg, java.lang.String xmlElementArg, int daysInPreviousYearToStatArg, int daysInCurrentYearToStatArg, java.util.ArrayList<Line> lineObjArg, java.text.DecimalFormat dfVarNbrDigitsArg, java.text.DecimalFormat d0Arg)
          Calc some stats on the last quotes (currentYear).
 void calcAndWriteStatMediumTerm(OutFileWritter xmlResultFileObjArg, java.lang.String xmlElementArg, java.util.ArrayList<Line> lineObjArg, java.text.DecimalFormat dfVarNbrDigitsArg)
          Calc some stats on the last quotes (medium term).
 void calcAndWriteStatPrevYear(OutFileWritter xmlResultFileObjArg, java.lang.String xmlElementArg, int daysInPreviousYearToStatArg, int daysInCurrentYearToStatArg, java.util.ArrayList<Line> lineObjArg, java.text.DecimalFormat dfVarNbrDigitsArg, java.text.DecimalFormat d0Arg)
          Calc some stats on the last quotes (previousYear).
 void calcAndWriteStatShortTerm(OutFileWritter xmlResultFileObjArg, java.lang.String xmlElementArg, java.util.ArrayList<Line> lineObjArg, java.text.DecimalFormat dfVarNbrDigitsArg)
          Calc some stats on the last quotes (short term).
 void calcResult()
          Summarize the produced operations (return calculation, overperformance etc..)
 void checkCurrentSituation()
          Check the current situation (values of the last calculation)
 void closeTradeXmlElement()
          Just write the close of the in xml file
 void createLastFakeOp()
          Produce a fake operation (based on current quote) to have the result of the last signal
 void loopInLines()
          Loop in the previously instanciated line objects
 void loopMonthlyPerfObj()
          Loop in PeriodicPerf objects (monthlyPerfObj) and write them in xml file.
 void loopMonthlyPerfObjSeasonal()
          Loop in PeriodicPerf objects (monthlyPerfObj), calculate a monthly consolidated perf (seasonal) and write them in xml file.
 void loopYearlyPerfObj()
          Loop in PeriodicPerf objects (yearlyPerfObj) and write them in xml file.
 void openTradeXmlElement()
          Just write the open of the in xml file
 void writeAllToFile(long elapsedTimeMillisArg)
          Call the methods to write full result set in xml file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MEDIUM_TERM_STAT_NBR_QUOTES

public static final int MEDIUM_TERM_STAT_NBR_QUOTES
Number of quotes to take into account the do the medium term statistic

See Also:
Constant Field Values

OUT_STRENGTH_LOG_FILE_PATH

public static final java.lang.String OUT_STRENGTH_LOG_FILE_PATH
The path (relative to baseDir !) where the signal strength log is going to be created

See Also:
Constant Field Values

SHORT_TERM_STAT_NBR_QUOTES

public static final int SHORT_TERM_STAT_NBR_QUOTES
Number of quotes to take into account the do the short term statistic

See Also:
Constant Field Values
Constructor Detail

Model

public Model(MyTrendTimer myTTArg,
             OutFileWritter xmlResultFileObjArg,
             boolean csvOutputGenerationArg,
             OutFileWritter CSVFileObjArg,
             java.util.ArrayList<Line> lineArrayArg,
             int osc1DaysArg,
             int osc2DaysArg,
             int maxDayGapWarnNameArg,
             int maxDailyPercQuoteChangeWarnNameArg,
             java.text.DecimalFormat dfVarNbrDigitsNoAposArg,
             java.text.DecimalFormat dfVarNbrDigitsArg,
             QuoteSourceFile quoteSourceFileObjArg,
             SAX2Handler xmlHandlerObjArg,
             int startChartYearArg)
      throws java.lang.Exception
This is the constructor for the Model object.

Parameters:
myTTArg - object to keep the warnings.
xmlResultFileObjArg - The result file (already initialized at this stage)
csvOutputGenerationArg - Already setted by a checker
CSVFileObjArg - The csv file (already initialized at this stage)
lineArrayArg - The line objects to run the model on
osc1DaysArg - Already setted by a checker
osc2DaysArg - Already setted by a checker
maxDayGapWarnNameArg - Found in the xml file
maxDailyPercQuoteChangeWarnNameArg - Found in the xml file
dfVarNbrDigitsNoAposArg - Already setted by a method createOutputFormatter
dfVarNbrDigitsArg - Already setted by a method createOutputFormatter
quoteSourceFileObjArg - Already setted
xmlHandlerObjArg - Already setted
startChartYearArg - Already setted by the checker call in the MTT main class
Throws:
java.lang.Exception
Method Detail

accumulateResults

public void accumulateResults(long elapsedTimeMillisArg)
                       throws java.lang.Exception
Accumulate result summary in a buffer

Throws:
java.lang.Exception

accumulateStrength

public void accumulateStrength()
                        throws java.lang.Exception
Accumulate signal strength in a buffer and dump it into a file

Throws:
java.lang.Exception

calcAllStats

public void calcAllStats()
                  throws java.lang.Exception
Calc and Write all the stats statShortTerm, statMediumTerm, statCurrentYear, statPreviousYear

Throws:
java.lang.Exception

calcAndWriteStatCurrentYear

public void calcAndWriteStatCurrentYear(OutFileWritter xmlResultFileObjArg,
                                        java.lang.String xmlElementArg,
                                        int daysInPreviousYearToStatArg,
                                        int daysInCurrentYearToStatArg,
                                        java.util.ArrayList<Line> lineObjArg,
                                        java.text.DecimalFormat dfVarNbrDigitsArg,
                                        java.text.DecimalFormat d0Arg)
                                 throws java.lang.Exception
Calc some stats on the last quotes (currentYear). (statGeneration)

Parameters:
xmlResultFileObjArg - the file where to write
xmlElementArg - the xmlElementArg
daysInPreviousYearToStatArg - the number of days of the previous year
daysInCurrentYearToStatArg - the number of days of the current year
lineObjArg - the lines objects to use for the stats
dfVarNbrDigitsArg - the variable decimal format
d0Arg - the no digit (d0) decimal format
Throws:
java.lang.Exception

calcAndWriteStatMediumTerm

public void calcAndWriteStatMediumTerm(OutFileWritter xmlResultFileObjArg,
                                       java.lang.String xmlElementArg,
                                       java.util.ArrayList<Line> lineObjArg,
                                       java.text.DecimalFormat dfVarNbrDigitsArg)
                                throws java.lang.Exception
Calc some stats on the last quotes (medium term). (statGeneration)

Parameters:
xmlResultFileObjArg - the file where to write
xmlElementArg - the xmlElementArg
lineObjArg - the lines objects to use for the stats
dfVarNbrDigitsArg - the variable decimal format
Throws:
java.lang.Exception

calcAndWriteStatPrevYear

public void calcAndWriteStatPrevYear(OutFileWritter xmlResultFileObjArg,
                                     java.lang.String xmlElementArg,
                                     int daysInPreviousYearToStatArg,
                                     int daysInCurrentYearToStatArg,
                                     java.util.ArrayList<Line> lineObjArg,
                                     java.text.DecimalFormat dfVarNbrDigitsArg,
                                     java.text.DecimalFormat d0Arg)
                              throws java.lang.Exception
Calc some stats on the last quotes (previousYear). (statGeneration)

Parameters:
xmlResultFileObjArg - the file where to write
xmlElementArg - the xmlElementArg
daysInPreviousYearToStatArg - the number of days of the previous year
daysInCurrentYearToStatArg - the number of days of the current year
lineObjArg - the lines objects to use for the stats
dfVarNbrDigitsArg - the variable decimal format
d0Arg - the no digit (d0) decimal format
Throws:
java.lang.Exception

calcAndWriteStatShortTerm

public void calcAndWriteStatShortTerm(OutFileWritter xmlResultFileObjArg,
                                      java.lang.String xmlElementArg,
                                      java.util.ArrayList<Line> lineObjArg,
                                      java.text.DecimalFormat dfVarNbrDigitsArg)
                               throws java.lang.Exception
Calc some stats on the last quotes (short term). (statGeneration)

Parameters:
xmlResultFileObjArg - the file where to write
xmlElementArg - the xmlElementArg
lineObjArg - the lines objects to use for the stats
dfVarNbrDigitsArg - the variable decimal format
Throws:
java.lang.Exception

calcResult

public void calcResult()
                throws java.lang.Exception
Summarize the produced operations (return calculation, overperformance etc..)

Throws:
java.lang.Exception

checkCurrentSituation

public void checkCurrentSituation()
                           throws java.lang.Exception
Check the current situation (values of the last calculation)

Throws:
java.lang.Exception

closeTradeXmlElement

public void closeTradeXmlElement()
Just write the close of the in xml file


createLastFakeOp

public void createLastFakeOp()
                      throws java.lang.Exception
Produce a fake operation (based on current quote) to have the result of the last signal

Throws:
java.lang.Exception

loopInLines

public void loopInLines()
                 throws java.lang.Exception
Loop in the previously instanciated line objects

Throws:
java.lang.Exception

loopMonthlyPerfObj

public void loopMonthlyPerfObj()
                        throws java.lang.Exception
Loop in PeriodicPerf objects (monthlyPerfObj) and write them in xml file. (periodicperfGeneration)

Throws:
java.lang.Exception

loopMonthlyPerfObjSeasonal

public void loopMonthlyPerfObjSeasonal()
                                throws java.lang.Exception
Loop in PeriodicPerf objects (monthlyPerfObj), calculate a monthly consolidated perf (seasonal) and write them in xml file.

Throws:
java.lang.Exception

loopYearlyPerfObj

public void loopYearlyPerfObj()
                       throws java.lang.Exception
Loop in PeriodicPerf objects (yearlyPerfObj) and write them in xml file.

Throws:
java.lang.Exception

openTradeXmlElement

public void openTradeXmlElement()
Just write the open of the in xml file


writeAllToFile

public void writeAllToFile(long elapsedTimeMillisArg)
                    throws java.lang.Exception
Call the methods to write full result set in xml file

Throws:
java.lang.Exception