Class SQProject

java.lang.Object
com.strategyquant.tradinglib.project.SQProject

public class SQProject extends Object
The type Sq project.
  • Field Details

    • MemoryProtectionError

      public static final String MemoryProtectionError
      The constant MemoryProtectionError.
      See Also:
      Constant Field Values
    • OutOfMemoryError

      public static final String OutOfMemoryError
      The constant OutOfMemoryError.
      See Also:
      Constant Field Values
    • RunFromFirstTask

      public static final int RunFromFirstTask
      The constant RunFromFirstTask.
      See Also:
      Constant Field Values
    • RunFromSpecificTask

      public static final int RunFromSpecificTask
      The constant RunFromSpecificTask.
      See Also:
      Constant Field Values
    • RunOnlySpecificTask

      public static final int RunOnlySpecificTask
      The constant RunOnlySpecificTask.
      See Also:
      Constant Field Values
    • userConfigFileName

      public static final String userConfigFileName
      The constant userConfigFileName.
      See Also:
      Constant Field Values
    • progressEngine

      public ProgressEngine progressEngine
      The Progress engine.
    • userConfirm

      public com.strategyquant.tradinglib.project.UserConfirm userConfirm
      The User confirm.
    • log

      public com.strategyquant.tradinglib.project.ProjectLog log
      The Log.
    • engineCharts

      public com.strategyquant.tradinglib.project.EngineCharts engineCharts
      The Engine charts.
    • bestResults

      public com.strategyquant.tradinglib.project.bestresults.BestResults bestResults
      The Best results.
    • rangerStart

      public com.strategyquant.tradinglib.project.RangerStart rangerStart
      The Ranger start.
    • rangerConfig

      public com.strategyquant.lib.ranger.RangerConfig rangerConfig
      The Ranger config.
    • publisher

      public com.strategyquant.tradinglib.project.websocket.ProjectDataPublisher publisher
      The Publisher.
    • correctionsMade

      public boolean correctionsMade
      The Corrections made.
  • Constructor Details

    • SQProject

      public SQProject(String projectName) throws Exception
      Instantiates a new Sq project.
      Parameters:
      projectName - the project name
      Throws:
      Exception - the exception
  • Method Details

    • init

      public static void init()
      Init.
    • projectIsOlderThan136

      public static boolean projectIsOlderThan136(org.jdom2.Element elProject)
      Project is older than 136 boolean.
      Parameters:
      elProject - the el project
      Returns:
      the boolean
    • initTasksFromConfig

      public void initTasksFromConfig() throws Exception
      Init tasks from config.
      Throws:
      Exception - the exception
    • getDefaultConfig

      public com.strategyquant.tradinglib.project.DefaultProjectConfig getDefaultConfig() throws Exception
      Returns Project and Task XML element
      Returns:
      default config
      Throws:
      Exception - the exception
    • generateTaskXMLFileName

      public String generateTaskXMLFileName(String taskType)
      Generate task xml file name string.
      Parameters:
      taskType - the task type
      Returns:
      the string
    • addTask

      public ISQTask addTask(String taskName, String taskType) throws Exception
      Add task isq task.
      Parameters:
      taskName - the task name
      taskType - the task type
      Returns:
      the isq task
      Throws:
      Exception - the exception
    • addTask

      public ISQTask addTask(String taskName, String taskType, int index) throws Exception
      Add task isq task.
      Parameters:
      taskName - the task name
      taskType - the task type
      index - the index
      Returns:
      the isq task
      Throws:
      Exception - the exception
    • removeTask

      public ISQTask removeTask(String taskName) throws Exception
      Remove task isq task.
      Parameters:
      taskName - the task name
      Returns:
      the isq task
      Throws:
      Exception - the exception
    • checkProjectStatus

      public void checkProjectStatus(String action) throws Exception
      Check project status.
      Parameters:
      action - the action
      Throws:
      Exception - the exception
    • moveTask

      public void moveTask(String taskName, int toIndex) throws Exception
      Move task.
      Parameters:
      taskName - the task name
      toIndex - the to index
      Throws:
      Exception - the exception
    • containsTask

      public boolean containsTask(String taskName)
      Contains task boolean.
      Parameters:
      taskName - the task name
      Returns:
      the boolean
    • getTaskConfigByName

      public org.jdom2.Element getTaskConfigByName(String taskName)
      Gets task config by name.
      Parameters:
      taskName - the task name
      Returns:
      the task config by name
    • getTaskSettingsByName

      public org.jdom2.Element getTaskSettingsByName(String taskName)
      Gets task settings by name.
      Parameters:
      taskName - the task name
      Returns:
      the task settings by name
    • getTaskSettingsByTitle

      public org.jdom2.Element getTaskSettingsByTitle(String taskTitle)
      Gets task settings by title.
      Parameters:
      taskTitle - the task title
      Returns:
      the task settings by title
    • getTaskSettingsByXMLFile

      public org.jdom2.Element getTaskSettingsByXMLFile(String taskXMLFile)
      Gets task settings by xml file.
      Parameters:
      taskXMLFile - the task xml file
      Returns:
      the task settings by xml file
    • getTaskElementIndex

      public int getTaskElementIndex(String taskName)
      Gets task element index.
      Parameters:
      taskName - the task name
      Returns:
      the task element index
    • getTasksCount

      public int getTasksCount()
      Gets tasks count.
      Returns:
      the tasks count
    • addDatabank

      public Databank addDatabank(String databankName, int position) throws Exception
      Add databank databank.
      Parameters:
      databankName - the databank name
      position - the position
      Returns:
      the databank
      Throws:
      Exception - the exception
    • removeDatabank

      public boolean removeDatabank(String databankName) throws Exception
      Remove databank boolean.
      Parameters:
      databankName - the databank name
      Returns:
      the boolean
      Throws:
      Exception - the exception
    • containsDatabank

      public boolean containsDatabank()
      Contains databank boolean.
      Returns:
      the boolean
    • getResultsDatabank

      public Databank getResultsDatabank()
      Gets results databank.
      Returns:
      the results databank
    • isRunning

      public boolean isRunning()
      Is running boolean.
      Returns:
      the boolean
    • getActiveTaskName

      public String getActiveTaskName()
      Gets active task name.
      Returns:
      the active task name
    • getLastRunningTask

      public ISQTask getLastRunningTask()
      Gets last running task.
      Returns:
      the last running task
    • saveConfig

      public void saveConfig() throws Exception
      Save config.
      Throws:
      Exception - the exception
    • getTaskByName

      public ISQTask getTaskByName(String taskName) throws Exception
      Gets task by name.
      Parameters:
      taskName - the task name
      Returns:
      the task by name
      Throws:
      Exception - the exception
    • containsTaskByName

      public boolean containsTaskByName(String taskName) throws Exception
      Contains task by name boolean.
      Parameters:
      taskName - the task name
      Returns:
      the boolean
      Throws:
      Exception - the exception
    • getTaskByHash

      public ISQTask getTaskByHash(int hash) throws Exception
      Gets task by hash.
      Parameters:
      hash - the hash
      Returns:
      the task by hash
      Throws:
      Exception - the exception
    • getTask

      public ISQTask getTask(int index) throws Exception
      Gets task.
      Parameters:
      index - the index
      Returns:
      the task
      Throws:
      Exception - the exception
    • getTasksHashes

      public it.unimi.dsi.fastutil.ints.IntList getTasksHashes() throws Exception
      Gets tasks hashes.
      Returns:
      the tasks hashes
      Throws:
      Exception - the exception
    • start

      public void start() throws Exception
      Start.
      Throws:
      Exception - the exception
    • stop

      public void stop()
      Stop.
    • pause

      public void pause()
      Pause.
    • resume

      public void resume()
      Resume.
    • checkPaused

      public void checkPaused()
      Check paused.
    • printToLog

      public void printToLog(String message)
      Print to log.
      Parameters:
      message - the message
    • getRunningStatus

      public int getRunningStatus()
      Gets running status.
      Returns:
      the running status
    • resetTracking

      public void resetTracking(boolean infiniteProgress, boolean resetProjectRunningTime)
      Reset tracking.
      Parameters:
      infiniteProgress - the infinite progress
      resetProjectRunningTime - the reset project running time
    • trackJob

      public void trackJob(com.strategyquant.gridlib.client.JobDetails jobDetails, int dismissalReason, com.strategyquant.tradinglib.backtestrunner.DurationStats durationStats, int backtestsInJob, long runningJobs, long waitingJobs)
      Track job.
      Parameters:
      jobDetails - the job details
      dismissalReason - the dismissal reason
      durationStats - the duration stats
      backtestsInJob - the backtests in job
      runningJobs - the running jobs
      waitingJobs - the waiting jobs
    • increaseGlobalStats

      public void increaseGlobalStats(int taskHash, String action1, long count1, String action2, long count2)
      Increase global stats.
      Parameters:
      taskHash - the task hash
      action1 - the action 1
      count1 - the count 1
      action2 - the action 2
      count2 - the count 2
    • setGlobalStats

      public void setGlobalStats(String display, int taskHash, String action, long count, int order, String percentageCompareAction)
      Sets global stats.
      Parameters:
      display - the display
      taskHash - the task hash
      action - the action
      count - the count
      order - the order
      percentageCompareAction - the percentage compare action
    • setGlobalStats

      public void setGlobalStats(String display, int taskHash, String action, long count, int order)
      Sets global stats.
      Parameters:
      display - the display
      taskHash - the task hash
      action - the action
      count - the count
      order - the order
    • increaseGlobalStats

      public void increaseGlobalStats(String display, int taskHash, String action, long count, int order)
      Increase global stats.
      Parameters:
      display - the display
      taskHash - the task hash
      action - the action
      count - the count
      order - the order
    • getFailedJobsPercentage

      public double getFailedJobsPercentage()
      Gets failed jobs percentage.
      Returns:
      the failed jobs percentage
    • loadTrackingInfo

      public void loadTrackingInfo(ProjectRunInfo projectRunInfo, boolean includingDismissalStats)
      Load tracking info.
      Parameters:
      projectRunInfo - the project run info
      includingDismissalStats - the including dismissal stats
    • updateTrackingInfo

      public void updateTrackingInfo(ProjectRunInfo projectRunInfo)
      Update tracking info.
      Parameters:
      projectRunInfo - the project run info
    • getTrackingInfo

      public ProjectRunInfo getTrackingInfo()
      Gets tracking info.
      Returns:
      the tracking info
    • increaseTrackingInfoStep

      public void increaseTrackingInfoStep(int recordsCount)
      Increase tracking info step.
      Parameters:
      recordsCount - the records count
    • setTrackingInfoReasonToDismiss

      public void setTrackingInfoReasonToDismiss(int reason, String reasonToDismiss)
      Sets tracking info reason to dismiss.
      Parameters:
      reason - the reason
      reasonToDismiss - the reason to dismiss
    • getProjectFolderPath

      public String getProjectFolderPath(String projectName)
      Get project folder path string.
      Parameters:
      projectName - the project name
      Returns:
      the string
    • isAppProject

      public boolean isAppProject()
      Is app project boolean.
      Returns:
      the boolean
    • getConfig

      public org.jdom2.Element getConfig()
      Gets config.
      Returns:
      the config
    • updateConfig

      public void updateConfig(org.jdom2.Element newConfig) throws Exception
      Update config.
      Parameters:
      newConfig - the new config
      Throws:
      Exception - the exception
    • getDatabanks

      public com.strategyquant.tradinglib.project.Databanks getDatabanks()
      Gets databanks.
      Returns:
      the databanks
    • getName

      public String getName()
      Gets name.
      Returns:
      the name
    • getProjectFolder

      public String getProjectFolder()
      Gets project folder.
      Returns:
      the project folder
    • beforeStart

      public void beforeStart() throws Exception
      Before start.
      Throws:
      Exception - the exception
    • confirm

      public void confirm(boolean confirmed)
      Confirm.
      Parameters:
      confirmed - the confirmed
    • getProgress

      public com.strategyquant.tradinglib.project.ProjectProgress getProgress()
      Get progress project progress.
      Returns:
      the project progress
    • increaseFailedJobsCount

      public void increaseFailedJobsCount()
      Increase failed jobs count.
    • increaseStrategiesFailed

      public void increaseStrategiesFailed()
      Increase strategies failed.
    • increaseStrategiesPassed

      public void increaseStrategiesPassed()
      Increase strategies passed.
    • getGeneticInfo

      public GeneticInfo getGeneticInfo()
      Gets genetic info.
      Returns:
      the genetic info
    • resetGeneticInfo

      public void resetGeneticInfo(boolean isGeneticEvolution, int numberOfIslands)
      Reset genetic info.
      Parameters:
      isGeneticEvolution - the is genetic evolution
      numberOfIslands - the number of islands
    • updateGeneticInfo

      public void updateGeneticInfo(com.strategyquant.tradinglib.gp.GPEvolutionMessage data, boolean newGeneration)
      Update genetic info.
      Parameters:
      data - the data
      newGeneration - the new generation
    • setTaskTitle

      public void setTaskTitle(String taskName, String taskTitle) throws Exception
      Sets task title.
      Parameters:
      taskName - the task name
      taskTitle - the task title
      Throws:
      Exception - the exception
    • setTaskActive

      public void setTaskActive(String taskName, boolean active) throws Exception
      Sets task active.
      Parameters:
      taskName - the task name
      active - the active
      Throws:
      Exception - the exception
    • cloneTask

      public ISQTask cloneTask(String taskName, String position) throws Exception
      Clone task isq task.
      Parameters:
      taskName - the task name
      position - the position
      Returns:
      the isq task
      Throws:
      Exception - the exception
    • onMemoryError

      public void onMemoryError(Error e)
      On memory error.
      Parameters:
      e - the e
    • isMemoryProtectionUsed

      public static boolean isMemoryProtectionUsed()
      Is memory protection used boolean.
      Returns:
      the boolean
    • setProjectName

      public void setProjectName(String newProjectName) throws Exception
      Sets project name.
      Parameters:
      newProjectName - the new project name
      Throws:
      Exception - the exception
    • getProjectConfigFile

      public File getProjectConfigFile()
      Get project config file file.
      Returns:
      the file
    • setRunSpecification

      public void setRunSpecification(int method)
      Sets run specification.
      Parameters:
      method - the method
    • setRunSpecification

      public void setRunSpecification(int runSpecification, String taskName)
      Sets run specification.
      Parameters:
      runSpecification - the run specification
      taskName - the task name
    • getRunCycles

      public int getRunCycles()
      Gets run cycles.
      Returns:
      the run cycles
    • getStartTime

      public long getStartTime()
      Gets start time.
      Returns:
      the start time
    • getTotalProjectRunningTime

      public long getTotalProjectRunningTime()
      Returns total running time of this project in ms including time when project was paused.
      Returns:
      total project running time
    • getProjectRunningTime

      public long getProjectRunningTime()
      Returns total running time of this project in ms. Time when project was paused is not taken into account.
      Returns:
      project running time
    • getCurrentTaskRunningTime

      public long getCurrentTaskRunningTime()
      Returns total running time of current task in ms. Time when task was paused is not taken into account.
      Returns:
      current task running time
    • printGlobalLog

      public String printGlobalLog() throws Exception
      Print global log string.
      Returns:
      the string
      Throws:
      Exception - the exception
    • getTaskStats

      public com.strategyquant.tradinglib.project.TaskStats getTaskStats(int taskHash)
      Gets task stats.
      Parameters:
      taskHash - the task hash
      Returns:
      the task stats
    • setLastEvent

      public void setLastEvent(String message)
      Sets last event.
      Parameters:
      message - the message
    • getLastEvent

      public String getLastEvent()
      Gets last event.
      Returns:
      the last event
    • getInfo

      public org.json.JSONObject getInfo()
      Gets info.
      Returns:
      the info
    • getGlobalLog

      public ProjectGlobalLog getGlobalLog()
      Gets global log.
      Returns:
      the global log
    • getTasks

      public ArrayList<ISQTask> getTasks()
      Gets tasks.
      Returns:
      the tasks
    • toJSON

      public String toJSON()
      returns JSON string
      Returns:
      string
    • getRunSpecification

      public int getRunSpecification()
      Gets run specification.
      Returns:
      the run specification