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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear data.booleancontainsKey(String key)Contains key.voidcopyValueFrom(SQStats sourceStats, String key)Copy value from.voidcopyValuesFrom(SQStats sourceStats)Copy values from.voiddeserialize(ObjectInput dis)Deserialize.getClone()Gets the clone.doubleGets the double.doubleGets the double.intGets the int.intGets the int.longGets the long.longGets the long.org.jdom2.ElementgetXML()Gets the xml.org.jdom2.ElementGets the XML optimized format.voidserialize(ObjectOutput dos)Serialize.voidSets the.voidSets the.voidSets the.voidSets the.voidsetFromXML(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:
getXMLin interfacecom.strategyquant.lib.settings.IXMLAble- Returns:
- the xml
-
setFromXML
public void setFromXML(org.jdom2.Element element)Sets the from XML.- Specified by:
setFromXMLin 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.
-