Package com.strategyquant.tradinglib
Class SQStats
java.lang.Object
com.strategyquant.tradinglib.SQStats
- All Implemented Interfaces:
com.strategyquant.lib.settings.IXMLAble
,com.strategyquant.lib.utils.ISQCloneable<SQStats>
public class SQStats
extends Object
implements com.strategyquant.lib.settings.IXMLAble, com.strategyquant.lib.utils.ISQCloneable<SQStats>
Class holding computed strategy stats and metrics in an efficient hash map.
It contains methods set(key, value) and get(key), where key is the reference to the computed metrics - it is a name of the class snippet, for example "NetProfit".
See class StatsKey for an (incomplete) list of possible keys.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear data.boolean
containsKey(String key)
Contains key.void
copyValueFrom(SQStats sourceStats, String key)
Copy value from.void
copyValuesFrom(SQStats sourceStats)
Copy values from.void
deserialize(ObjectInput dis)
Deserialize.getClone()
Gets the clone.double
Gets the double.double
Gets the double.int
Gets the int.int
Gets the int.long
Gets the long.long
Gets the long.org.jdom2.Element
getXML()
Gets the xml.org.jdom2.Element
Gets the XML optimized format.void
serialize(ObjectOutput dos)
Serialize.void
Sets the.void
Sets the.void
Sets the.void
Sets the.void
setFromXML(org.jdom2.Element element)
Sets the from XML.
-
Field Details
-
Log
public static final org.slf4j.Logger LogThe Constant Log.
-
-
Constructor Details
-
SQStats
public SQStats()
-
-
Method Details
-
set
Sets the.- Parameters:
key
- the keyvalue
- the value
-
set
Sets the.- Parameters:
key
- the keyvalue
- the value
-
set
Sets the.- Parameters:
key
- the keyvalue
- the value
-
set
Sets the.- Parameters:
key
- the keyvalue
- the value
-
getInt
Gets the int.- Parameters:
key
- the key- Returns:
- the int
-
getInt
Gets the int.- Parameters:
key
- the keyvalueIfNotFound
- the value if not found- Returns:
- the int
-
getLong
Gets the long.- Parameters:
key
- the key- Returns:
- the long
-
getLong
Gets the long.- Parameters:
key
- the keyvalueIfNotFound
- the value if not found- Returns:
- the long
-
getDouble
Gets the double.- Parameters:
key
- the key- Returns:
- the double
-
getDouble
Gets the double.- Parameters:
key
- the keyvalueIfNotFound
- the value if not found- Returns:
- the double
-
getXML
public org.jdom2.Element getXML()Gets the xml.- Specified by:
getXML
in interfacecom.strategyquant.lib.settings.IXMLAble
- Returns:
- the xml
-
setFromXML
public void setFromXML(org.jdom2.Element element)Sets the from XML.- Specified by:
setFromXML
in interfacecom.strategyquant.lib.settings.IXMLAble
- Parameters:
element
- the new from XML
-
clearData
public void clearData()Clear data. -
copyValuesFrom
Copy values from.- Parameters:
sourceStats
- the source stats
-
copyValueFrom
Copy value from.- Parameters:
sourceStats
- the source statskey
- the key
-
containsKey
Contains key.- Parameters:
key
- the key- Returns:
- true, if successful
-
getClone
Gets the clone. -
getXMLOptimizedFormat
Gets the XML optimized format.- Returns:
- the XML optimized format
- Throws:
IOException
- Signals that an I/O exception has occurred.
-
serialize
Serialize.- Parameters:
dos
- the dos- Throws:
IOException
- Signals that an I/O exception has occurred.
-
deserialize
Deserialize.- Parameters:
dis
- the dis- Throws:
IOException
- Signals that an I/O exception has occurred.
-