Class MoneyManagementMethod

java.lang.Object
com.strategyquant.tradinglib.debug.Debugger
com.strategyquant.tradinglib.propertygrid.ParametersTableItemProperties
com.strategyquant.tradinglib.propertygrid.ParametersTableItem
com.strategyquant.tradinglib.MoneyManagementMethod
All Implemented Interfaces:
com.strategyquant.lib.settings.IXMLAble, com.strategyquant.lib.utils.ISQCloneable<MoneyManagementMethod>, Serializable

public abstract class MoneyManagementMethod extends com.strategyquant.tradinglib.propertygrid.ParametersTableItem implements com.strategyquant.lib.utils.ISQCloneable<MoneyManagementMethod>
The Class MoneyManagementMethod.
See Also:
Serialized Form
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static double
    The Constant defaultInitialCapital.
    The name.

    Fields inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItem

    _text, editable

    Fields inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItemProperties

    df, Log, TYPE_BOOLEAN, TYPE_DATE, TYPE_DOUBLE, TYPE_INT, TYPE_INT_LIST, TYPE_STR_LIST, TYPE_STRING, TYPE_TIME
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    computeTradeSize​(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep)
    Compute trade size.
    double
    computeTradeSize​(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep, double maxPos)
    Compute trade size.
    Gets the clone.
    double
    Gets the initial capital.
    org.jdom2.Element
    Gets the xml.
    New instance.
    double
    round​(double value, double step, int decimals)
    Rounds the number.
    void
    setFromParameterEl​(org.jdom2.Element paramElem)
    Sets the from parameter el.
    void
    setFromXML​(org.jdom2.Element mmElem)
    Sets the from XML.
    void
    setInitialCapital​(double initialCapital)
    Sets the initial capital.
    void
    setMethodFromXML​(org.jdom2.Element elMethod)
    Sets the method from XML.
    void
    setName​(String name)
    Sets the name.

    Methods inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItem

    equals, getDescription, getEngine, getFormatedName, getName, getNote, isEditable, isUsed, newInstance, printFormatedName, setEditable, setUsed

    Methods inherited from class com.strategyquant.tradinglib.propertygrid.ParametersTableItemProperties

    getParametersList, getParameterValue, getParams, getPGParameterValue, setDefaultValues, setParameterValue, setParams

    Methods inherited from class com.strategyquant.tradinglib.debug.Debugger

    debug, fdebug

    Methods inherited from class java.lang.Object

    getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • name

      public String name
      The name.
    • defaultInitialCapital

      public static final double defaultInitialCapital
      The Constant defaultInitialCapital.
      See Also:
      Constant Field Values
  • Constructor Details

    • MoneyManagementMethod

      public MoneyManagementMethod()
  • Method Details

    • setName

      public void setName(String name)
      Sets the name.
      Parameters:
      name - the new name
    • getInitialCapital

      public double getInitialCapital()
      Gets the initial capital.
      Returns:
      the initialCapital
    • setInitialCapital

      public void setInitialCapital(double initialCapital)
      Sets the initial capital.
      Parameters:
      initialCapital - the initialCapital to set
    • getXML

      public org.jdom2.Element getXML()
      Gets the xml.
      Specified by:
      getXML in interface com.strategyquant.lib.settings.IXMLAble
      Overrides:
      getXML in class com.strategyquant.tradinglib.propertygrid.ParametersTableItem
      Returns:
      the xml
    • setFromXML

      public void setFromXML(org.jdom2.Element mmElem) throws Exception
      Sets the from XML.
      Specified by:
      setFromXML in interface com.strategyquant.lib.settings.IXMLAble
      Overrides:
      setFromXML in class com.strategyquant.tradinglib.propertygrid.ParametersTableItem
      Parameters:
      mmElem - the new from XML
      Throws:
      Exception - the exception
    • newInstance

      public MoneyManagementMethod newInstance() throws Exception
      New instance.
      Returns:
      the money management method
      Throws:
      Exception - the exception
    • computeTradeSize

      public double computeTradeSize(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep) throws Exception
      Compute trade size.
      Parameters:
      strategy - the strategy
      symbol - the symbol
      orderType - the order type
      price - the price
      sl - the sl
      tickSize - the tick size
      pointValue - the point value
      Returns:
      the double
      Throws:
      Exception - the exception
    • computeTradeSize

      public double computeTradeSize(StrategyBase strategy, String symbol, byte orderType, double price, double sl, double tickSize, double pointValue, double sizeStep, double maxPos) throws Exception
      Compute trade size.
      Parameters:
      strategy - the strategy
      symbol - the symbol
      orderType - the order type
      price - the price
      sl - the sl
      tickSize - the tick size
      pointValue - the point value
      maxPos - the maximum number of simultaneously open trades
      Returns:
      the double
      Throws:
      Exception - the exception
    • setMethodFromXML

      public void setMethodFromXML(org.jdom2.Element elMethod) throws Exception
      Sets the method from XML.
      Parameters:
      elMethod - the new method from XML
      Throws:
      Exception - the exception
    • setFromParameterEl

      public void setFromParameterEl(org.jdom2.Element paramElem) throws Exception
      Sets the from parameter el.
      Overrides:
      setFromParameterEl in class com.strategyquant.tradinglib.propertygrid.ParametersTableItem
      Parameters:
      paramElem - the new from parameter el
      Throws:
      Exception - the exception
    • getClone

      public MoneyManagementMethod getClone() throws Exception
      Gets the clone.
      Specified by:
      getClone in interface com.strategyquant.lib.utils.ISQCloneable<MoneyManagementMethod>
      Overrides:
      getClone in class com.strategyquant.tradinglib.propertygrid.ParametersTableItem
      Returns:
      the clone
      Throws:
      Exception - the exception
    • round

      public double round(double value, double step, int decimals)
      Rounds the number.
      Parameters:
      value - the value
      step - the step
      decimals - the decimals
      Returns:
      the value
      Throws:
      Exception - the exception