Example #1
0
    def profit_total_percent(self):
        """ Returns the percent of the profit of this operation based on the total
        equity.
        :returns: Deciamal with the percentage

        """
        profit = self.profit()

        if profit:
            return Decimal(
                support_system_formulas.calculate_percentage(
                    profit, self.account.total_equity()))
Example #2
0
    def stock_profit_total_percent(self):
        """ Returns the total percent result of the stock, based on the total
        equity.
        :returns: Decimal with the total percent

        """
        stock_profit = self.stock_profit

        if stock_profit:
            return Decimal(
                support_system_formulas.calculate_percentage(
                    stock_profit(), self.account.total_equity()))
Example #3
0
    def stop_loss_total_percent(self):
        """ Returns the percentage of the stop loss based on the total equity
        (equity + stocks owned)

        :returns: Decimal with total percent

        """
        stop_loss = self.stop_loss_result()

        if stop_loss:
            return Decimal(
                support_system_formulas.calculate_percentage(
                    stop_loss, self.account.total_equity()))
Example #4
0
    def shark(self):
        sells = SellData.objects.filter(archived=False).filter(executed=False)
        shark = 0

        for sell in sells:
            stop_loss = 0
            if sell.stop_loss:
                stop_loss = sell.stop_loss
            gain_percent = sell.calculate_gain(stop_loss, sell.buy.price)
            if gain_percent < 0:
                shark = (support_system_formulas.calculate_percentage(
                    gain_percent, sell.account.total_equity()) * -1) + shark

        risk_data = RiskData(round(shark, 2))
        return risk_data
Example #5
0
 def stop_loss_total_percent(self):
     stop_loss_result = self.stop_loss_result()
     if stop_loss_result:
         return Decimal(support_system_formulas.calculate_percentage(stop_loss_result,
                        self.account.total_equity()))
Example #6
0
    def target_gain_total_percent(self):
        target_value = self.target_gain()

        if target_value:
            return Decimal(support_system_formulas.calculate_percentage(target_value, self.account.total_equity()))
Example #7
0
 def experience_total_gain_percent(self):
     gain = self.experience_gain()
     return Decimal(support_system_formulas.calculate_percentage(gain, self.account.total_equity()))
Example #8
0
    def stock_result_total_percent(self, owner=None):
        stock_result = self.stock_result(owner=owner)

        if stock_result:
            return Decimal(support_system_formulas.calculate_percentage(stock_result,
                                                                        default_account().total_equity()))