Local-only or cloud-hosted Streamlit application for:
- Index selection (NIFTY 50 / Next 50 / IT / Pharma, extendable)
- Data ingestion and caching (CSV upload + pluggable providers)
- Dip-SIP trigger generation (daily band-entry) + cash bucket tracking
- Backtest comparison vs Standard SIP (terminal value + XIRR)
- Exports (ledger CSV + summary JSON)
- User authentication (login/logout)
- Supabase storage (persistent online) or SQLite (local-only)
git clone -b dev https://github.com/v-bansal/dip_sip.git
cd dip_sip
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# Copy and configure secrets (optional for local SQLite)
cp .streamlit/secrets.toml.example .streamlit/secrets.toml
# Edit .streamlit/secrets.toml and set auth_cookie_key
streamlit run app.pyDefault login (change in config/credentials.yaml):
- Username:
admin| Password:admin123 - Username:
viewer| Password:viewer123
- Go to supabase.com → New project
- Open SQL Editor → paste
storage/supabase_schema.sql→ Run - Go to Settings → API → copy
URLandanon publickey
- Go to share.streamlit.io
- New app → Select
v-bansal/dip_sip, branchdev, fileapp.py - Click Advanced settings → Secrets → paste:
auth_cookie_name = "dip_sip_auth" auth_cookie_key = "your_random_32char_key" # Generate: python -c "import secrets; print(secrets.token_hex(16))" auth_cookie_expiry_days = 30 SUPABASE_URL = "https://xxx.supabase.co" SUPABASE_KEY = "your-anon-key"
- Deploy → Your app is live with authentication + persistent storage
The app expects daily data with:
- Date (YYYY-MM-DD)
- Close (index level; TRI preferred)
Use the Data Manager page to upload CSV and save it into the cache.
- Runs on your Mac/laptop
- Data stored in
./data/cache.sqlite - No internet needed after setup
- Runs on Streamlit Cloud
- Data stored in Supabase Postgres (persistent across deploys)
- Access from anywhere
- Multi-user capable
The app automatically uses:
- Supabase if
SUPABASE_URLexists in.streamlit/secrets.toml - SQLite otherwise (local development)
Edit config/credentials.yaml. Generate bcrypt hashes:
python -c "import bcrypt; print(bcrypt.hashpw('yourpassword'.encode(), bcrypt.gensalt()).decode())"Add to config/credentials.yaml:
credentials:
usernames:
newuser:
email: [email protected]
name: New User
password: $2b$12$... # bcrypt hash- ✅ CSV upload — works offline (implemented)
- 🚧 NIFTY Indices download — stub (implement in
providers/niftyindices.py) - 🚧 NSE Historical Index — stub (implement in
providers/nse.py) - 🚧 SmartAPI / Breeze — stubs (for broker APIs)
prices(normalized daily series)runs(backtest runs + parameters)ledgers(day-by-day ledger for a run)
Same schema, created via storage/supabase_schema.sql
| Path | What it is |
|---|---|
app.py |
Main dashboard with auth |
pages/01_Data_Manager.py |
CSV upload → cache |
pages/02_Run_Viewer.py |
Saved run viewer |
core/engine.py |
Backtest engine |
storage/cache.py |
SQLite adapter |
storage/supabase_cache.py |
Supabase adapter |
storage/cache_factory.py |
Auto-selects SQLite or Supabase |
config/credentials.yaml |
User logins (bcrypt hashed) |
config/index_registry.yaml |
Index list |
config/defaults.yaml |
Strategy defaults |
| Problem | Fix |
|---|---|
ModuleNotFoundError: streamlit_authenticator |
Run pip install -r requirements.txt |
KeyError: 'auth_cookie_key' |
Create .streamlit/secrets.toml from example |
| Login fails | Check config/credentials.yaml passwords |
| Problem | Fix |
|---|---|
Unable to connect to Supabase |
Check SUPABASE_URL and SUPABASE_KEY in secrets |
| Tables don't exist | Run storage/supabase_schema.sql in Supabase SQL Editor |
| Data not persisting | Confirm you're using Supabase, not SQLite |
- Change default passwords in
config/credentials.yaml - Deploy to Streamlit Cloud with Supabase
- Implement auto-fetch providers (
niftyindices.pyornse.py) - Add more indices in
config/index_registry.yaml - Customize strategy defaults in
config/defaults.yaml