Package com.strategyquant.tradinglib
Class ChartSetup
java.lang.Object
com.strategyquant.tradinglib.ChartSetup
- All Implemented Interfaces:
com.strategyquant.lib.settings.IXMLAble
,com.strategyquant.lib.utils.ISQCloneable<ChartSetup>
,Serializable
public class ChartSetup
extends Object
implements com.strategyquant.lib.settings.IXMLAble, Serializable, com.strategyquant.lib.utils.ISQCloneable<ChartSetup>
The Class ChartSetup.
- See Also:
- Serialized Form
-
Constructor Summary
ConstructorDescriptionUsed when creating chartSetup from XML.ChartSetup(String symbol, String timeframe, long dateFrom, long dateTo, double symbolSpread, String session)
constructor called for backtesting.ChartSetup(String connectionName, String symbol, String timeframe, int backloadType, long backloadNumber, String session)
constructor called for live tradingChartSetup(String connectionName, String symbol, String timeframe, long dateFrom, long dateTo, double symbolSpread, String session)
constructor called for backtesting -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllCharts(ChartSetup chartSetup)
Adds the all charts.void
Adds the chart.Adds the chart.Adds the chart.void
applyChanges(ChartSetup oldSetup, HashMap<String,Object> settingsMap)
void
checkConnectionSymbolExist(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager)
method checks if given connections and symbols exists or if symbols are supported by the connection.static ChartSetup
Creates the first available data.int
Gets the backtest engine.returns list of charts that are in this chart setup.int
Gets the charts count.getClone()
Gets the clone.getClone(long from, long to)
Gets the clone.Gets the clone with changed symbol - used to create temporary groups for Single-Asset backtests..Gets the commissions method.returns main chart of this chart setup.Gets the symbol.int
Gets the test precision.Gets the t fs as string.Gets the timeframe.org.jdom2.Element
getXML()
Gets the xml.boolean
Checks if is created using backload.boolean
isUsed()
Checks if is used.void
registerConnectionSymbols(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager)
Register connection symbols.void
runChecks(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager)
Run checks.void
setBacktestEngine(int backtestEngine)
Sets the backtest engine.void
setCommissionsMethod(CommissionsMethod commissionsMethod)
Sets the commissions method.void
setFromXML(org.jdom2.Element element)
Sets the from XML.void
setMinDistance(double minDistance)
Sets the min distance.void
setTestPrecision(int testPrecision)
Sets the test precision.void
setUsed()
Sets the used.
-
Constructor Details
-
ChartSetup
public ChartSetup()Used when creating chartSetup from XML. -
ChartSetup
public ChartSetup(String connectionName, String symbol, String timeframe, int backloadType, long backloadNumber, String session) throws com.strategyquant.datalib.data.DataExceptionconstructor called for live trading- 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
-
ChartSetup
public ChartSetup(String connectionName, String symbol, String timeframe, long dateFrom, long dateTo, double symbolSpread, String session) throws com.strategyquant.datalib.data.DataExceptionconstructor called for backtesting- Parameters:
connectionName
- the connection namesymbol
- the symboltimeframe
- the timeframedateFrom
- the date fromdateTo
- the date tosymbolSpread
- the symbol spreadsession
- the session- Throws:
com.strategyquant.datalib.data.DataException
- the data exception
-
ChartSetup
public ChartSetup(String symbol, String timeframe, long dateFrom, long dateTo, double symbolSpread, String session) throws com.strategyquant.datalib.data.DataExceptionconstructor called for backtesting. If no connectionName is given then "History" is used by default- Parameters:
symbol
- the symboltimeframe
- the timeframedateFrom
- the date fromdateTo
- the date tosymbolSpread
- the symbol spreadsession
- the session- Throws:
com.strategyquant.datalib.data.DataException
- the data exception
-
-
Method Details
-
addChart
public ChartDef addChart(String connectionName, String symbol, String timeframe, double symbolSpread) throws com.strategyquant.datalib.data.DataExceptionAdds the chart.- Parameters:
connectionName
- the connection namesymbol
- the symboltimeframe
- the timeframesymbolSpread
- the symbol spread- Returns:
- the chart def
- Throws:
com.strategyquant.datalib.data.DataException
- the data exception
-
addChart
public ChartDef addChart(String connectionName, String symbol, String timeframe) throws com.strategyquant.datalib.data.DataExceptionAdds the chart.- Parameters:
connectionName
- the connection namesymbol
- the symboltimeframe
- the timeframe- Returns:
- the chart def
- Throws:
com.strategyquant.datalib.data.DataException
- the data exception
-
registerConnectionSymbols
public void registerConnectionSymbols(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager) throws ExceptionRegister connection symbols.- Parameters:
connectionManager
- the connection manager- Throws:
Exception
- the exception
-
checkConnectionSymbolExist
public void checkConnectionSymbolExist(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager) throws com.strategyquant.datalib.data.DataExceptionmethod checks if given connections and symbols exists or if symbols are supported by the connection.- Parameters:
connectionManager
- the connection manager- Throws:
com.strategyquant.datalib.data.DataException
- the data exception
-
getCharts
returns list of charts that are in this chart setup.- Returns:
- the charts
-
runChecks
public void runChecks(com.strategyquant.tradinglib.connection.ConnectionManager connectionManager) throws ExceptionRun checks.- Parameters:
connectionManager
- the connection manager- Throws:
Exception
- the exception
-
getChartsCount
public int getChartsCount()Gets the charts count.- Returns:
- the charts count
-
getClone
Gets the clone.- Specified by:
getClone
in interfacecom.strategyquant.lib.utils.ISQCloneable<ChartSetup>
- Returns:
- the clone
-
getClone
Gets the clone.- Parameters:
from
- the fromto
- the to- Returns:
- the clone
-
getClone
Gets the clone with changed symbol - used to create temporary groups for Single-Asset backtests..- Parameters:
symbol
-- Returns:
- the clone
-
isUsed
public boolean isUsed()Checks if is used.- Returns:
- true, if is used
-
setUsed
public void setUsed()Sets the used. -
isCreatedUsingBackload
public boolean isCreatedUsingBackload()Checks if is created using backload.- Returns:
- true, if is created using backload
-
getMainChart
returns main chart of this chart setup.- Returns:
- the main chart
-
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
-
setMinDistance
public void setMinDistance(double minDistance)Sets the min distance.- Parameters:
minDistance
- the new min distance
-
setTestPrecision
public void setTestPrecision(int testPrecision)Sets the test precision.- Parameters:
testPrecision
- the new test precision
-
getTestPrecision
public int getTestPrecision()Gets the test precision.- Returns:
- the test precision
-
addAllCharts
Adds the all charts.- Parameters:
chartSetup
- the chart setup
-
addChart
Adds the chart.- Parameters:
chartDef
- the chart def
-
getCommissionsMethod
Gets the commissions method.- Returns:
- the commissions method
-
setCommissionsMethod
Sets the commissions method.- Parameters:
commissionsMethod
- the new commissions method
-
getBacktestEngine
public int getBacktestEngine()Gets the backtest engine.- Returns:
- the backtest engine
-
setBacktestEngine
public void setBacktestEngine(int backtestEngine)Sets the backtest engine.- Parameters:
backtestEngine
- the new backtest engine
-
getTFsAsString
Gets the t fs as string.- Returns:
- the t fs as string
-
getSymbol
Gets the symbol.- Returns:
- the symbol
-
getTimeframe
Gets the timeframe.- Returns:
- the timeframe
-
createFirstAvailableData
Creates the first available data.- Returns:
- the chart setup
- Throws:
Exception
- the exception
-
applyChanges
public void applyChanges(ChartSetup oldSetup, HashMap<String,Object> settingsMap) throws com.strategyquant.datalib.data.DataException, ParseException- Throws:
com.strategyquant.datalib.data.DataException
ParseException
-