首页 > 解决方案 > 在 Flask 应用程序中的视图 (html) 上显示 pyfolio 输出

问题描述

我想将 pyfoliopf.create_full_tear_sheet()输出显示到我的 Flask html 视图中,类似于jupyter/notebook所做的。

我可以pf.create_returns_tear_sheet(...,return_fig=True)用来保存图像并在视图中显示该图像,如下所示:

f = pf.create_returns_tear_sheet(returns=returns, positions=positions, transactions=tran,benchmark_rets=benchmark_returns,return_fig=True);
f.savefig('returns.png')

如何为create_full_tear_sheet()方法实现相同的效果?

标签: pythonmatplotlibflaskjupyter-notebookjupyter

解决方案


推荐阅读