Package com.strategyquant.tradinglib
Class ResultsGroup
java.lang.Object
com.strategyquant.tradinglib.ResultsGroup
- All Implemented Interfaces:
com.strategyquant.lib.settings.IXMLAble
,Serializable
public class ResultsGroup
extends Object
implements com.strategyquant.lib.settings.IXMLAble, Serializable
The Class ResultsGroup.
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdditional market keys.void
addResultSymbol(String resultKey, String symbolName)
Adds the result symbol.void
addSubresult(String resultKey, SettingsMap settings)
Adds the subresult.void
addSubresult(String resultKey, SettingsMap settings, Result result)
Adds the subresult.void
clear()
Clear.void
clone()
Clone.void
Compute all stats.void
Creates the portfolio result.void
createPortfolioResult(String initialBalanceType, SQProject project)
if there are multiple results in this group, calling this method will create a portfolio out of them - which means summary result that contains all the other (non-special) results .void
destroy(boolean removeStockChartsFile)
Destroy.generateUniqueResultKeyName(String resultKey)
Generate unique result key name.Gets the best WF result key.int
Returns the chart count expected by strategy.Gets the databank.Gets the file path.com.strategyquant.tradinglib.results.StrategyFingerprint
Gets the fingerprint.double
Gets the InSample fitness.double
getFitness(byte sampleType)
Gets the fitness.Gets the last settings.Gets the main result key.Gets the merged results.getName()
Gets the name.getNote()
com.strategyquant.tradinglib.strategy.OutOfSample
getOOS()
Gets the oos.com.strategyquant.tradinglib.optimization.OptimizationProfile
Gets the optimization profile.Gets the orsiginal WF result key.Gets the params.Gets the result keys.org.jdom2.Element
Gets the strategy xml.org.jdom2.Element
getXML()
Gets the xml.boolean
Checks for result.static void
init()
Inits the.boolean
Checks if is from algo wizard.boolean
Checks if is portfolio.boolean
lockRecord(int seconds, String lockingTask)
Lock record.lockRecord(String lockingTask)
locks this ResultsGroup and returns it.Main result.static ResultsGroup
merge(ResultsGroup... results)
merge multiple results groups into one and return it.static ResultsGroup
merge(ArrayList<ResultsGroup> results, String[] excludedKeys, SQProject project)
Merge.static ResultsGroup
mergeWF(ArrayList<ResultsGroup> results, String[] excludedKeys, SQProject project)
Merge.void
mergeWith(ResultsGroup rg)
Merge with.void
mergeWith(ResultsGroup rg, String[] excludedKeys)
void
mergeWith(ResultsGroup rg, String[] excludedKeys, boolean mergeWFResults)
Merge with.void
moveResultFrom(String resultKey, ResultsGroup sourceRG, boolean makeSpecial)
Move result from.orders()
Orders.Portfolio.it.unimi.dsi.fastutil.longs.Long2FloatRBTreeMap
Recompute merged daily equity.void
releaseLock(String lockingTask)
Release lock.void
removeSubresult(String resultKey, boolean destroyRemovedResult)
Removes the subresult.void
go through all saved result settings and remove values that will be not saved to XML This will free memory of unused objects such as strategy or trading options objects that will never be used again.void
setDatabank(Databank databank)
Sets the databank.void
setFromXML(org.jdom2.Element element)
Sets the from XML.void
setLastSettings(String lastSettingsXml)
Sets the last settings.void
setMergedResults(List<ResultsGroup> results)
Sets the merged results.void
Use this method only when creating a new strategy before saving.void
void
setOOSSettings(com.strategyquant.tradinglib.strategy.OutOfSample oos)
Sets the OOS settings.void
setOptimizationProfile(com.strategyquant.tradinglib.optimization.OptimizationProfile optimizationProfile)
Sets the optimization profile.void
setResultFileName(String fileName)
Sets the result file name.Special values.boolean
Stores chart data.Sub result.com.strategyquant.tradinglib.results.SymbolsMap
symbols()
returns symbols map.void
Try save to file.void
updateResults(ResultsGroup newResults, boolean sendEvent)
updates this results group - it will completely replace everything in the old ResultsGroup with the new one .
-
Field Details
-
Log
public static final org.slf4j.Logger LogThe Constant Log. -
Portfolio
The Constant Portfolio.- See Also:
- Constant Field Values
-
MergedPortfolio
The Constant MergedPortfolio.- See Also:
- Constant Field Values
-
WFResult
The Constant WFResult.- See Also:
- Constant Field Values
-
AdditionalMarket
The Constant AdditionalMarket.- See Also:
- Constant Field Values
-
updated
public boolean updatedThe updated. -
correlationPeriods
Correlation periods.
-
-
Constructor Details
-
ResultsGroup
Instantiates a new results group.- Parameters:
resultName
- the result name
-
-
Method Details
-
init
public static void init()Inits the. -
getName
Gets the name.- Returns:
- the name
-
setName
Use this method only when creating a new strategy before saving.- Parameters:
name
- the new name
-
addResultSymbol
Adds the result symbol.- Parameters:
resultKey
- the result keysymbolName
- the symbol name- Throws:
Exception
- the exception
-
subResult
Sub result.- Parameters:
resultKey
- the result key- Returns:
- the result
- Throws:
Exception
- the exception
-
getMainResultKey
Gets the main result key.- Returns:
- the main result key
- Throws:
Exception
- the exception
-
mainResult
Main result.- Returns:
- the result
- Throws:
Exception
- the exception
-
portfolio
Portfolio.- Returns:
- the result
- Throws:
Exception
- the exception
-
addSubresult
Adds the subresult.- Parameters:
resultKey
- the result keysettings
- the settings- Throws:
Exception
- the exception
-
addSubresult
Adds the subresult.- Parameters:
resultKey
- the result keysettings
- the settingsresult
- the result- Throws:
Exception
- the exception
-
removeSubresult
Removes the subresult.- Parameters:
resultKey
- the result keydestroyRemovedResult
- the destroy removed result- Throws:
Exception
- the exception
-
getResultKeys
Gets the result keys.- Returns:
- the result keys
- Throws:
Exception
- the exception
-
additionalMarketKeys
Additional market keys.- Returns:
- the list
- Throws:
Exception
- the exception
-
hasResult
Checks for result.- Parameters:
resultKey
- the result key- Returns:
- true, if successful
- Throws:
Exception
- the exception
-
symbols
public com.strategyquant.tradinglib.results.SymbolsMap symbols()returns symbols map.- Returns:
- the symbols map
-
setDatabank
Sets the databank.- Parameters:
databank
- the new databank- Throws:
Exception
- the exception
-
updateResults
updates this results group - it will completely replace everything in the old ResultsGroup with the new one .- Parameters:
newResults
- the new resultssendEvent
- the send event- Throws:
Exception
- the exception
-
orders
Orders.- Returns:
- the orders list
- Throws:
Exception
- the exception
-
getFilePath
Gets the file path.- Returns:
- the file path
-
getDatabank
Gets the databank.- Returns:
- the databank
-
generateUniqueResultKeyName
Generate unique result key name.- Parameters:
resultKey
- the result key- Returns:
- the string
- Throws:
Exception
- the exception
-
merge
public static ResultsGroup merge(ArrayList<ResultsGroup> results, String[] excludedKeys, SQProject project) throws ExceptionMerge.- Parameters:
results
- the resultsexcludedKeys
- the excluded keysproject
- the project- Returns:
- the results group
- Throws:
Exception
- the exception
-
mergeWF
public static ResultsGroup mergeWF(ArrayList<ResultsGroup> results, String[] excludedKeys, SQProject project) throws ExceptionMerge.- Parameters:
results
- the resultsexcludedKeys
- the excluded keysproject
- the project- Returns:
- the results group
- Throws:
Exception
- the exception
-
merge
merge multiple results groups into one and return it.- Parameters:
results
- the results- Returns:
- the results group
- Throws:
Exception
- the exception
-
mergeWith
Merge with.- Parameters:
rg
- the rg- Throws:
Exception
- the exception
-
mergeWith
- Throws:
Exception
-
mergeWith
public void mergeWith(ResultsGroup rg, String[] excludedKeys, boolean mergeWFResults) throws ExceptionMerge with.- Parameters:
rg
- the rgexcludedKeys
- the excluded keys- Throws:
Exception
- the exception
-
isPortfolio
Checks if is portfolio.- Returns:
- true, if is portfolio
- Throws:
Exception
- the exception
-
specialValues
Special values.- Returns:
- the settings map
-
getXML
public org.jdom2.Element getXML()Gets the xml.- Specified by:
getXML
in interfacecom.strategyquant.lib.settings.IXMLAble
- Returns:
- the xml
-
setFromXML
Sets the from XML.- Specified by:
setFromXML
in interfacecom.strategyquant.lib.settings.IXMLAble
- Parameters:
element
- the new from XML- Throws:
Exception
- the exception
-
computeAllStats
Compute all stats.- Throws:
Exception
- the exception
-
clone
Clone.- Returns:
- the results group
-
getStrategyXml
Gets the strategy xml.- Returns:
- the strategy xml
- Throws:
Exception
- the exception
-
setResultFileName
Sets the result file name.- Parameters:
fileName
- the new result file name
-
getParams
Gets the params.- Returns:
- the params
-
getOriginalWFResultKey
Gets the orsiginal WF result key.- Returns:
- the orsiginal WF result key
- Throws:
Exception
- the exception
-
getChartCount
public int getChartCount()Returns the chart count expected by strategy. Returns -1 if chart count cannot be resolved.- Returns:
- the chart count
-
setLastSettings
Sets the last settings.- Parameters:
lastSettingsXml
- the new last settings- Throws:
Exception
- the exception
-
getLastSettings
Gets the last settings.- Returns:
- the last settings
- Throws:
Exception
- the exception
-
createPortfolioResult
Creates the portfolio result.- Throws:
Exception
- the exception
-
createPortfolioResult
if there are multiple results in this group, calling this method will create a portfolio out of them - which means summary result that contains all the other (non-special) results .- Parameters:
initialBalanceType
- the initial balance typeproject
- the project- Throws:
Exception
- the exception
-
recomputeMergedDailyEquity
public it.unimi.dsi.fastutil.longs.Long2FloatRBTreeMap recomputeMergedDailyEquity() throws ExceptionRecompute merged daily equity.- Returns:
- the long 2 float RB tree map
- Throws:
Exception
- the exception
-
moveResultFrom
public void moveResultFrom(String resultKey, ResultsGroup sourceRG, boolean makeSpecial) throws ExceptionMove result from.- Parameters:
resultKey
- the result keysourceRG
- the source RGmakeSpecial
- the make special- Throws:
Exception
- the exception
-
removeUnsavableSettings
public void removeUnsavableSettings()go through all saved result settings and remove values that will be not saved to XML This will free memory of unused objects such as strategy or trading options objects that will never be used again. -
getFitness
public double getFitness()Gets the InSample fitness. Note - this method returns InSample fitness, not Full sample! It is used in Databank filters and genetic evolutions.- Returns:
- the fitness
-
getFitness
public double getFitness(byte sampleType)Gets the fitness.- Parameters:
sampleType
- the sample type- Returns:
- the fitness
-
getFingerprint
public com.strategyquant.tradinglib.results.StrategyFingerprint getFingerprint()Gets the fingerprint.- Returns:
- the fingerprint
-
lockRecord
locks this ResultsGroup and returns it. If the lock cannot be acquired within 5 seconds it will throw an exception- Parameters:
lockingTask
- the locking task- Returns:
- the results group
- Throws:
Exception
- the exception
-
lockRecord
Lock record.- Parameters:
seconds
- the secondslockingTask
- the locking task- Returns:
- the results group
- Throws:
Exception
- the exception
-
releaseLock
Release lock.- Parameters:
lockingTask
- the locking task
-
clear
public void clear()Clear. -
clearTempData
public void clearTempData() -
destroy
public void destroy(boolean removeStockChartsFile)Destroy.- Parameters:
removeStockChartsFile
- the remove stock charts file
-
isFromAlgoWizard
public boolean isFromAlgoWizard()Checks if is from algo wizard.- Returns:
- true, if is from algo wizard
-
trySaveToFile
public void trySaveToFile()Try save to file. -
storesChartData
public boolean storesChartData()Stores chart data.- Returns:
- true, if successful
-
setOptimizationProfile
public void setOptimizationProfile(com.strategyquant.tradinglib.optimization.OptimizationProfile optimizationProfile)Sets the optimization profile.- Parameters:
optimizationProfile
- the new optimization profile
-
getOptimizationProfile
public com.strategyquant.tradinglib.optimization.OptimizationProfile getOptimizationProfile()Gets the optimization profile.- Returns:
- the optimization profile
-
getBestWFResultKey
Gets the best WF result key.- Returns:
- the best WF result key
-
getOOS
public com.strategyquant.tradinglib.strategy.OutOfSample getOOS()Gets the oos.- Returns:
- the oos
-
setOOSSettings
public void setOOSSettings(com.strategyquant.tradinglib.strategy.OutOfSample oos)Sets the OOS settings.- Parameters:
oos
- the new OOS settings
-
getMergedResults
Gets the merged results.- Returns:
- the merged results
-
setMergedResults
Sets the merged results.- Parameters:
results
- the new merged results
-
isStockpickerStrategy
public boolean isStockpickerStrategy() -
setNote
-
getNote
-
getNote
-