예제 #1
0
 def setUpTestData(cls):
     cache.clear()
     create_test_user(cls)
     create_auth(cls, cls.user)
     create_account(cls)
     create_stocks(cls)
     create_operations(cls, cls.stock, cls.user)
예제 #2
0
 def setUpTestData(cls):
     create_test_user(cls)
     create_auth(cls, cls.user)
     create_account(cls)
     create_stocks(cls)
     create_operations(cls, cls.stock, cls.user)
     create_ir_operations(cls, cls.stock2, cls.user)
     create_day_trades(cls, cls.stock2, cls.user)
예제 #3
0
    def test_sell_fields(self):
        create_operations(self, self.stock, self.user)

        self.assertEqual("{0:.2f}".format(self.sell1.result()), "148.94")
        self.assertEqual("{0:.2f}".format(self.sell1.profit()), "185.98")
        self.assertEqual("{0:.2f}".format(self.sell1.profit_percent()),
                         "20.51")
        self.assertEqual("{0:.2f}".format(self.sell1.sell_value()), "1092.64")
        self.assertEqual("{0:.2f}".format(self.sell1.gain_percent()), "14.97")
예제 #4
0
 def test_remaining_gain(self):
     create_operations(self, self.stock, self.user)
     self.assertEqual("1989.35",
                      "{0:.2f}".format(self.buy3.remaining_gain()))
     self.assertEqual("0.00", "{0:.2f}".format(self.buy2.remaining_gain()))
 def test_av_price(self):
     create_operations(self, self.stock, self.user)
     experience = ExperienceData.objects.get(pk=self.experience.pk)
     self.assertEqual('-33.39',
                      "{0:.2f}".format(experience.target_gain_percent()))
 def test_target_percentage(self):
     create_operations(self, self.stock, self.user)
     experience = ExperienceData.objects.get(pk=self.operation.pk)
     self.assertEqual(
         '30.02', "{0:.2f}".format(experience.operation_average_price()))
 def test_total_percentage_experiment(self):
     create_operations(self, self.stock, self.user)
     experience = ExperienceData.objects.get(pk=self.operation.pk)
     self.assertEqual(
         '-9.96',
         "{0:.2f}".format(experience.experience_total_gain_percent()))
 def test_experiment_default(self):
     create_operations(self, self.stock, self.user)
     self.assertEqual('None', str(self.operation.target_gain_percent()))
예제 #9
0
 def test_shark(self):
     create_operations(self, self.stock, self.user)
     self.assertEqual('-720.01', str(self.sell3.stop_loss_result()))
     self.assertEqual('0.72', str(SellData.solds.shark().shark))
예제 #10
0
    def test_total_profit(self):
        report = Report()
        create_operations(self, self.stock, self.user)

        self.assertEqual("{0:.2f}".format(report.total_profit()), "665.96")