# Setup script for liang9733/finance_monitor on Windows (PowerShell), from https://gitmanual.com/liang9733/finance_monitor # Read it before you run it: the commands come from the repo's own README and files. # Run: powershell -ExecutionPolicy Bypass -File .\setup.ps1 $ErrorActionPreference = "Stop" function Write-Step($t) { Write-Host "`n==> $t" -ForegroundColor Cyan } # Windows ships a python that only opens the Microsoft Store; it doesn't count. function Have($c) { $cmd = Get-Command $c -ErrorAction SilentlyContinue; [bool]$cmd -and $cmd.Source -notlike '*\WindowsApps\*' } # New installs change PATH; pick it up without opening a new window. function Update-Path { $env:Path = [Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [Environment]::GetEnvironmentVariable("Path", "User") } # Stop when a program fails, like bash's set -e. Dot-sourced, so cd and venv activation carry on to the next step. function Invoke-Step([scriptblock]$Block) { $global:LASTEXITCODE = 0; . $Block; if ($LASTEXITCODE) { throw "Failed with exit code $LASTEXITCODE" } } Write-Step '1/4 Clone the repository' if (-not (Test-Path 'finance_monitor')) { Invoke-Step { git clone https://github.com/liang9733/finance_monitor.git } } Set-Location 'finance_monitor' Write-Step '2/4 Install the required tools' # Python 3, Node.js if (-not (Have 'python')) { Invoke-Step { winget install Python.Python.3.12 -e --accept-source-agreements --accept-package-agreements }; Update-Path } Invoke-Step { winget install OpenJS.NodeJS.LTS -e --accept-source-agreements --accept-package-agreements } Write-Step '3/4 Configure environment variables' # Fill in secrets: TELEGRAM_BOT_TOKEN, OPENAI_API_KEY, FINNHUB_API_KEY, ALPHAVANTAGE_API_KEY, TWELVEDATA_API_KEY, TUSHARE_TOKEN, TIINGO_API_KEY if (-not (Test-Path .env)) { Copy-Item .env.example .env; Write-Host 'Created .env. Fill in secrets: TELEGRAM_BOT_TOKEN, OPENAI_API_KEY, FINNHUB_API_KEY, ALPHAVANTAGE_API_KEY, TWELVEDATA_API_KEY, TUSHARE_TOKEN, TIINGO_API_KEY in .env, then run this script again.'; exit 0 } Write-Step '4/4 Follow the README: Quick Start' # Run these in Git Bash (installed with Git) or WSL — not PowerShell. Do the README instructions above first. Invoke-Step { cp .env.example .env } # (needs Git Bash or WSL on Windows) chmod +x start.sh # (needs Git Bash or WSL on Windows) ./start.sh Invoke-Step { python3 -m venv venv } # (needs Git Bash or WSL on Windows) source venv/bin/activate Invoke-Step { pip install -r backend/requirements.txt } Invoke-Step { cd backend } Invoke-Step { python main.py } Invoke-Step { npm install } Write-Host 'Set up liang9733/finance_monitor.' Write-Host 'Fill in secrets: TELEGRAM_BOT_TOKEN, OPENAI_API_KEY, FINNHUB_API_KEY, ALPHAVANTAGE_API_KEY, TWELVEDATA_API_KEY, TUSHARE_TOKEN, TIINGO_API_KEY' Write-Host 'Next, from the project folder:' Write-Host ' npm run dev' Write-Host 'Manual: https://gitmanual.com/liang9733/finance_monitor'