{"id":22747437,"url":"https://github.com/mitchmedeiros/walk-forward-optimization-app","last_synced_at":"2025-04-14T11:40:33.423Z","repository":{"id":173199540,"uuid":"621629001","full_name":"MitchMedeiros/walk-forward-optimization-app","owner":"MitchMedeiros","description":"A backtesting web app for walk-forward optimization with common indicator strategies.","archived":false,"fork":false,"pushed_at":"2023-10-09T12:08:36.000Z","size":23475,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T00:45:07.819Z","etag":null,"topics":["apache2-httpd","mod-wsgi","plotly-dash","postgres","redis","vectorbt"],"latest_commit_sha":null,"homepage":"https://backtest.fi","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MitchMedeiros.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-03-31T03:49:43.000Z","updated_at":"2024-12-11T11:31:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"30011a91-15f6-4a8a-ba2a-1f4d197813ab","html_url":"https://github.com/MitchMedeiros/walk-forward-optimization-app","commit_stats":null,"previous_names":["mitchmedeiros/dashapp","mitchmedeiros/walk-forward-optimization-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MitchMedeiros%2Fwalk-forward-optimization-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MitchMedeiros%2Fwalk-forward-optimization-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MitchMedeiros%2Fwalk-forward-optimization-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MitchMedeiros%2Fwalk-forward-optimization-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MitchMedeiros","download_url":"https://codeload.github.com/MitchMedeiros/walk-forward-optimization-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248874209,"owners_count":21175791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache2-httpd","mod-wsgi","plotly-dash","postgres","redis","vectorbt"],"created_at":"2024-12-11T03:15:40.202Z","updated_at":"2025-04-14T11:40:33.385Z","avatar_url":"https://github.com/MitchMedeiros.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003eApp Description \u0026nbsp;\u0026nbsp;\n \u003ca href=\"https://pypi.org/project/vectorbt\" alt=\"Python Versions\"\u003e\n \u003cimg src=\"https://img.shields.io/pypi/pyversions/vectorbt.svg?logo=python\u0026logoColor=white\"\u003e\n \u003c/a\u003e\n\u003c/h1\u003e\n\n\u003ch1\u003eCore Dependencies\u003c/h1\u003e\n\nThe core dependencies are:\n\n\u003col\u003e\n \u003cli\u003eA compatible Python version (3.6-3.10)\u003c/li\u003e\n \u003cli\u003eTA-Lib (C library)\u003c/li\u003e\n \u003cli\u003ePython libraries in requirements.txt\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003ch2\u003eCloning This Repository\u003c/h2\u003e\n\n\nTo run this app locally you can simply clone this repository. Make sure you have\n\u003ca href=\"https://git-scm.com/book/en/v2/Getting-Started-Installing-Git\"\u003e\ngit installed\u003c/a\u003e.\nYou can confirm this on Linux or Mac by typing `git --version` in a terminal. Navigate to the directory you want the app in and use the command:\n\n```shell\ngit clone https://github.com/MitchMedeiros/dashapp.git\n```\n\n\u003ch2\u003eCreating the Virtual Environment\u003c/h2\u003e\n\nIf you have Anaconda installed you can create a virtual environment called \"backtesting\" using:\n\n```shell\nconda create -n backtesting python=3.10\n```\n\nand activate it with `conda activate backtesting`. Note what default directory it's installed in if you plan to web host the app.\n\nAlternately, you can use the Python venv module with the following command in the directory you want the environment in:\n\n```shell\npython3.10 -m venv backtesting\n```\n\nActivate it on Linux/Mac using: `source backtesting/bin/activate` or in Windows PowerShell: `backtesting\\Scripts\\activate`.\n\n\u003ch2\u003eTA-Lib\u003c/h2\u003e\n\nAt this point you should install the core TA-Lib library from source before you can install the TA-Lib Python library. This is necessary since the Python library is only a wrapper.\n\n\u003ch3\u003eTa-Lib Installation on Linux and Mac\u003c/h3\u003e\n\nIf you have a web browser available you can download the source file by visiting \u003ca href=\"https://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/ta-lib-0.4.0-src.tar.gz/download?use_mirror=phoenixnap\"\u003esoureforge\u003c/a\u003e.\n\nIf using a Linux server, install wget if not already installed, using the appropriate \n\u003ca href=\"https://www.maketecheasier.com/install-software-in-various-linux-distros/\"\u003e\ninstall command\u003c/a\u003e \nfor your Linux distro.\n\nFor Debian/Ubuntu:\n\n```shell\nsudo apt install wget\n```\n\nDownload the TA-Lib library from \n\u003ca href=\"https://sourceforge.net/projects/ta-lib/files/ta-lib/0.4.0/\"\u003e\n SourceForge\n\u003c/a\u003e\nusing \n\n```shell\nwget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz\n```\n\nOnce you have the tar file downloaded you should unpack it:\n\n```shell\ntar -xvf ta-lib-0.4.0-src.tar.gz\n```\n\nDelete the tar file and cd into the newly created folder.\n\n```shell\nrm ta-lib-0.4.0-src.tar.gz; cd ta-lib\n```\n\nNow we run the configure file on Debian/Ubuntu you should use the prefix /usr:\n\n```shell\n./configure --prefix=/usr\n```\n\nOn Mac the prefix /usr/local should be used:\n```shell\n./configure --prefix=/usr/local\n```\n\nRun the `make` command to compile the TA-Lib files.\\\nRun `sudo make install`, which will copy the compiled files into /usr/include/ta-lib.\n\n\u003ch2\u003erequirements.txt\u003c/h2\u003e\n\nAfter you've installed the core TA-Lib library, activate your virutal environment and navigate inside the app directory. Install the libraries in requirements.txt with pip:\n\n```shell\npip3 install -r requirements.txt\n```\n\nYou can now run the main.py file and visit \u003ca href=127.0.0.1:8050\u003e127.0.0.1:8050\u003c/a\u003e in a web browser to access the app.\n\n\u003ch1\u003eOptional Dependencies\u003c/h1\u003e\n\nThe optional dependencies to extend the functionality of this app are:\n\n\u003col\u003e\n \u003cli\u003ePostgreSQL database - for custom data\u003c/li\u003e\n \u003cli\u003eRedis database - for faster caching\u003c/li\u003e\n \u003cli\u003emod_wsgi - for web hosting\u003c/li\u003e\n \u003cli\u003eApache HTTP - for web hosting\u003c/li\u003e\n\u003c/ol\u003e\n\n\u003ch2\u003ePostgreSQL and Redis Databases\u003c/h2\u003e\n\nThe app hosted on \u003ca ahref=backtest.fi\u003ebacktest.fi\u003c/a\u003e utilizes a postgreSQL and Redis backend. However, the default configuration file when cloning this repository will use Yahoo Finance for data as well as the local file system for caching between Dash callbacks. If you have either or both databases installed you can connect them by simply providing your connection credentials in config.py, located in the parent directory of this repository.\n\n\u003ch2\u003eWSGI Setup for an Apache Server on Linux\u003c/h2\u003e\n\nThis section explains how to web host the app on a server. It assumes you have an Apache virtual host set up and linked to a domain name.\n\nYou should first install the Apache header files for third-party modules. If you have Apache 2.4 then on Debian/Ubuntu run:\n\n```shell\nsudo apt install apache2-dev\n```\n\nNow, with your Python virtual environment active:\n\n```shell\npip3 install mod-wsgi\n```\n\nLocate your newly created wsgi files with:\n\n```shell\nmod_wsgi-express module-config\n```\n\nand copy the output. Now create a new .load file in your /etc/apache2/mods-available directory and paste that output inside it\n\n```shell\nvim /etc/apache2/mods-available/wsgi.load\n```\n\n(If you're new to VIM press `i` to insert text, paste like normal, press `escape`, then `:wq` to save changes and exit. If you make a mistake press `escape` then `:q!` to exit without saving changes or creating a new file.)\n\nEnable the new mod with `a2enmod wsgi`.\n\nNavigate to the .config or .htaccess file (depending on your OS) that you have your virtual host information in. You'll need to add a `WSGIScriptAlias` specifying the location of the app.wsgi file.\n\nIf your site is only using HTTP, your virtual host info should look similar to the snippet below. Make sure to replace /path_to_cloned_repository with the appropriate path and yoursite.com with your domain name.\n\n```apache\n\u003cVirtualHost *:80\u003e\n    ServerName yoursite.com\n    ServerAlias www.yoursite.com\n\n    WSGIDaemonProcess dashapp python-home=your_python_virtual_env_directory user=www-data group=www-data\n\n    WSGIProcessGroup dashapp\n    WSGIApplicationGroup %{GLOBAL}\n\n    WSGIScriptAlias / /path_to_cloned_repository/dashapp/app.wsgi\n\n    \u003cDirectory /path_to_cloned_repository/dashapp/\u003e\n        Require all granted\n    \u003c/Directory\u003e\n\u003c/VirtualHost\u003e\n```\n\nIf your site is set up to use HTTPS via Let's Encrypt then your .config or .htaccess file should look like \n\n```apache\n\u003cVirtualHost *:80\u003e\n    ServerName yoursite.com\n    ServerAlias www.yoursite.com\n\n    RewriteEngine on\n    RewriteCond %{HTTPS} off\n    RewriteRule ^(.*)$ https://yoursite.com/$1 [L,R=301]\n\u003c/VirtualHost\u003e\n\n\u003cIfModule mod_ssl.c\u003e\n\u003cVirtualHost *:443\u003e\n    ServerName yoursite.com\n    ServerAlias www.yoursite.com\n\n    Include /etc/letsencrypt/options-ssl-apache.conf\n    SSLCertificateFile /etc/letsencrypt/live/yoursite.com/fullchain.pem\n    SSLCertificateKeyFile /etc/letsencrypt/live/yoursite.com/privkey.pem\n\n    WSGIDaemonProcess dashapp python-home=/path_to_your_virtual_environment user=www-data group=www-data\n\n    WSGIProcessGroup dashapp\n    WSGIApplicationGroup %{GLOBAL}\n\n    WSGIScriptAlias / /path_to_cloned_repository/dashapp/app.wsgi\n\n    \u003cDirectory /path_to_cloned_repository/dashapp/\u003e\n        Require all granted\n    \u003c/Directory\u003e\n\u003c/VirtualHost\u003e\n\u003c/IfModule\u003e\n```\n\nIf you've created a new .config file in one of your ...-available folders rather than adding to an existing file then you'll also need to activate it with the appropriate `a2ensite`, `a2enmod`, or `a2enconf` command.\n\nNow you will need to edit the app.wsgi file in the root directory of the repository. First change the shebang line at the top of the file to the location of your virtual environment and Python version:\n```python\n#!/path_to_your_virtual_environment/bin/python3.10\n```\nAlso changing the sys.path line shown below to the appropriate root directory for your app\n\n```python\nsys.path.insert(0,\"/path_to_cloned_repository/dashapp/\")\n```\n\nFinally, insure that the Apache user: www-data has sufficient file permissions. At a minimum the entire app directory should have the group as www-data with read permissions on all files and also execute permission for app.wsgi. You should add further write or execute permissions to files only as necessary. For security reasons, the directory should be owned by a user other than root.\n\nRestart Apache: `systemctl restart apache2` for all changes to take effect. The app should now be accessible through your domain name!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchmedeiros%2Fwalk-forward-optimization-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchmedeiros%2Fwalk-forward-optimization-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchmedeiros%2Fwalk-forward-optimization-app/lists"}