import%20marimo%0A%0A__generated_with%20%3D%20%220.13.15%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20shlex%0A%20%20%20%20import%20subprocess%0A%20%20%20%20import%20sys%0A%20%20%20%20from%20importlib%20import%20util%20as%20importlib_util%0A%20%20%20%20from%20pathlib%20import%20Path%0A%0A%20%20%20%20return%20Path%2C%20importlib_util%2C%20shlex%2C%20subprocess%2C%20sys%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%23%20StackSats%20model%20example%20notebook%0A%0A%20%20%20%20%20%20%20%20This%20notebook%20installs%20the%20package%20in%20the%20**current%20venv**%20and%20runs%20a%0A%20%20%20%20%20%20%20%20backtest%20using%20the%20packaged%20example%20strategy.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22Repository%20root%3A%20current%20working%20directory%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(Path%2C%20shlex%2C%20subprocess)%3A%0A%20%20%20%20def%20run_cmd(command%3A%20list%5Bstr%5D%2C%20*%2C%20env%3A%20dict%5Bstr%2C%20str%5D%20%7C%20None%20%3D%20None)%20-%3E%20int%3A%0A%20%20%20%20%20%20%20%20print(%22%24%20%22%20%2B%20%22%20%22.join(shlex.quote(arg)%20for%20arg%20in%20command))%0A%20%20%20%20%20%20%20%20completed%20%3D%20subprocess.run(%0A%20%20%20%20%20%20%20%20%20%20%20%20command%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20cwd%3DPath.cwd()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20env%3Denv%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20check%3DFalse%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20text%3DTrue%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20print(f%22%5Bexit%20code%3A%20%7Bcompleted.returncode%7D%5D%22)%0A%20%20%20%20%20%20%20%20return%20completed.returncode%0A%0A%20%20%20%20return%20(run_cmd%2C)%0A%0A%0A%40app.cell%0Adef%20_(mo%2C%20sys)%3A%0A%20%20%20%20in_venv%20%3D%20sys.prefix%20!%3D%20getattr(sys%2C%20%22base_prefix%22%2C%20sys.prefix)%0A%20%20%20%20py_version%20%3D%20f%22%7Bsys.version_info.major%7D.%7Bsys.version_info.minor%7D%22%0A%20%20%20%20mo.md(f%22Python%20version%3A%20%60%7Bpy_version%7D%60%20%20%5CnInside%20venv%3A%20%60%7B'yes'%20if%20in_venv%20else%20'no'%7D%60%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(importlib_util%2C%20run_cmd%2C%20sys)%3A%0A%20%20%20%20needs_stacksats%20%3D%20importlib_util.find_spec(%22stacksats%22)%20is%20None%0A%20%20%20%20needs_marimo%20%3D%20importlib_util.find_spec(%22marimo%22)%20is%20None%0A%0A%20%20%20%20if%20needs_stacksats%20or%20needs_marimo%3A%0A%20%20%20%20%20%20%20%20print(%22Installing%20missing%20dependencies%20into%20current%20venv...%22)%0A%20%20%20%20%20%20%20%20if%20needs_stacksats%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20run_cmd(%5Bsys.executable%2C%20%22-m%22%2C%20%22pip%22%2C%20%22install%22%2C%20%22-e%22%2C%20%22.%22%5D)%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(%22%60stacksats%60%20already%20installed%3B%20skipping.%22)%0A%20%20%20%20%20%20%20%20if%20needs_marimo%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20run_cmd(%5Bsys.executable%2C%20%22-m%22%2C%20%22pip%22%2C%20%22install%22%2C%20%22marimo%22%5D)%0A%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(%22%60marimo%60%20already%20installed%3B%20skipping.%22)%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20print(%22Dependencies%20already%20installed%3B%20skipping%20install%20step.%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(run_cmd)%3A%0A%20%20%20%20print(%221)%20Backtest%22)%0A%20%20%20%20strategy_spec%20%3D%20%22examples%2Fmodel_example.py%3AExampleMVRVStrategy%22%0A%20%20%20%20run_cmd(%0A%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22stacksats%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22strategy%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22backtest%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22--strategy%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20strategy_spec%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22--end-date%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%222026-01-31%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22--output-dir%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22output%22%2C%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%20Run%20the%20notebook%0A%0A%20%20%20%20%20%20%20%20From%20your%20active%20venv%20at%20repo%20root%3A%0A%0A%20%20%20%20%20%20%20%20%60%60%60bash%0A%20%20%20%20%20%20%20%20marimo%20edit%20examples%2Fmodel_example_notebook.py%0A%20%20%20%20%20%20%20%20%60%60%60%0A%0A%20%20%20%20%20%20%20%20Then%20run%20all%20cells%20from%20top%20to%20bottom.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
0d525aab36f40e25750ef25ecf94787a7df53d358e255e3db7c7cc7667338813