Package com.strategyquant.datalib
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 Summary
ConstructorDescriptionChartDef()
Instantiates a new chart def.Instantiates a new chart def.Instantiates a new chart def based on the existing one.ChartDef(String connectionName, String symbol, String timeframe, int backloadType, long backloadNumber, String session)
Instantiates a new chart def.ChartDef(String connectionName, String symbol, String timeframe, long historyFrom, long historyTo, double spread, String session)
Instantiates a new chart def. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canBeComputedFrom(ChartDef otherChart)
Can be computed from.long
Gets the backload number.int
Gets the backload type.int
Gets the bar time type.Gets the charts hash.getClone()
Gets the clone.getClone(long historyFrom, long historyTo)
Gets the clone.Gets the clone, change symbol name - used to create temporary groups for Single-Asset backtests.int
Gets the connection hash.Gets the connection name.long
Gets the history from.long
Gets the history to.Gets the instrument.Gets the instrument info.long
Gets the loaded history from.double
Gets the min distance.Gets the session.double
Gets the spread.Gets the symbol.int
Gets the symbol hash.Gets the symbol info.Gets the timeframe.org.jdom2.Element
getXML()
Gets the xml.boolean
Checks if is backtest data def.boolean
Checks if is registered.boolean
isSameConnectionSymbol(ChartDef otherChart)
Checks if is same connection symbol.boolean
isSmallerThan(ChartDef otherChart)
Checks if is smaller than.boolean
Checks if is symbol recognized.void
modifySpread(double spread)
Modify spread.void
setFromXML(org.jdom2.Element element)
Sets the from XML.void
setHistoryFrom(long time)
Sets the history from.void
setHistoryTo(long time)
Sets the history to.void
setLoadedHistoryFrom(long loadedHistoryFrom)
Sets the loaded history from.void
setMinDistance(double minDistance)
Sets the min distance.void
setRealSpread(boolean realSpread)
Sets the real spread.void
Sets the registered.void
setSession(String session)
Sets the session.void
setSpread(double spread)
Sets the spread.
-
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.DataExceptionInstantiates a new chart def.- Parameters:
connectionName
- the connection namesymbol
- the symboltimeframe
- the timeframebackloadType
- the backload typebackloadNumber
- the backload numbersession
- 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.DataExceptionInstantiates a new chart def.- Parameters:
connectionName
- the connection namesymbol
- the symboltimeframe
- the timeframehistoryFrom
- the history fromhistoryTo
- the history tospread
- the spreadsession
- the session- Throws:
com.strategyquant.datalib.data.DataException
- the data exception
-
ChartDef
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.DataExceptionInstantiates a new chart def based on the existing one.- Parameters:
chartDef
- the original ChartDeftimeframe
- timeframe- Throws:
com.strategyquant.datalib.data.DataException
- the data exception
-
-
Method Details
-
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
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
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
Gets the session.- Returns:
- the session
-
setRegistered
public void setRegistered()Sets the registered. -
getSymbolInfo
Gets the symbol info.- Returns:
- the symbol info
-
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
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 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
-
getBarTimeType
public int getBarTimeType()Gets the bar time type.- Returns:
- the bar time type
-
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
Gets the clone.- Specified by:
getClone
in interfacecom.strategyquant.lib.utils.ISQCloneable<ChartDef>
- Returns:
- the clone
-
getClone
Gets the clone.- Parameters:
historyFrom
- the history fromhistoryTo
- the history to- Returns:
- the clone
-
getClone
Gets the clone, change symbol name - used to create temporary groups for Single-Asset backtests.- Parameters:
symbol
-- Returns:
- the clone
-
getChartsHash
Gets the charts hash.- Returns:
- the charts hash
-
canBeComputedFrom
public boolean canBeComputedFrom(ChartDef otherChart) throws com.strategyquant.datalib.data.DataExceptionCan 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.DataExceptionChecks 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
Sets the session.- Parameters:
session
- the new session
-