mod.py 文件源码

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

项目:InplusTrader_Linux 作者: zhengwsh 项目源码 文件源码
def start_up(self, env, mod_config):
        self._env = env
        self._mod_config = mod_config

        env.event_bus.add_listener(EVENT.POST_BAR, self._output_feeds)

        output_path = mod_config.output_path

        filename = os.path.join(output_path, "portfolio.csv")
        new_file = False
        if not os.path.exists(filename):
            new_file = True
        self.csv_file = open(filename, 'a')
        fieldnames = ["datetime", "portfolio_value", "market_value", "total_returns"]
        self.csv_writer = csv.DictWriter(self.csv_file, fieldnames)
        if new_file:
            self.csv_writer.writeheader()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号