コード例 #1
0
ファイル: base.py プロジェクト: breyton/fastquant
    def stop(self):
        # Saving to self so it's accessible later during optimization
        self.final_value = self.broker.getvalue()
        self.pnl = round(self.final_value - self.init_cash, 2)
        print("Final Portfolio Value: {}".format(self.final_value))
        print("Final PnL: {}".format(self.pnl))
        self.order_history_df = pd.DataFrame(self.order_history)
        self.periodic_history_df = pd.DataFrame(self.periodic_history)

        last_date = str(self.datas[0].datetime.date(0))
        if self.channel:
            trigger_bot(
                self.symbol,
                self.action,
                last_date,
            )
コード例 #2
0
ファイル: base.py プロジェクト: waichung/fastquant
    def stop(self):
        # Saving to self so it's accessible later during optimization
        self.final_value = self.broker.getvalue()
        # Note that PnL is the final portfolio value minus the initial cash balance minus the total cash added
        self.pnl = round(self.final_value - self.init_cash - self.total_cash_added, 2)
        if self.strategy_logging:
            self.log("Final Portfolio Value: {}".format(self.final_value))
            self.log("Final PnL: {}".format(self.pnl))
        self.order_history_df = pd.DataFrame(self.order_history)
        self.periodic_history_df = pd.DataFrame(self.periodic_history)

        last_date = str(self.datas[0].datetime.date(0))
        if self.channel:
            trigger_bot(
                self.symbol, self.action, last_date,
            )