Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Fetch daily multi-ticker stock data with RSI, Bollinger Bands, Stochastic, and BUY/HOLD/SELL signals.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
App-Plan.md
1# StockPulse - Commercial Product Roadmap23## Vision45Transform the stock-analysis skill into **StockPulse**, a commercial mobile app for retail investors with AI-powered stock and crypto analysis, portfolio tracking, and personalized alerts.67## Technical Decisions89- **Mobile:** Flutter (iOS + Android cross-platform)10- **Backend:** Python FastAPI on AWS (ECS/Lambda)11- **Database:** PostgreSQL (RDS) + Redis (ElastiCache)12- **Auth:** AWS Cognito or Firebase Auth13- **Monetization:** Freemium + Subscription ($9.99/mo or $79.99/yr)1415---1617## Architecture Overview1819```20┌─────────────────────────────────────────────────────────────────┐21│ MOBILE APP (Flutter) │22│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │23│ │Dashboard │ │Portfolio │ │ Analysis │ │ Alerts │ │24│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │25└─────────────────────────────────────────────────────────────────┘26│ HTTPS/REST27▼28┌─────────────────────────────────────────────────────────────────┐29│ API GATEWAY (AWS) │30│ Rate Limiting, Auth, Caching │31└─────────────────────────────────────────────────────────────────┘32│33▼34┌─────────────────────────────────────────────────────────────────┐35│ BACKEND (FastAPI on ECS) │36│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │37│ │ Auth Service │ │ Analysis API │ │ Portfolio API│ │38│ └──────────────┘ └──────────────┘ └──────────────┘ │39│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │40│ │ Alerts Svc │ │ Subscription │ │ User Service │ │41│ └──────────────┘ └──────────────┘ └──────────────┘ │42└─────────────────────────────────────────────────────────────────┘43│44┌─────────────────────┼─────────────────────┐45▼ ▼ ▼46┌──────────────┐ ┌──────────────┐ ┌──────────────┐47│ PostgreSQL │ │ Redis │ │ S3 │48│ (RDS) │ │ (ElastiCache)│ │ (Reports) │49└──────────────┘ └──────────────┘ └──────────────┘5051BACKGROUND WORKERS (Lambda/ECS)52┌─────────────────────────────────────────────────────────────────┐53│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │54│ │Price Updater │ │Alert Checker │ │Daily Reports │ │55│ │ (5 min) │ │ (1 min) │ │ (Daily) │ │56│ └──────────────┘ └──────────────┘ └──────────────┘ │57└─────────────────────────────────────────────────────────────────┘58```5960---6162## Feature Tiers6364### Free Tier65- 1 portfolio (max 10 assets)66- Basic stock/crypto analysis67- Daily market summary68- Limited to 5 analyses/day69- Ads displayed7071### Premium ($9.99/mo)72- Unlimited portfolios & assets73- Full 8-dimension analysis74- Real-time price alerts75- Push notifications76- Period reports (daily/weekly/monthly)77- No ads78- Priority support7980### Pro ($19.99/mo) - Future81- API access82- Custom watchlists83- Advanced screeners84- Export to CSV/PDF85- Portfolio optimization suggestions8687---8889## Development Phases9091### Phase 1: Backend API9293**Goal:** Convert Python scripts to production REST API9495#### Tasks:961. **Project Setup**97- FastAPI project structure98- Docker containerization99- CI/CD pipeline (GitHub Actions)100- AWS infrastructure (Terraform)1011022. **Core API Endpoints**103```104POST /auth/register105POST /auth/login106POST /auth/refresh107108GET /analysis/{ticker}109POST /analysis/batch110111GET /portfolios112POST /portfolios113PUT /portfolios/{id}114DELETE /portfolios/{id}115116GET /portfolios/{id}/assets117POST /portfolios/{id}/assets118PUT /portfolios/{id}/assets/{ticker}119DELETE /portfolios/{id}/assets/{ticker}120121GET /portfolios/{id}/performance?period=weekly122GET /portfolios/{id}/summary123124GET /alerts125POST /alerts126DELETE /alerts/{id}127128GET /user/subscription129POST /user/subscription/upgrade130```1311323. **Database Schema**133```sql134users (id, email, password_hash, created_at, subscription_tier)135portfolios (id, user_id, name, created_at, updated_at)136assets (id, portfolio_id, ticker, asset_type, quantity, cost_basis)137alerts (id, user_id, ticker, condition, threshold, enabled)138analysis_cache (ticker, data, expires_at)139subscriptions (id, user_id, stripe_id, status, expires_at)140```1411424. **Refactor Existing Code**143- Extract `analyze_stock.py` into modules:144- `analysis/earnings.py`145- `analysis/fundamentals.py`146- `analysis/sentiment.py`147- `analysis/crypto.py`148- `analysis/market_context.py`149- Add async support throughout150- Implement proper caching (Redis)151- Rate limiting per user tier152153#### Files to Create:154```155backend/156├── app/157│ ├── main.py # FastAPI app158│ ├── config.py # Settings159│ ├── models/ # SQLAlchemy models160│ ├── schemas/ # Pydantic schemas161│ ├── routers/ # API routes162│ │ ├── auth.py163│ │ ├── analysis.py164│ │ ├── portfolios.py165│ │ └── alerts.py166│ ├── services/ # Business logic167│ │ ├── analysis/ # Refactored from analyze_stock.py168│ │ ├── portfolio.py169│ │ └── alerts.py170│ └── workers/ # Background tasks171├── tests/172├── Dockerfile173├── docker-compose.yml174└── requirements.txt175```176177---178179### Phase 2: Flutter Mobile App180181**Goal:** Build polished cross-platform mobile app182183#### Screens:1841. **Onboarding** - Welcome, feature highlights, sign up/login1852. **Dashboard** - Market overview, portfolio summary, alerts1863. **Analysis** - Search ticker, view full analysis, save to portfolio1874. **Portfolio** - List portfolios, asset breakdown, P&L chart1885. **Alerts** - Manage price alerts, notification settings1896. **Settings** - Account, subscription, preferences190191#### Key Flutter Packages:192```yaml193dependencies:194flutter_bloc: ^8.0.0 # State management195dio: ^5.0.0 # HTTP client196go_router: ^12.0.0 # Navigation197fl_chart: ^0.65.0 # Charts198firebase_messaging: ^14.0.0 # Push notifications199in_app_purchase: ^3.0.0 # Subscriptions200shared_preferences: ^2.0.0201flutter_secure_storage: ^9.0.0202```203204#### App Structure:205```206lib/207├── main.dart208├── app/209│ ├── routes.dart210│ └── theme.dart211├── features/212│ ├── auth/213│ │ ├── bloc/214│ │ ├── screens/215│ │ └── widgets/216│ ├── dashboard/217│ ├── analysis/218│ ├── portfolio/219│ ├── alerts/220│ └── settings/221├── core/222│ ├── api/223│ ├── models/224│ └── utils/225└── shared/226└── widgets/227```228229---230231### Phase 3: Infrastructure & DevOps232233**Goal:** Production-ready cloud infrastructure234235#### AWS Services:236- **ECS Fargate** - Backend containers237- **RDS PostgreSQL** - Database238- **ElastiCache Redis** - Caching239- **S3** - Static assets, reports240- **CloudFront** - CDN241- **Cognito** - Authentication242- **SES** - Email notifications243- **SNS** - Push notifications244- **CloudWatch** - Monitoring245- **WAF** - Security246247#### Terraform Modules:248```249infrastructure/250├── main.tf251├── variables.tf252├── modules/253│ ├── vpc/254│ ├── ecs/255│ ├── rds/256│ ├── elasticache/257│ └── cognito/258└── environments/259├── dev/260├── staging/261└── prod/262```263264#### Estimated Monthly Costs (Production):265| Service | Est. Cost |266|---------|-----------|267| ECS Fargate (2 tasks) | $50-100 |268| RDS (db.t3.small) | $30-50 |269| ElastiCache (cache.t3.micro) | $15-25 |270| S3 + CloudFront | $10-20 |271| Other (Cognito, SES, etc.) | $20-30 |272| **Total** | **$125-225/mo** |273274---275276### Phase 4: Payments & Subscriptions277278**Goal:** Integrate Stripe for subscriptions279280#### Implementation:2811. Stripe subscription products (Free, Premium, Pro)2822. In-app purchase for iOS/Android2833. Webhook handlers for subscription events2844. Grace period handling2855. Receipt validation286287#### Stripe Integration:288```python289# Backend webhook handler290@router.post("/webhooks/stripe")291async def stripe_webhook(request: Request):292event = stripe.Webhook.construct_event(...)293294if event.type == "customer.subscription.updated":295update_user_tier(event.data.object)296elif event.type == "customer.subscription.deleted":297downgrade_to_free(event.data.object)298```299300---301302### Phase 5: Push Notifications & Alerts303304**Goal:** Real-time price alerts and notifications305306#### Alert Types:307- Price above/below threshold308- Percentage change (daily)309- Earnings announcement310- Breaking news (geopolitical)311- Portfolio performance312313#### Implementation:314- Firebase Cloud Messaging (FCM)315- Background worker checks alerts every minute316- Rate limit: max 10 alerts/day per free user317318---319320### Phase 6: Analytics & Monitoring321322**Goal:** Track usage, errors, business metrics323324#### Tools:325- **Mixpanel/Amplitude** - Product analytics326- **Sentry** - Error tracking327- **CloudWatch** - Infrastructure metrics328- **Custom dashboard** - Business KPIs329330#### Key Metrics:331- DAU/MAU332- Conversion rate (free → premium)333- Churn rate334- API response times335- Analysis accuracy feedback336337---338339## Security Considerations3403411. **Authentication**342- JWT tokens with refresh rotation343- OAuth2 (Google, Apple Sign-In)344- 2FA optional for premium users3453462. **Data Protection**347- Encrypt PII at rest (RDS encryption)348- TLS 1.3 for all API traffic349- No plaintext passwords3503513. **API Security**352- Rate limiting per tier353- Input validation (Pydantic)354- SQL injection prevention (SQLAlchemy ORM)355- CORS configuration3563574. **Compliance**358- Privacy policy359- Terms of service360- GDPR data export/deletion361- Financial disclaimer (not investment advice)362363---364365## Risks & Mitigations366367| Risk | Impact | Mitigation |368|------|--------|------------|369| Yahoo Finance rate limits | High | Implement caching, use paid API fallback |370| App store rejection | Medium | Follow guidelines, proper disclaimers |371| Data accuracy issues | High | Clear disclaimers, data validation |372| Security breach | Critical | Security audit, penetration testing |373| Low conversion rate | Medium | A/B testing, feature gating |374375---376377## Success Metrics (Year 1)378379| Metric | Target |380|--------|--------|381| App downloads | 10,000+ |382| DAU | 1,000+ |383| Premium subscribers | 500+ |384| Monthly revenue | $5,000+ |385| App store rating | 4.5+ stars |386| Churn rate | <5%/month |387388---389390## Next Steps (Immediate)3913921. **Validate idea** - User interviews, landing page3932. **Design** - Figma mockups for key screens3943. **Backend MVP** - Core API endpoints3954. **Flutter prototype** - Basic app with analysis feature3965. **Beta testing** - TestFlight/Google Play beta397398---399400## Repository Structure (Final)401402```403stockpulse/404├── backend/ # FastAPI backend405│ ├── app/406│ ├── tests/407│ ├── Dockerfile408│ └── requirements.txt409├── mobile/ # Flutter app410│ ├── lib/411│ ├── test/412│ ├── ios/413│ ├── android/414│ └── pubspec.yaml415├── infrastructure/ # Terraform416│ ├── modules/417│ └── environments/418├── docs/ # Documentation419│ ├── api/420│ └── architecture/421└── scripts/ # Utility scripts422```423424---425426## Timeline Summary (Planning Only)427428| Phase | Duration | Dependencies |429|-------|----------|--------------|430| 1. Backend API | 4-6 weeks | - |431| 2. Flutter App | 6-8 weeks | Phase 1 |432| 3. Infrastructure | 2-3 weeks | Phase 1 |433| 4. Payments | 2 weeks | Phase 2, 3 |434| 5. Notifications | 2 weeks | Phase 2, 3 |435| 6. Analytics | 1 week | Phase 2 |436| **Total** | **17-22 weeks** | |437438This is a planning document. No fixed timeline - execute phases as resources allow.439440---441442**Disclaimer:** This tool is for informational purposes only and does NOT constitute financial advice.443