Class ChartDef

java.lang.Object
com.strategyquant.datalib.ChartDef
All Implemented Interfaces:
com.strategyquant.lib.settings.IXMLAble, com.strategyquant.lib.utils.ISQCloneable<ChartDef>, Serializable

public class ChartDef extends Object implements com.strategyquant.lib.settings.IXMLAble, com.strategyquant.lib.utils.ISQCloneable<ChartDef>, Serializable
Chart definition - holds settings of one chart like symbol, timeframe, date from - to, instrument info, etc.
See Also:
Serialized Form
  • Constructor Details

    • ChartDef

      public ChartDef()
      Instantiates a new chart def.
    • ChartDef

      public ChartDef(String connectionName, String symbol, String timeframe, int backloadType, long backloadNumber, String session) throws com.strategyquant.datalib.data.DataException
      Instantiates a new chart def.
      Parameters:
      connectionName - the connection name
      symbol - the symbol
      timeframe - the timeframe
      backloadType - the backload type
      backloadNumber - the backload number
      session - the session
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • ChartDef

      public ChartDef(String connectionName, String symbol, String timeframe, long historyFrom, long historyTo, double spread, String session) throws com.strategyquant.datalib.data.DataException
      Instantiates a new chart def.
      Parameters:
      connectionName - the connection name
      symbol - the symbol
      timeframe - the timeframe
      historyFrom - the history from
      historyTo - the history to
      spread - the spread
      session - the session
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • ChartDef

      public ChartDef(ChartDef chartDef) throws com.strategyquant.datalib.data.DataException
      Instantiates a new chart def.
      Parameters:
      chartDef - the chart def
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • ChartDef

      public ChartDef(ChartDef chartDef, String timeframe) throws com.strategyquant.datalib.data.DataException
      Instantiates a new chart def based on the existing one.
      Parameters:
      chartDef - the original ChartDef
      timeframe - timeframe
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
  • Method Details

    • getConnectionName

      public String getConnectionName()
      Gets the connection name.
      Returns:
      the connection name
    • isSymbolRecognized

      public boolean isSymbolRecognized()
      Checks if is symbol recognized.
      Returns:
      true, if is symbol recognized
    • getTimeframe

      public String getTimeframe()
      Gets the timeframe.
      Returns:
      the timeframe
    • getHistoryFrom

      public long getHistoryFrom()
      Gets the history from.
      Returns:
      the history from
    • setHistoryFrom

      public void setHistoryFrom(long time)
      Sets the history from.
      Parameters:
      time - the new history from
    • getHistoryTo

      public long getHistoryTo()
      Gets the history to.
      Returns:
      the history to
    • setHistoryTo

      public void setHistoryTo(long time)
      Sets the history to.
      Parameters:
      time - the new history to
    • getSpread

      public double getSpread()
      Gets the spread.
      Returns:
      the spread
    • setSpread

      public void setSpread(double spread)
      Sets the spread.
      Parameters:
      spread - the new spread
    • getConnectionHash

      public int getConnectionHash()
      Gets the connection hash.
      Returns:
      the connection hash
    • getSymbol

      public String getSymbol()
      Gets the symbol.
      Returns:
      the symbol
    • getSymbolHash

      public int getSymbolHash()
      Gets the symbol hash.
      Returns:
      the symbol hash
    • isRegistered

      public boolean isRegistered()
      Checks if is registered.
      Returns:
      true, if is registered
    • getSession

      public String getSession()
      Gets the session.
      Returns:
      the session
    • setRegistered

      public void setRegistered()
      Sets the registered.
    • getSymbolInfo

      public InstrumentInfo getSymbolInfo()
      Gets the symbol info.
      Returns:
      the symbol info
    • getInstrument

      public String getInstrument()
      Gets the instrument.
      Returns:
      the instrument
    • isBacktestDataDef

      public boolean isBacktestDataDef()
      Checks if is backtest data def.
      Returns:
      true, if is backtest data def
    • setLoadedHistoryFrom

      public void setLoadedHistoryFrom(long loadedHistoryFrom)
      Sets the loaded history from.
      Parameters:
      loadedHistoryFrom - the new loaded history from
    • getLoadedHistoryFrom

      public long getLoadedHistoryFrom()
      Gets the loaded history from.
      Returns:
      the loaded history from
    • isSameConnectionSymbol

      public boolean isSameConnectionSymbol(ChartDef otherChart)
      Checks if is same connection symbol.
      Parameters:
      otherChart - the other chart
      Returns:
      true, if is same connection symbol
    • getBackloadType

      public int getBackloadType()
      Gets the backload type.
      Returns:
      the backload type
    • getBackloadNumber

      public long getBackloadNumber()
      Gets the backload number.
      Returns:
      the backload number
    • getXML

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

      public void setFromXML(org.jdom2.Element element)
      Sets the from XML.
      Specified by:
      setFromXML in interface com.strategyquant.lib.settings.IXMLAble
      Parameters:
      element - the new from XML
    • getBarTimeType

      public int getBarTimeType()
      Gets the bar time type.
      Returns:
      the bar time type
    • getInstrumentInfo

      public InstrumentInfo getInstrumentInfo()
      Gets the instrument info.
      Returns:
      the instrument info
    • setMinDistance

      public void setMinDistance(double minDistance)
      Sets the min distance.
      Parameters:
      minDistance - the new min distance
    • getMinDistance

      public double getMinDistance()
      Gets the min distance.
      Returns:
      the min distance
    • getClone

      public ChartDef getClone()
      Gets the clone.
      Specified by:
      getClone in interface com.strategyquant.lib.utils.ISQCloneable<ChartDef>
      Returns:
      the clone
    • getClone

      public ChartDef getClone(long historyFrom, long historyTo)
      Gets the clone.
      Parameters:
      historyFrom - the history from
      historyTo - the history to
      Returns:
      the clone
    • getClone

      public ChartDef getClone(String symbol)
      Gets the clone, change symbol name - used to create temporary groups for Single-Asset backtests.
      Parameters:
      symbol -
      Returns:
      the clone
    • getChartsHash

      public String getChartsHash()
      Gets the charts hash.
      Returns:
      the charts hash
    • canBeComputedFrom

      public boolean canBeComputedFrom(ChartDef otherChart) throws com.strategyquant.datalib.data.DataException
      Can be computed from.
      Parameters:
      otherChart - the other chart
      Returns:
      true, if successful
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • modifySpread

      public void modifySpread(double spread)
      Modify spread.
      Parameters:
      spread - the spread
    • setRealSpread

      public void setRealSpread(boolean realSpread)
      Sets the real spread.
      Parameters:
      realSpread - the new real spread
    • isSmallerThan

      public boolean isSmallerThan(ChartDef otherChart) throws com.strategyquant.datalib.data.DataException
      Checks if is smaller than.
      Parameters:
      otherChart - the other chart
      Returns:
      true, if is smaller than
      Throws:
      com.strategyquant.datalib.data.DataException - the data exception
    • setSession

      public void setSession(String session)
      Sets the session.
      Parameters:
      session - the new session