Set up the complete Python environment for OpenAlgo indicator analysis, charting, and dashboard development.
Arguments
- $0 = Python version (optional, default: python3 ). Examples: python3.12 , python3.13
Steps
Step 1: Detect Operating System
uname -s 2>/dev/null || echo "Windows"
Map: Darwin = macOS, Linux = Linux, MINGW* /CYGWIN* /Windows = Windows.
Step 2: Create Virtual Environment
macOS / Linux:
python3 -m venv venv source venv/bin/activate pip install --upgrade pip
Windows:
python -m venv venv venv\Scripts\activate pip install --upgrade pip
If user specified a Python version argument, use that instead of python3 .
Step 3: Install Python Packages
Install all required packages:
pip install openalgo yfinance plotly dash dash-bootstrap-components streamlit numba numpy pandas python-dotenv websocket-client httpx scipy nbformat matplotlib seaborn ipywidgets
Step 4: Create Project Folders
Create only the top-level directories. Subdirectories are created on-demand by other skills.
mkdir -p charts dashboards custom_indicators scanners
Step 5: Configure .env File
5a. Ask the user for their OpenAlgo API key using AskUserQuestion:
- "Enter your OpenAlgo API key (from the OpenAlgo dashboard at /apikey):"
5b. Ask for the OpenAlgo host URL:
-
Default: http://127.0.0.1:5000
-
If user has a custom domain or ngrok URL, use that
5c. Optionally ask about WebSocket URL:
-
Default: derived from host automatically
-
Only needed if user has a custom WebSocket setup
5d. Write the .env file in the project root:
OpenAlgo API Configuration
OPENALGO_API_KEY={user_provided_key or "your_openalgo_api_key_here"} OPENALGO_HOST={user_provided_host or "http://127.0.0.1:5000"}
WebSocket (optional - auto-derived from host if not set)
OPENALGO_WS_URL=ws://127.0.0.1:8765
5e. Add .env to .gitignore :
grep -qxF '.env' .gitignore 2>/dev/null || echo '.env' >> .gitignore
Step 6: Verify Installation
python -c " import openalgo from openalgo import ta import plotly import dash import streamlit import numba import numpy as np import pandas as pd import yfinance as yf import matplotlib import seaborn import nbformat from dotenv import load_dotenv print('All packages installed successfully') print(f' openalgo: {openalgo.version}') print(f' plotly: {plotly.version}') print(f' dash: {dash.version}') print(f' streamlit: {streamlit.version}') print(f' numba: {numba.version}') print(f' numpy: {np.version}') print(f' pandas: {pd.version}') print(f' matplotlib: {matplotlib.version}') print(f' seaborn: {seaborn.version}')
Quick indicator test
close = np.array([100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 104.0, 103.0, 102.0, 101.0]) ema = ta.ema(close, 3) rsi = ta.rsi(close, 5) print(f' ta.ema test: {ema[-1]:.2f}') print(f' ta.rsi test: {rsi[-1]:.2f}') print('Indicator library ready') "
Step 7: Print Summary
Print a summary showing:
-
Detected OS
-
Python version used
-
Virtual environment path
-
Installed packages and versions
-
Project folders created
-
.env file status
-
Available skills: /indicator-chart , /custom-indicator , /indicator-dashboard , /indicator-scanner , /live-feed
Important Notes
-
Never install packages globally — always use the virtual environment
-
If the user already has a virtual environment, ask before creating a new one
-
NEVER commit .env files — they contain API keys
-
python-dotenv is used by all scripts to load .env via find_dotenv()
-
The openalgo library includes Numba-optimized indicators that compile on first use