Exemplo n.º 1
0
    def testTechnical_1(self):
        res = common.run_sample_module("technical-1")

        self.assertTrue(res.exit_ok(), res.get_output())
        lines = res.get_output_lines()
        self.assertEqual(lines,
                         common.head_file("technical-1.output", len(lines)))
Exemplo n.º 2
0
 def testTutorial4(self):
     with common.CopyFiles([os.path.join("testcases", "data", "WIKI-ORCL-2000-quandl.csv")], "."):
         res = common.run_sample_module("tutorial-4")
         lines = res.get_output_lines(True)
         self.assertEqual(
             common.head_file("tutorial-4.output", len(lines)),
             lines
         )
         self.assertTrue(res.exit_ok())
Exemplo n.º 3
0
    def testTechnical_1(self):
        res = common.run_sample_module("technical-1")

        self.assertTrue(res.exit_ok(), res.get_output())
        lines = res.get_output_lines()
        self.assertEqual(
            lines,
            common.head_file("technical-1.output", len(lines))
        )
Exemplo n.º 4
0
 def testTutorial3(self):
     with common.CopyFiles(
         [os.path.join("testcases", "data", "WIKI-ORCL-2000-quandl.csv")],
             "."):
         res = common.run_sample_module("tutorial-3")
         self.assertEqual(common.head_file("tutorial-3.output", 30),
                          res.get_output_lines(True)[:30], res.get_output())
         self.assertEqual(common.tail_file("tutorial-3.output", 3),
                          res.get_output_lines(True)[-3:], res.get_output())
         self.assertTrue(res.exit_ok())
Exemplo n.º 5
0
    def testSampleStrategyAnalyzer(self):
        with common.CopyFiles([os.path.join("testcases", "data", "orcl-2000-yahoofinance.csv")], "."):
            res = common.run_sample_module("sample-strategy-analyzer")

            self.assertTrue(res.exit_ok())
            lines = res.get_output_lines()
            self.assertGreaterEqual(len(lines), 20)
            self.assertEqual(
                lines,
                common.head_file("sample-strategy-analyzer.output", len(lines))
            )
Exemplo n.º 6
0
 def testTutorial3(self):
     with common.CopyFiles([os.path.join("testcases", "data", "WIKI-ORCL-2000-quandl.csv")], "."):
         res = common.run_sample_module("tutorial-3")
         self.assertEqual(
             common.head_file("tutorial-3.output", 30),
             res.get_output_lines(True)[:30]
         )
         self.assertEqual(
             common.tail_file("tutorial-3.output", 3),
             res.get_output_lines(True)[-3:]
         )
         self.assertTrue(res.exit_ok())
Exemplo n.º 7
0
    def testCompInv_1(self):
        files = [os.path.join("samples", "data", src) for src in [
            "WIKI-IBM-2011-quandl.csv",
            "WIKI-AES-2011-quandl.csv",
            "WIKI-AIG-2011-quandl.csv",
            "WIKI-ORCL-2011-quandl.csv",
        ]]

        with common.CopyFiles(files, "."):
            res = common.run_sample_module("compinv-1")

            self.assertTrue(res.exit_ok())
            # Skip the first two lines that have debug messages from the broker.
            lines = res.get_output_lines()
            self.assertEqual(
                lines,
                common.head_file("compinv-1.output", len(lines))
            )