interactive_brokers_portfolio.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Odin 作者: JamesBrofos 项目源码 文件源码
def process_fill_event(self, fill_event):
        """Extension of abstract base class method. The extension implements the
        capability to send email notifications when fill events are received.
        """
        # Call super class method to handle the fill event.
        super(InteractiveBrokersPortfolio, self).process_fill_event(fill_event)

        # Send an email notification containing the details of the fill event.
        #
        # TODO: Would it be better to make server an instance variable so that we
        #       don't have to recreate it every time there's a fill event?
        if self.gmail_and_password is not None:
            server = smtplib.SMTP("smtp.gmail.com", 587)
            server.starttls()
            server.login(*self.gmail_and_pass)
            msg = MIMEText(str(fill_event), "plain", "utf-8")
            msg["From"] = msg["To"] = self.gmail_and_pass[0]
            msg["Subject"] = "Odin Trade Notification"
            server.sendmail(
                self.gmail_and_pass[0], self.gmail_and_pass[0], msg.as_string()
            )
            server.quit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号