年化33.9%的稳健策略 | streamlit和dash驱动的智能量化投研(python代码+数据)
原创内容第836篇,专注智能量化投资、个人成长与财富自由。
aitrader5.0继续开发。
aitrader代码发布,支持双引擎。(代码+数据下载)
之前我们写过双引擎:streamlit+ dash,现在加一个引擎就是toga+pyecharts。
股票智能投研的界面:
通过main启动界面引擎:
from multiprocessing import Process import dash import toga from toga.constants import WindowState from toga.style import Pack from gui.tab_dashboard import create_dashboard from gui.tab_datadownload import create_tab from zvt.main import serve_layout class LabxApp(toga.App): def create_datas_tab(self): data_box = toga.Box() return data_box def create_tabs(self): webview = toga.WebView( url="http://www.ailabx.com/mall", # on_webview_load=self.on_webview_load, style=Pack(flex=1), ) streamlit_webview = toga.WebView( url="http://localhost:8501", # on_webview_load=self.on_webview_load, style=Pack(flex=1), ) dash_webview = toga.WebView( url="http://localhost:8050", # on_webview_load=self.on_webview_load, style=Pack(flex=1), ) tabs = [("策略优选", webview), ('ETF基金智能投研', streamlit_webview), ('股票智能投研', dash_webview), ("金融数据下载", create_tab()), ("市场看板", create_dashboard()) ] self.optioncontainer = toga.OptionContainer( content=tabs, style=Pack(margin_bottom=20, flex=1, margin=10) ) return self.optioncontainer def startup(self): """Construct and show the Toga application. Usually, you would add your application to a main content box. We then create a main window (with a name matching the app), and show the main window. """ main_box = toga.Box() self.main_window = toga.MainWindow(title=self.formal_name) self.main_window.content = self.create_tabs() self.main_window.show() self.main_window.state = WindowState.MAXIMIZED def main(): return LabxApp("aitrader_AI量化投资实验室", "com.ailabx",author = "飞狐", home_page = "http://www.ailabx.com") def run_streamlit(): import subprocess, os streamlit_file = os.path.join(os.path.dirname(__file__), 'gui', 'streamlit_main.py') p_restart = subprocess.Popen(["streamlit", "run", streamlit_file]) return p_restart from zvt.ui import zvt_app def run_dash(): zvt_app.layout = serve_layout zvt_app.run(port=8050) if __name__ == "__main__": # 启动 Streamlit p = run_streamlit() dash_process = Process(target=run_dash) dash_process.start() main().main_loop() p.kill() dash_process.kill()
吾日三省吾身
天下本无事,庸人自扰之。
大胆一点,世间是一个巨大的游乐场,勇敢去体验。
守好底线,认真生活。
代码和数据下载:AI量化实验室——2025量化投资的星辰大海
AI量化实验室 星球,已经运行三年多,1500+会员。
aitrader代码,因子表达式引擎、遗传算法(Deap)因子挖掘引擎等,支持vnpy,qlib,backtrader和bt引擎,内置多个年化30%+的策略,每周五迭代一次,代码和数据在星球全部开源。
扩展 • 历史文章
EarnMore(赚得更多)基于RL的投资组合管理框架:一致的股票表示,可定制股票池管理。(附论文+代码)
deap系统重构,再新增一个新的因子,年化39.1%,卡玛提升至2.76(附python代码)
aitrader_v4.6代码发布,支持duckdb|股票全量数据(python代码+数据)
年化19.66%,回撤12%的稳健策略|manus的启发:基于大模型多智能体的智能投研系统(python代码+数据)
年化30.24%,最大回撤19%,综合动量多因子评分策略再升级(python代码+数据)
年化18%-39.3%的策略集 | backtrader通过xtquant连接qmt实战