def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.globals.potentialRuleMatches = None pyswing.globals.equityCount = None pyswing.database.overrideDatabase("output/TestMarketRule.db") pyswing.constants.pySwingStartDate = datetime.datetime(2014, 1, 1) deleteFile(pyswing.database.pySwingDatabase) args = "-n %s" % ("unitTesting") createDatabase(args.split()) pretendDate = datetime.datetime(2015, 9, 1) with patch.object(Equity, '_getTodaysDate', return_value=pretendDate) as mock_method: self._equity = Equity("WOR.AX") self._equity.importData() indicatorADI = IndicatorADI() indicatorADI.updateIndicator() self.rule = MarketRule("Indicator_ADI", "ADI > 0") self.rule.evaluateRule()
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.globals.potentialRuleMatches = None pyswing.globals.equityCount = None pyswing.database.overrideDatabase("output/TestStrategy.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) copyFile(pyswing.database.pySwingTestDatabase, pyswing.database.pySwingDatabase) twoRuleStrategy = Strategy( "Rule Equities Indicator_BB20 abs(t1.Close - t2.upperband) < abs(t1.Close - t2.middleband)", "Rule Equities abs(Close - High) * 2 < abs(Close - Low)", "Exit TrailingStop3.0 RiskRatio2", "Buy") twoRuleStrategy.evaluateTwoRuleStrategy() threeRuleStrategy = Strategy( "Rule Equities Indicator_BB20 abs(t1.Close - t2.upperband) < abs(t1.Close - t2.middleband)", "Rule Equities abs(Close - High) * 2 < abs(Close - Low)", "Exit TrailingStop3.0 RiskRatio2", "Buy", "Rule Indicator_RSI RSI > 20") threeRuleStrategy.evaluateThreeRuleStrategy() historicTrades = Strategy( "Rule Equities Indicator_BB20 abs(t1.Close - t2.upperband) < abs(t1.Close - t2.middleband)", "Rule Equities abs(Close - High) * 2 < abs(Close - Low)", "Exit TrailingStop3.0 RiskRatio2", "Buy", "Rule Indicator_RSI RSI > 20") historicTrades.generateHistoricTrades()
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.globals.potentialRuleMatches = None pyswing.globals.equityCount = None pyswing.database.overrideDatabase("output/TestDatabase.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) deleteFile(pyswing.database.pySwingTestDatabase) args = "-n %s" % ("unitTesting") createDatabase(args.split()) pretendDate = datetime.datetime(2015, 7, 1) with patch.object(Equity, '_getTodaysDate', return_value=pretendDate) as mock_method: args = "-n unitTest".split() importData(args) args = "-n unitTest".split() updateIndicators(args) args = "-n unitTest".split() evaluateRules(args) args = "-n unitTest".split() analyseRules(args) args = "-n unitTest".split() calculateExitValues(args)
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.database.overrideDatabase("output/TestUpdateIndicators.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) args = "-n %s" % ("unitTesting") createDatabase(args.split())
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.database.overrideDatabase("output/TestCalculateExitValues.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) args = "-n %s" % ("unitTesting") createDatabase(args.split())
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.globals.potentialRuleMatches = None pyswing.globals.equityCount = None pyswing.database.overrideDatabase("output/TestAnalyseStrategies.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) copyFile(pyswing.database.pySwingTestDatabase, pyswing.database.pySwingDatabase)
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.globals.potentialRuleMatches = None pyswing.globals.equityCount = None pyswing.database.overrideDatabase("output/TestAskHorse.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) copyFile(pyswing.database.pySwingTestDatabase, pyswing.database.pySwingDatabase)
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.globals.potentialRuleMatches = None pyswing.globals.equityCount = None pyswing.database.overrideDatabase("output/TestAnalyseRules.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) args = "-n %s" % ("unitTesting") createDatabase(args.split())
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.database.overrideDatabase("output/TestRule.db") args = "-n %s" % ("unitTesting") createDatabase(args.split()) myRule = Rule("Rule - myRule") myRule._createTable() myOtherRule = Rule("Rule - myOtherRule") myOtherRule._createTable()
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.database.overrideDatabase("output/TestIndicatorDX.db") pyswing.constants.pySwingStartDate = datetime.datetime(2014, 1, 1) deleteFile(pyswing.database.pySwingDatabase) args = "-n %s" % ("unitTesting") createDatabase(args.split()) pretendDate = datetime.datetime(2015, 9, 1) with patch.object(Equity, '_getTodaysDate', return_value=pretendDate) as mock_method: self._equityCBA = Equity("CBA.AX") self._equityCBA.importData()
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.database.overrideDatabase("output/TestRelativeRule.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) args = "-n %s" % ("unitTesting") createDatabase(args.split()) pretendDate = datetime.datetime(2015, 9, 1) with patch.object(Equity, '_getTodaysDate', return_value=pretendDate) as mock_method: self._equityCBA = Equity("WOR.AX") self._equityCBA.importData()
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() pyswing.globals.potentialRuleMatches = None pyswing.globals.equityCount = None pyswing.database.overrideDatabase("output/TestStrategy.db") pyswing.constants.pySwingStartDate = datetime.datetime(2015, 1, 1) deleteFile(pyswing.database.pySwingDatabase) copyFile(pyswing.database.pySwingTestDatabase, pyswing.database.pySwingDatabase) twoRuleStrategy = Strategy("Rule Equities Indicator_BB20 abs(t1.Close - t2.upperband) < abs(t1.Close - t2.middleband)", "Rule Equities abs(Close - High) * 2 < abs(Close - Low)", "Exit TrailingStop3.0 RiskRatio2", "Buy") twoRuleStrategy.evaluateTwoRuleStrategy() threeRuleStrategy = Strategy("Rule Equities Indicator_BB20 abs(t1.Close - t2.upperband) < abs(t1.Close - t2.middleband)", "Rule Equities abs(Close - High) * 2 < abs(Close - Low)", "Exit TrailingStop3.0 RiskRatio2", "Buy", "Rule Indicator_RSI RSI > 20") threeRuleStrategy.evaluateThreeRuleStrategy() historicTrades = Strategy("Rule Equities Indicator_BB20 abs(t1.Close - t2.upperband) < abs(t1.Close - t2.middleband)", "Rule Equities abs(Close - High) * 2 < abs(Close - Low)", "Exit TrailingStop3.0 RiskRatio2", "Buy", "Rule Indicator_RSI RSI > 20") historicTrades.generateHistoricTrades()
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory() self._market = Market("resources/asx.txt")
def setUpClass(self): Logger.pushLogData("unitTesting", __name__) forceWorkingDirectory()