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
ConstructorsConstructorDescriptionChartDef()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 TypeMethodDescriptionbooleancanBeComputedFrom(ChartDef otherChart)Can be computed from.longGets the backload number.intGets the backload type.intGets 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.intGets the connection hash.Gets the connection name.longGets the history from.longGets the history to.Gets the instrument.Gets the instrument info.longGets the loaded history from.doubleGets the min distance.Gets the session.doubleGets the spread.Gets the symbol.intGets the symbol hash.Gets the symbol info.Gets the timeframe.org.jdom2.ElementgetXML()Gets the xml.booleanChecks if is backtest data def.booleanChecks if is registered.booleanisSameConnectionSymbol(ChartDef otherChart)Checks if is same connection symbol.booleanisSmallerThan(ChartDef otherChart)Checks if is smaller than.booleanChecks if is symbol recognized.voidmodifySpread(double spread)Modify spread.voidsetFromXML(org.jdom2.Element element)Sets the from XML.voidsetHistoryFrom(long time)Sets the history from.voidsetHistoryTo(long time)Sets the history to.voidsetLoadedHistoryFrom(long loadedHistoryFrom)Sets the loaded history from.voidsetMinDistance(double minDistance)Sets the min distance.voidsetRealSpread(boolean realSpread)Sets the real spread.voidSets the registered.voidsetSession(String session)Sets the session.voidsetSpread(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:
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
-
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:
getClonein 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
-