Technical Documentation
AlphaVault AI - Technical Documentation
Complete Platform Architecture & Implementation Guide
Platform Overview
About AlphaVault AI
AlphaVault AI is a premium financial intelligence platform combining real-time market data analysis, advanced predictive models powered by machine learning, and artificial intelligence to provide professional-grade financial insights for investors, analysts, and financial professionals.
Platform Statistics
Technology Stack
Core Features
| Feature | Description | Plan Required | Status |
|---|---|---|---|
| M&A Predictor | AI-powered SEC filings analysis (6 factors) to predict mergers & acquisitions probability | Platinum | Active |
| Insider Flow Tracker | Form 4 insider trading transactions tracking with 14 transaction classes and pattern detection | Platinum | Active |
| Trend Prediction | ML predictive analysis with 5 models (Linear Regression, Ridge, Lasso, Random Forest, LSTM) | Platinum | Active |
| Advanced Analysis | 14 Wall Street technical indicators (RSI, MACD, Bollinger, Fibonacci, Ichimoku, Pivot Points, ADX, Stochastic) | Pro | Active |
| Monte Carlo Simulation | Probabilistic portfolio simulations with 6 models (Normal, Student-t, Log-Normal, Jump Diffusion, Regime Switching, GARCH) | Free | Active |
| Risk Parity | Portfolio optimization by risk parity allocation with advanced rebalancing algorithms | Pro | Active |
| Investment Analytics | Multi-allocation portfolio analytics with backtesting, VaR, Sharpe ratio, and scenario analysis | Pro | Active |
| Forex Converter | 38 currencies with 14 Wall Street indicators, AI recommendations, and historical correlation matrix | Pro | Active |
| IPO Intelligence | AI IPO scoring with S-1 SEC document parsing and multi-criteria evaluation | Platinum | Active |
| Chatbot FinanceGPT | AI assistant powered by Gemini 2.5 Flash (8,192 tokens) with 3D robot interface | Free | Active |
| Community Hub | Social features (posts, comments, likes, messages) with real-time updates | Free | Active |
| YouTube Intelligence | Market analysis videos with AI categorization and sentiment detection | Platinum | Active |
Performance Metrics
Global Architecture
Distributed Serverless Architecture
AlphaVault AI uses a fully serverless architecture hosted on Cloudflare's global edge network, ensuring ultra-low latency (<50ms) for users worldwide. The platform leverages Firebase for authentication and data storage, Stripe for payment processing, and 10+ Cloudflare Workers for backend logic.
System Architecture Diagram
Desktop
Chrome, Safari, Edge
Mobile
iOS, Android
Tablet
iPad, Android Tablets
Cloudflare Pages
alphavault-ai.pages.dev
TLS 1.3 + Brotli Compression
HTML Pages
65 pages (10.53 MB)
CSS Styles
49 files (Glassmorphism)
JavaScript
112 files (Vanilla JS)
Firebase
Auth + Firestore + Storage
CF Workers
10+ Workers (Edge Compute)
Stripe
Payments + Subscriptions
Resend
Transactional Emails
Twelve Data
Market Data + Indicators
SEC EDGAR
SEC Filings (Form 4, S-1, 8-K)
Gemini AI
Gemini 2.5 Flash (8,192 tokens)
YouTube API
Market Videos (Quota: 10,000/day)
Communication Flow
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ALPHAVAULT AI - REQUEST FLOW โ
โ (User โ CDN โ Frontend โ Workers โ APIs) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1โฃ USER ACTION
โโ> User accesses: https://alphavault-ai.com/advanced-analysis
โข Browser: Chrome 130 (Desktop)
โข Location: New York, USA
โข Action: Search for stock symbol "AAPL"
2โฃ DNS RESOLUTION (Cloudflare DNS)
โโ> Query: alphavault-ai.com
โข TTL: 300 seconds
โข Response: 104.21.x.x (Cloudflare Edge IP)
โข Latency: ~8ms
3โฃ TLS HANDSHAKE (Cloudflare Edge)
โโ> Protocol: TLS 1.3
โข Cipher: AES-256-GCM
โข Certificate: Let's Encrypt (Auto-renewed)
โข Latency: ~12ms
4โฃ CLOUDFLARE PAGES (Static CDN)
โโ> Request: GET /advanced-analysis
โข Cache: HIT (Edge cached for 24h)
โข Compression: Brotli (78% size reduction)
โข Response Size: 42 KB (compressed from 190 KB)
โข Latency: ~18ms
โข Headers:
- CF-Cache-Status: HIT
- CF-Ray: 8d7e2f3a1b2c3d4e-JFK
- Server: cloudflare
5โฃ BROWSER RENDERING (Client-Side)
โโ> Parse HTML (42 KB)
โข Load CSS: advanced-analysis.css (132 KB)
โข Load JavaScript: advanced-analysis.js (4,292 lines)
โข Initialize Firebase SDK
โข Execute: auth-guard.js (Check authentication)
โข Execute: access-control.js (Verify plan: Pro โ
)
โข Render UI: 14 chart containers + search form
โข Total Load Time: ~350ms
6โฃ USER SEARCHES SYMBOL "AAPL"
โโ> JavaScript Call: analyzeSymbol('AAPL')
โข Function: advanced-analysis.js (line 1247)
โข API Client: api-client.js (FinanceAPIClient class)
โข Parallel Requests: 4
7โฃ CLOUDFLARE WORKER: finance-hub-api
โโ> Endpoint: https://finance-hub-api.your-account.workers.dev/api/quote?symbol=AAPL
โข Method: GET
โข Headers: Authorization (API Key)
โข Cache Check: KV Storage ("quote:AAPL")
- Cache Miss (expired 65 seconds ago)
โข Proxy to: Twelve Data API
โข Response: 200 OK (Real-time quote)
โข Store in KV: TTL 60 seconds
โข Latency: ~145ms
8โฃ TWELVE DATA API (External)
โโ> Request: GET https://api.twelvedata.com/quote?symbol=AAPL&apikey=***
โข API Key: Valid (Quota: 800/800 requests remaining)
โข Response: JSON (2.1 KB)
โข Data:
{
symbol: "AAPL",
name: "Apple Inc",
exchange: "NASDAQ",
open: 185.50,
high: 187.20,
low: 184.80,
close: 186.95,
volume: 52847300,
previous_close: 184.25,
change: 2.70,
percent_change: 1.47
}
โข Latency: ~120ms
9โฃ DATA PROCESSING (Frontend)
โโ> Function: processAnalysisData()
โข Calculate 14 technical indicators locally
โข Generate AI recommendations (3 horizons)
โข Calculate composite score (0-100)
โข Prepare Highcharts data structures
โข Processing Time: ~95ms
๐ UI RENDERING (Highcharts)
โโ> Render 14 interactive charts:
โข Candlestick chart (365 data points)
โข RSI chart (14 periods)
โข MACD chart (histogram + signal)
โข Bollinger Bands
โข Moving Averages (SMA/EMA)
โข Fibonacci Retracements
โข Ichimoku Cloud
โข Pivot Points
โข ADX + DMI
โข Stochastic Oscillator
โข Volume chart
โข Support/Resistance levels
โข AI Recommendations (3 cards)
โข Risk Metrics dashboard
โข Rendering Time: ~280ms
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
TOTAL TIME BREAKDOWN:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
DNS Resolution: 8ms
TLS Handshake: 12ms
CDN Delivery: 18ms
Browser Load: 350ms
API Request: 145ms
External API: 120ms
Data Processing: 95ms
Chart Rendering: 280ms
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
TOTAL: 1,028ms
Cache Hit Next Time: ~650ms (API cached)
Data Storage Architecture
| Storage Type | Service | Purpose | Data Examples |
|---|---|---|---|
| NoSQL Database | Firebase Firestore | User profiles, posts, messages, analytics | /users, /posts, /comments, /conversations, /analytics_visits |
| Key-Value Store | Cloudflare KV | API response caching, quota tracking, simulations | CACHE, SIMULATIONS_KV, QUOTA_KV namespaces |
| Object Storage | Firebase Storage | User uploads (profile pictures, post attachments) | /users/{uid}/profile.jpg, /posts/{postId}/image.png |
| Session Storage | Browser LocalStorage | JWT tokens, user preferences, theme settings | firebaseAuthToken, darkMode, language |
Security Layers
Frontend - Structure & Organization
Modern Frontend Architecture
AlphaVault AI uses a vanilla JavaScript architecture (no frameworks) with a focus on performance, accessibility, and maintainability. All code is written in ES6+ with modular design patterns.
Project Structure
alphavault-ai/ โโโ assets/ โ โโโ css/ (49 files - 1.8 MB) โ โ โโโ common.css (2,090 lines - Global styles) โ โ โโโ landing.css (5,886 lines - Homepage) โ โ โโโ community.css (6,890 lines - Community hub) โ โ โโโ admin-analytics.css (4,039 lines - Admin dashboard) โ โ โโโ advanced-analysis.css (5,490 lines - Technical analysis) โ โ โโโ investment-analytics.css (3,748 lines - Portfolio analytics) โ โ โโโ trend-prediction.css (2,599 lines - ML predictions) โ โ โโโ sidebar.css (1,101 lines - Navigation) โ โ โโโ user-menu.css (538 lines - User dropdown) โ โ โโโ chatbot-futuristic.css (1,679 lines - AI chatbot) โ โ โโโ ... (39 other files) โ โ โ โโโ js/ (112 files - 8.5 MB) โ โ โโโ admin-analytics.js (7,846 lines - Admin backend) โ โ โโโ investment-analytics.js (4,869 lines - Portfolio) โ โ โโโ advanced-analysis.js (4,292 lines - 14 indicators) โ โ โโโ trend-prediction.js (2,485 lines - ML predictions) โ โ โโโ insider-flow-tracker.js (2,554 lines - Form 4 analysis) โ โ โโโ ipo-intelligence.js (2,429 lines - IPO screening) โ โ โโโ ma-predictor.js (1,066 lines - M&A screening) โ โ โโโ access-control.js (2,660 lines - Plan-based access) โ โ โโโ api-client.js (2,237 lines - API client) โ โ โโโ firebase-config.js (783 lines - Auth & Firestore) โ โ โโโ auth-guard.js (287 lines - Page protection) โ โ โโโ chatbot-fullpage-ui.js (1,115 lines - AI chatbot UI) โ โ โโโ ... (100 other files) โ โ โ โโโ images/ (Logos, favicons, illustrations) โ โโโ index (Homepage - 1,951 lines) โโโ dashboard-financier (Budget dashboard - 828 lines) โโโ advanced-analysis (14 indicators + AI - 2,906 lines) โโโ trend-prediction (ML predictions - 1,565 lines) โโโ investment-analytics (Multi-allocation - 1,103 lines) โโโ community-hub (Social features - 675 lines) โโโ admin-analytics (Admin backend - 2,989 lines) โโโ chatbot-fullpage (FinanceGPT - 771 lines) โโโ ... (57 other pages)
HTML Pages Overview (65 pages)
| Page | Purpose | Lines | Plan Required | Type |
|---|---|---|---|---|
index |
Landing page with 3D elements & hero section | 1,951 | Public | Marketing |
auth |
Login & Registration with Firebase Auth | 514 | Public | Auth |
dashboard-financier |
Budget dashboard with 8 Highcharts graphs | 828 | Free+ | Dashboard |
investment-analytics |
Multi-allocation portfolio analytics & optimization | 1,103 | Pro+ | Analytics |
monte-carlo |
Probabilistic simulations (6 models) | 2,160 | Free+ | Simulation |
advanced-analysis |
14 Wall Street indicators + AI recommendations | 2,906 | Pro+ | Analysis |
trend-prediction |
ML predictions (5 models) + backtesting + ensemble | 1,565 | Platinum | ML |
ipo-intelligence |
AI IPO scoring + SEC S-1 parsing | 847 | Platinum | Analysis |
insider-flow-tracker |
Form 4 insider trading (14 transaction classes) | 703 | Platinum | Analysis |
ma-predictor |
M&A screening with 6 AI factors | 664 | Platinum | Analysis |
forex-converter |
38 currencies + 14 Wall Street indicators | 1,848 | Pro+ | Tools |
chatbot-fullpage |
FinanceGPT AI assistant (Gemini 2.5) | 771 | Free+ | AI |
community-hub |
Social features (posts, comments, likes, messages) | 675 | Free+ | Community |
admin-analytics |
Admin dashboard (Stripe + Cloudflare analytics) | 2,989 | Admin Only | Admin |
| + 51 additional pages (companies directory, economic data, news terminal, settings, help, etc.) | ||||
CSS Architecture (49 files - 1.8 MB)
| File | Lines | Size | Purpose |
|---|---|---|---|
common.css |
2,090 | 47.57 KB | Global styles, CSS variables, utility classes, responsive breakpoints |
landing.css |
5,886 | 142.24 KB | Homepage (hero, features, pricing, testimonials, 3D animations) |
community.css |
6,890 | 179.70 KB | Social hub (posts, comments, likes, messages, user profiles) |
admin-analytics.css |
4,039 | 104.74 KB | Admin dashboard (Stripe analytics, Cloudflare metrics, charts) |
advanced-analysis.css |
5,490 | 132.89 KB | Technical analysis (14 indicators, AI recommendations, charts) |
investment-analytics.css |
3,748 | 81.76 KB | Portfolio analytics (multi-allocation, backtesting, risk metrics) |
trend-prediction.css |
2,599 | 62.22 KB | ML predictions (5 models, backtesting, ensemble, accuracy tracking) |
sidebar.css |
1,101 | 25.32 KB | Navigation sidebar (responsive, glassmorphism, collapsible folders) |
chatbot-futuristic.css |
1,679 | 37.60 KB | AI chatbot (3D robot, glassmorphism, particles background) |
| + 40 additional CSS files (total: 1.8 MB) | |||
CSS Design System
- Color Palette: Gradient-based (purple/blue theme: #667eea โ #764ba2) with dark mode support
- Typography: Inter font family, 8-level hierarchy (12px to 48px)
- Responsive: Mobile-first approach, 4 breakpoints (320px, 480px, 768px, 1024px)
- Effects: Glassmorphism (backdrop-filter: blur(20px)), neumorphism, 3D transforms, smooth transitions (0.3s ease)
- Animations: 60fps GPU-accelerated (transform3d, will-change, requestAnimationFrame)
- Accessibility: WCAG 2.1 Level AA compliant (contrast ratio 4.5:1, keyboard navigation, ARIA labels)
Essential JavaScript Scripts (112 files - 8.5 MB)
| Script | Lines | Purpose | Key Functions |
|---|---|---|---|
admin-analytics.js |
7,846 | Admin dashboard backend | Stripe analytics, Cloudflare metrics, user management, email campaigns, newsletter automation |
investment-analytics.js |
4,869 | Portfolio analytics | Multi-allocation system, optimization algorithms, backtesting engine, VaR/Sharpe calculations |
advanced-analysis.js |
4,292 | Technical analysis | 14 indicators: RSI, MACD, Bollinger, Fibonacci, Ichimoku, Pivot Points, ADX, Stochastic, SMA/EMA |
trend-prediction.js |
2,485 | ML predictions | 5 models (Linear Regression, Ridge, Lasso, Random Forest, LSTM), backtesting, ensemble aggregation |
insider-flow-tracker.js |
2,554 | Insider trading analysis | Form 4 parsing, 14 transaction classes, pattern detection (momentum, acceleration, unusual), network graphs |
access-control.js |
2,660 | Plan-based page protection | Firebase JWT verification, plan level checks (Free/Basic/Pro/Platinum), upgrade modals, feature gates |
ipo-intelligence.js |
2,429 | IPO screening | S-1 document parsing, AI scoring (6 factors), SEC API integration, multi-criteria evaluation |
api-client.js |
2,237 | API client (Twelve Data) | getQuote(), getTimeSeries(), getTechnicalIndicator(), getProfile(), getStatistics(), search() |
monte-carlo.js |
2,086 | Probabilistic simulations | 6 models: Normal, Student-t, Log-Normal, Jump Diffusion, Regime Switching, GARCH |
chatbot-fullpage-ui.js |
1,115 | AI chatbot UI | Firebase conversations, 3D robot animation (Three.js), real-time streaming, export/share/PDF |
firebase-config.js |
783 | Firebase initialization | initializeApp(), Auth providers (Email/Password + Google OAuth), Firestore real-time listeners |
auth-guard.js |
287 | Page authentication | onAuthStateChanged(), session verification, redirect to login, user data loading |
| + 100 additional JavaScript files (total: 8.5 MB) | |||
External Libraries & Integrations
Code Statistics
Backend - Services & Infrastructure
Serverless Backend Architecture
AlphaVault AI's backend is 100% serverless, leveraging Firebase for authentication and data storage, Cloudflare Workers for edge computing, Stripe for payment processing, and Resend for email delivery. This architecture ensures zero maintenance, infinite scalability, and global low latency.
Firebase Configuration
// Firebase Configuration (Production)
const firebaseConfig = {
apiKey: "YOUR_FIREBASE_API_KEY",
authDomain: "alphavault-ai.firebaseapp.com",
projectId: "alphavault-ai",
storageBucket: "alphavault-ai.appspot.com",
messagingSenderId: "YOUR_SENDER_ID",
appId: "YOUR_APP_ID",
measurementId: "YOUR_MEASUREMENT_ID"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
// Initialize Services
const auth = firebase.auth();
const db = firebase.firestore();
const storage = firebase.storage();
// Configure Auth Providers
const googleProvider = new firebase.auth.GoogleAuthProvider();
googleProvider.setCustomParameters({ prompt: 'select_account' });
// Enable Offline Persistence
db.enablePersistence({ synchronizeTabs: true })
.catch((err) => console.warn('Offline persistence failed:', err));
console.log('๐ฅ Firebase initialized successfully');
| Service | Purpose | Collections/Features |
|---|---|---|
| Firebase Authentication | User authentication & session management with JWT tokens |
โข Email/Password authentication โข Google OAuth 2.0 (one-click login) โข JWT token-based sessions (1h expiry) โข Password reset workflows โข Email verification links |
| Firestore Database | NoSQL real-time database with automatic scaling |
โข /users - User profiles, plans, subscription statusโข /posts - Community posts with likes/commentsโข /comments - Post comments with threadingโข /conversations - Private messages & group chatsโข /messages - Subcollection for conversation messagesโข /simulations - Monte Carlo simulation dataโข /portfolios - User watchlists & allocationsโข /analytics_visits - Page view trackingโข /analytics_activity - User activity logsโข /businessPlans - Business plan documentsโข /referrals - Referral program trackingโข /email_signatures - Admin email signaturesโข /email_profile_pictures - Admin profile pictures
|
| Firebase Storage | File uploads & CDN with automatic image optimization |
โข User profile pictures (avatars) โข Post attachments (images, PDFs up to 25MB) โข Message attachments โข Export files (JSON, CSV, PDF) โข Business plan documents |
Firestore Security Rules (Production)
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// ============================================
// USERS COLLECTION
// ============================================
match /users/{userId} {
// โ
Read: Any authenticated user
allow read: if request.auth != null;
// โ
Create: User can create their own document
allow create: if request.auth != null && request.auth.uid == userId;
// โ
Update: User or Admin ([email protected])
// OR automated updates (followers, posts count, etc.)
allow update: if request.auth != null &&
(request.auth.uid == userId ||
request.auth.token.email == '[email protected]' ||
(request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['followersCount', 'followingCount', 'reputation',
'postCount', 'lastLoginAt', 'points', 'postsCount',
'commentsCount', 'likesReceived', 'updatedAt', 'photoURL'])));
// โ
Delete: User only
allow delete: if request.auth != null && request.auth.uid == userId;
}
// ============================================
// POSTS COLLECTION
// ============================================
match /posts/{postId} {
// โ
Read: Any authenticated user
allow read: if request.auth != null;
// โ
Create: User must be author
allow create: if request.auth != null &&
request.resource.data.authorId == request.auth.uid;
// โ
Update: Author, Admin, or automated counters (views, likes)
allow update: if request.auth != null &&
(request.auth.uid == resource.data.authorId ||
request.auth.token.email == '[email protected]' ||
(request.resource.data.diff(resource.data).affectedKeys()
.hasOnly(['views', 'likes', 'commentsCount', 'updatedAt'])));
// โ
Delete: Author or Admin
allow delete: if request.auth != null &&
(request.auth.uid == resource.data.authorId ||
request.auth.token.email == '[email protected]');
}
// ============================================
// CONVERSATIONS (Private Messages + Groups)
// ============================================
match /conversations/{conversationId} {
// โ
Read: Participants only
allow read: if request.auth != null &&
request.auth.uid in resource.data.participants;
// โ
Create: User must be a participant (1-to-1 or group)
allow create: if request.auth != null &&
request.auth.uid in request.resource.data.participants;
// โ
Update/Delete: Participants only
allow update, delete: if request.auth != null &&
request.auth.uid in resource.data.participants;
// Messages subcollection
match /messages/{messageId} {
allow read: if request.auth != null &&
request.auth.uid in get(/databases/$(database)/documents/conversations/$(conversationId)).data.participants;
allow create: if request.auth != null &&
request.auth.uid == request.resource.data.senderId &&
request.auth.uid in get(/databases/$(database)/documents/conversations/$(conversationId)).data.participants;
allow update, delete: if request.auth != null &&
request.auth.uid in get(/databases/$(database)/documents/conversations/$(conversationId)).data.participants;
}
}
// ============================================
// ADMIN-ONLY COLLECTIONS
// ============================================
match /analytics_visits/{document} {
allow create: if true; // Public write for tracking
allow read: if request.auth != null &&
request.auth.token.email == '[email protected]';
}
match /payments/{document} {
allow read: if request.auth != null &&
request.auth.token.email == '[email protected]';
}
// ============================================
// BLOCK ALL OTHER ACCESS
// ============================================
match /{document=**} {
allow read, write: if false;
}
}
}
Cloudflare Workers (10+ Serverless APIs)
| Worker Name | Lines | Purpose | Key Endpoints & Features |
|---|---|---|---|
| finance-hub-api | 2,885 | Main backend API (Twelve Data + FinnHub + Stripe + Resend) |
Twelve Data: โข /api/quote - Real-time quotesโข /api/time-series - Historical dataโข /api/technical-indicators - RSI, MACD, etc.โข /api/profile - Company fundamentalsStripe: โข /create-checkout-session - Checkoutโข /webhook - Stripe webhooksโข /verify-subscription - Plan checkStorage: โข /api/simulations (CRUD)โข /api/portfolios (CRUD)
|
| economic-data-worker | 656 | ECB Forex (XML) + FRED economic data proxy |
ECB (European Central Bank): โข /ecb/rates - 30+ currencies (EUR base)โข /ecb/historical - 6 months historical forexFRED (Federal Reserve): โข /series/observations - Time series dataโข /multiple - Batch FRED requestsโข /latest - Latest economic values
|
| gmail-api | 2,417 | Hybrid email system (Gmail API + Resend API) |
Read (Gmail API): โข /gmail-inbox - Inbox messagesโข /gmail-sent - Sent messagesโข /gmail-thread - Message threadsSend (Resend API): โข /gmail-send - Send emailsโข /gmail-reply - Reply with threadingโข /gmail-forward - Forward with attachmentsManagement: โข /gmail-action - Mark read/archive/deleteโข /gmail-labels - Label managementโข Multi-sender support (authorized addresses) |
| gemini-ai-proxy | 175 | Secure proxy for Gemini 2.5 Flash API |
โข POST /api/gemini - AI requestsโข Model: gemini-2.5-flashโข Max Tokens: 8,192 โข Temperature: 0.9 โข Safety Settings: BLOCK_MEDIUM_AND_ABOVE โข CORS: alphavault-ai.com only |
| google-apis-proxy | 432 | YouTube Data API v3 with quota management |
โข /youtube/search - Search videos (100 units)โข /youtube/video - Video details (1 unit)โข /youtube/channel - Channel info (1 unit)โข /quotas - Quota status dashboardโข Daily Limit: 10,000 units (80 searches max) โข Rate Limits: 60 req/min, 500 req/hour |
| google-knowledge-api | 710 | Google Knowledge Graph + Wikidata enrichment |
โข /company-info?query=Apple - Enriched company dataโข /batch-companies - Batch lookup (max 50)Data Sources: โข Google KG (name, description, images, links) โข Wikidata (16 properties: CEO, headquarters, industry, stock symbol, etc.) โข Confidence scoring (very_low to very_high) โข Batch label resolution (50 IDs/request) |
| + 4 additional workers (admin-analytics-api, sec-edgar-api, payment-flow-manager, newsletter-automation) | |||
Cloudflare KV Storage (Key-Value Store)
| Namespace | Purpose | TTL (Time To Live) |
|---|---|---|
CACHE |
API response caching (Twelve Data, FinnHub, SEC EDGAR) | 60s (quotes) to 3600s (profiles) |
SIMULATIONS_KV |
User simulations & portfolios storage (Monte Carlo, Risk Parity) | Persistent (no expiration) |
QUOTA_KV |
YouTube API quota tracking (daily/hourly request limits) | 24h reset (midnight UTC) |
Backend Performance Metrics
Data Flows & Processes
About Data Flows
This section documents the three main data flows in AlphaVault AI: user registration, payment processing, and market data retrieval. Each flow shows the complete journey from user action to final result with detailed technical steps.
1. User Registration Flow
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ USER REGISTRATION FLOW โ
โ (Browser โ Firebase Auth โ Firestore โ Email) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1โฃ USER SUBMITS REGISTRATION FORM
โโ Page: auth
โโ Email: [email protected]
โโ Password: ************ (min 6 chars)
โโ Name: John Doe
โโ Function: handleEmailSignup()
2โฃ FIREBASE AUTHENTICATION
โโ SDK: firebase.auth().createUserWithEmailAndPassword(email, password)
โโ Validation:
โ โ Email format check
โ โ Password strength (min 6 chars)
โ โ Email not already registered
โโ Create User:
โ โข UID: abc123xyz456 (auto-generated)
โ โข JWT Token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9... (expires in 1h)
โโ Response: { uid, email, emailVerified: false, token }
3โฃ FIRESTORE USER DOCUMENT CREATION
โโ Collection: /users/{abc123xyz456}
โโ Function: createUserProfile()
โโ Document Structure:
{
uid: "abc123xyz456",
email: "[email protected]",
name: "John Doe",
plan: "basic", // Default plan
subscriptionStatus: "inactive",
createdAt: "2026-01-07T14:30:00.000Z",
updatedAt: "2026-01-07T14:30:00.000Z",
lastLogin: "2026-01-07T14:30:00.000Z",
photoURL: "https://ui-avatars.com/api/?name=John+Doe",
emailVerified: false,
onboardingCompleted: false,
preferences: {
theme: "light",
language: "en",
notifications: true,
newsletter: false
},
usage: {
apiCalls: 0,
chatbotMessages: 0,
simulationsCreated: 0
}
}
4โฃ WELCOME EMAIL (Cloudflare Worker โ Resend API)
โโ Worker: finance-hub-api
โโ Function: sendWelcomeEmail()
โโ Email Service: Resend API
โโ Sender: AlphaVault AI
โโ Email Template (HTML + Glassmorphism):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ WELCOME TO ALPHAVAULT AI! โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ [GRADIENT HEADER: Purple โ Blue] โ
โ [PNG LOGO 192x192] โ
โ โ
โ Hi John Doe, โ
โ โ
โ Your account has been created successfully! โ
โ โ
โ ๐ AlphaVault Basic (9 pages unlocked) โ
โ โ
โ ๐ Pages You Can Access: โ
โ โ Dashboard Budget โ
โ โ Community Hub โ
โ โ Monte Carlo Simulations โ
โ โ Real Estate Tax Simulator โ
โ โ Portfolio Optimizer (Markowitz) โ
โ โ Economic Dashboard โ
โ โ Companies Directory โ
โ โ Settings & User Profile โ
โ โ Create Posts & Messages โ
โ โ
โ [ACCESS YOUR DASHBOARD โ] (Gradient Button) โ
โ โ
โ Need more features? Upgrade to Pro or Platinum! โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ ยฉ 2026 AlphaVault AI | [email protected] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
5โฃ ANALYTICS TRACKING
โโ Worker: admin-analytics-api
โโ Collection: /analytics_activity
โโ Event Data:
{
eventType: "user_registered",
userId: "abc123xyz456",
email: "[email protected]",
plan: "basic",
timestamp: "2026-01-07T14:30:00.000Z",
source: "organic",
userAgent: "Mozilla/5.0...",
device: "desktop",
location: { country: "US", city: "New York" }
}
6โฃ REDIRECT TO DASHBOARD
โโ URL: /dashboard-financier
โโ Session: Active (JWT token stored in localStorage)
โโ Plan: Basic (9 pages unlocked)
โโ โ
REGISTRATION COMPLETE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
KEY FILES INVOLVED:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Frontend:
โข auth (Registration form UI)
โข assets/js/auth.js (Form handling + Firebase calls)
โข assets/js/firebase-config.js (Firebase initialization)
Backend:
โข Firebase Authentication (User creation + JWT)
โข Firestore Database (/users collection)
โข Cloudflare Worker: finance-hub-api (Email sending)
โข Resend API (Email delivery)
Analytics:
โข Cloudflare Worker: admin-analytics-api
โข Firestore: /analytics_activity
2. Stripe Payment Flow
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ STRIPE PAYMENT FLOW โ
โ (User โ Worker โ Stripe โ Webhook โ Firebase โ Email) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1โฃ USER SELECTS PLAN
โโ Page: checkout
โโ Plan: Pro ($10/month)
โโ Promo Code: LAUNCH15 (15% off)
โโ Action: Click "Subscribe"
2โฃ CLOUDFLARE WORKER: finance-hub-api
โโ Endpoint: POST /create-checkout-session
โโ Body: { plan: "pro", userId: "abc123", promoCode: "LAUNCH15" }
โโ Process:
โ โ Validate plan (basic/pro/platinum)
โ โ Verify promo code: LAUNCH15
โ โ Type: percentage (15%)
โ โ Duration: forever
โ โ Create Stripe Coupon: coupon_launch15_abc123
โ โ Get Price ID: env.STRIPE_PRICE_PRO
โโ Stripe API Call:
POST https://api.stripe.com/v1/checkout/sessions
{
mode: "subscription",
customer_email: "[email protected]",
client_reference_id: "abc123xyz456",
line_items: [{ price: "price_pro_id", quantity: 1 }],
discounts: [{ coupon: "coupon_launch15_abc123" }],
subscription_data: {
trial_period_days: 14,
metadata: { userId: "abc123xyz456", plan: "pro", promoCode: "LAUNCH15" }
},
success_url: "https://alphavault-ai.com/success?session_id={CHECKOUT_SESSION_ID}",
cancel_url: "https://alphavault-ai.com/checkout?cancelled=true"
}
Response: { id: "cs_test_abc123", url: "https://checkout.stripe.com/..." }
3โฃ REDIRECT TO STRIPE CHECKOUT
โโ URL: https://checkout.stripe.com/c/pay/cs_test_abc123
โโ User enters payment details:
โ โข Card: 4242 4242 4242 4242
โ โข Expiry: 12/28
โ โข CVC: 123
โโ Stripe validates payment method
4โฃ STRIPE PROCESSES PAYMENT
โโ Create Customer: cus_abc123
โโ Create Subscription: sub_xyz789
โโ Apply Discount: 15% off (final: $8.50/month)
โโ Start Trial: 14 days (no charge until Jan 21, 2026)
โโ Schedule Invoice: Jan 21, 2026 ($8.50)
โโ Subscription Details:
{
id: "sub_xyz789",
customer: "cus_abc123",
status: "trialing",
trial_end: "2026-01-21T00:00:00.000Z",
plan: { amount: 1000, currency: "usd", interval: "month" },
discount: { coupon: { percent_off: 15, duration: "forever" } },
metadata: { userId: "abc123xyz456", plan: "pro", promoCode: "LAUNCH15" }
}
5โฃ STRIPE WEBHOOK โ WORKER
โโ Event: checkout.session.completed
โโ Endpoint: POST /webhook (finance-hub-api)
โโ Signature Verification: STRIPE_WEBHOOK_SECRET
โโ Handler: handleCheckoutSessionCompleted()
โโ Actions:
โข Extract userId from client_reference_id
โข Update Firebase Firestore (/users/{userId}):
{
plan: "pro",
stripeCustomerId: "cus_abc123",
stripeSubscriptionId: "sub_xyz789",
subscriptionStatus: "active",
promoCode: "LAUNCH15",
discount: 15,
trialEnd: "2026-01-21T00:00:00.000Z",
updatedAt: serverTimestamp()
}
โข User now has access to 17 pages (Pro plan)
โข Trigger confirmation email
6โฃ RESEND API - CONFIRMATION EMAIL
โโ Service: Resend (https://api.resend.com/emails)
โโ Sender: AlphaVault AI
โโ Email Template (Glassmorphism + HTML Invoice):
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
PAYMENT CONFIRMED - ALPHAVAULT AI โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ [GRADIENT HEADER: Purple โ Blue] โ
โ [PNG LOGO 192x192] โ
โ โ
โ [โ SUCCESS ICON - Green Circle] โ
โ โ
โ Hi John Doe, โ
โ โ
โ Your subscription has been successfully processed! โ
โ โ
โ ๐ AlphaVault Pro โ
โ โฑ 14-Day Free Trial - No charges until Jan 21, 2026 โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ TRANSACTION DETAILS โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ โ
โ โ Customer: John Doe โ โ
โ โ Email: [email protected] โ โ
โ โ Plan: AlphaVault Pro โ โ
โ โ Amount: $8.50/month (15% discount applied) โ โ
โ โ Invoice: #AV-202601-147820 โ โ
โ โ Date: January 07, 2026 โ โ
โ โ Status: โ Active โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ ๐ FEATURES UNLOCKED (17 PAGES): โ
โ โ Everything in Free (9 pages) โ
โ โ Investment Analytics (Multi-allocation portfolios) โ
โ โ Risk Parity Optimization โ
โ โ Scenario Analysis (Bull/Base/Bear) โ
โ โ Advanced Analysis (14 Wall Street indicators) โ
โ โ Forex Converter (38 currencies + 14 indicators) โ
โ โ Inflation Calculator โ
โ โ Interest Rate Tracker โ
โ โ News Terminal (Real-time financial news) โ
โ โ
โ [ACCESS YOUR DASHBOARD โ] (Gradient Button) โ
โ โ
โ Thank you for choosing AlphaVault AI! โ
โ You can cancel anytime from your account settings. โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ Dashboard | Website | Support โ
โ ยฉ 2026 AlphaVault AI | [email protected] โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Attachment: AlphaVault_Invoice_AV-202601-147820
(HTML invoice with SVG logo + transaction details)
7โฃ SUCCESS PAGE
โโ URL: /success
โโ Confirmation message displayed
โโ Email sent notification
โโ โ
PAYMENT COMPLETE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
STRIPE WEBHOOK EVENTS HANDLED:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โข checkout.session.completed โ Update Firebase, send email
โข customer.subscription.updated โ Sync subscription status
โข customer.subscription.deleted โ Downgrade to Basic, cancel subscription
โข invoice.payment_succeeded โ Update payment date, send receipt
โข invoice.payment_failed โ Set grace period, send notification
3. Market Data Retrieval Flow
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MARKET DATA RETRIEVAL FLOW โ
โ (api-client.js โ Cloudflare Worker โ Twelve Data / FinnHub) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1โฃ USER SEARCHES SYMBOL "AAPL"
โโ Page: advanced-analysis
โโ Input: "AAPL"
โโ Action: Click "Analyze"
โโ JavaScript: analyzeSymbol('AAPL')
2โฃ API CLIENT (Frontend)
โโ File: assets/js/api-client.js
โโ Class: FinanceAPIClient
โโ Parallel Requests (4):
โข getQuote('AAPL') โ Real-time price
โข getTimeSeries('AAPL', '1day', 365) โ Historical data (1 year)
โข getTechnicalIndicator('AAPL', 'rsi') โ RSI indicator
โข getProfile('AAPL') โ Company fundamentals
3โฃ CLOUDFLARE WORKER: finance-hub-api
โโ Base URL: https://finance-hub-api.your-account.workers.dev
โโ Request 1: GET /api/quote?symbol=AAPL
โโ Cache Check: KV Storage ("quote:AAPL")
โ โโ Cache Miss (expired 65s ago)
โโ Proxy to: Twelve Data API
โ โ GET https://api.twelvedata.com/quote?symbol=AAPL&apikey=***
โโ Response: 200 OK (Real-time quote)
โ {
โ symbol: "AAPL",
โ name: "Apple Inc",
โ exchange: "NASDAQ",
โ open: 185.50,
โ high: 187.20,
โ low: 184.80,
โ close: 186.95,
โ volume: 52847300,
โ previous_close: 184.25,
โ change: 2.70,
โ percent_change: 1.47
โ }
โโ Store in KV: TTL 60 seconds
โโ Latency: ~145ms
โโ Request 2: GET /api/time-series?symbol=AAPL&interval=1day&size=365
โโ Cache Check: KV Storage ("timeseries:AAPL:1day:365")
โ โโ Cache Hit! (cached 15 minutes ago)
โโ Response (from cache):
โ {
โ symbol: "AAPL",
โ interval: "1day",
โ data: [
โ { datetime: "2025-01-07", open: 185.50, high: 187.20, ... },
โ { datetime: "2025-01-06", open: 182.30, high: 184.50, ... },
โ ... (365 data points)
โ ]
โ }
โโ Latency: ~25ms (cache hit)
โโ Request 3: GET /api/technical-indicators?symbol=AAPL&indicator=rsi
โโ Cache Check: KV Storage ("indicator:AAPL:rsi:1day:14")
โ โโ Cache Miss
โโ Proxy to: Twelve Data API
โ โ GET https://api.twelvedata.com/rsi?symbol=AAPL&interval=1day...
โโ Response: 200 OK
โ {
โ symbol: "AAPL",
โ indicator: "RSI",
โ values: [
โ { datetime: "2025-01-07", rsi: 62.45 },
โ { datetime: "2025-01-06", rsi: 58.32 },
โ ... (100 data points)
โ ]
โ }
โโ Store in KV: TTL 1800 seconds (30 min)
โโ Latency: ~135ms
โโ Request 4: GET /api/profile?symbol=AAPL
โโ Cache Check: KV Storage ("profile:AAPL")
โ โโ Cache Hit! (cached 2 hours ago)
โโ Response (from cache):
โ {
โ symbol: "AAPL",
โ name: "Apple Inc",
โ sector: "Technology",
โ industry: "Consumer Electronics",
โ market_cap: 2800000000000,
โ pe_ratio: 28.5,
โ eps: 6.55,
โ dividend_yield: 0.52,
โ beta: 1.24
โ }
โโ Latency: ~18ms (cache hit)
4โฃ DATA PROCESSING (Frontend)
โโ File: assets/js/advanced-analysis.js
โโ Function: processAnalysisData()
โโ Actions:
โข Merge all API responses
โข Calculate 14 technical indicators locally:
โ RSI, MACD, Bollinger Bands, Fibonacci, Moving Averages,
Ichimoku Cloud, Pivot Points, ADX, Stochastic, etc.
โข Generate AI recommendations (3 horizons: Short/Medium/Long)
โข Calculate composite score (0-100)
โข Calculate risk metrics (VaR, Sharpe, Beta, Volatility)
โข Processing Time: ~95ms
5โฃ UI RENDERING (Highcharts)
โโ Render 14 interactive charts:
โ โข Candlestick chart (365 data points)
โ โข RSI chart (14 periods)
โ โข MACD chart (histogram + signal)
โ โข Bollinger Bands
โ โข Moving Averages (SMA/EMA)
โ โข Fibonacci Retracements
โ โข Ichimoku Cloud
โ โข Pivot Points
โ โข ADX + DMI
โ โข Stochastic Oscillator
โ โข Volume chart
โ โข Support/Resistance levels
โ โข AI Recommendations (3 cards)
โ โข Risk Metrics dashboard
โโ Rendering Time: ~280ms
6โฃ FINAL RESULT DISPLAYED
โโ Total Time: ~630ms (fetch + process + render)
โโ Cache Efficiency: 50% (2/4 requests cached)
โโ โ
ANALYSIS COMPLETE
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
CACHE TTL CONFIGURATION:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โข quote: 60s (1 minute - real-time data)
โข timeSeries: 1,800s (30 minutes - historical data)
โข indicators: 1,800s (30 minutes - technical data)
โข profile: 86,400s (24 hours - company fundamentals)
โข search: 86,400s (24 hours - symbol search)
โข statistics: 3,600s (1 hour - company statistics)
Cache Hit Rate Average: 70%
API Cost Reduction: 85% (compared to no caching)
Performance Summary
Payment System & Subscriptions
Complete Stripe Integration
AlphaVault AI uses Stripe for subscription management with a 14-day free trial, custom promo codes (percentage discounts, free access, trial extensions), and automated email confirmations with professional HTML invoices sent via Resend API.
Pricing Plans & Features
| Plan | Price | Stripe Price ID | Pages | Key Features |
|---|---|---|---|---|
| Free | $0/month | N/A |
9 pages | Dashboard Budget, Community Hub, Monte Carlo, Real Estate Simulator, Portfolio Optimizer, Economic Dashboard, Companies Directory, Settings, Create Posts |
| Basic | $5/month | STRIPE_PRICE_BASIC |
9 pages | Everything in Free plan (Entry-level subscription) |
| Pro | $10/month | STRIPE_PRICE_PRO |
17 pages | Everything in Basic + Investment Analytics, Risk Parity, Scenario Analysis, Advanced Analysis (14 indicators), Forex Converter (38 currencies), Inflation Calculator, Interest Rate Tracker, News Terminal |
| Platinum | $20/month | STRIPE_PRICE_PLATINUM |
25 pages | Everything in Pro + IPO Intelligence (AI Scoring), Insider Flow Tracker (14 classes), M&A Predictor (6 AI factors), Trend Prediction ML, Market Sentiment, Trending Topics, YouTube Intelligence, Recession Indicators |
Promo Codes System
| Code | Type | Value | Description | Duration |
|---|---|---|---|---|
LAUNCH15 |
Percentage | 15% | Launch discount (all plans) | Forever |
WELCOME15 |
Percentage | 15% | Welcome discount (all plans) | Forever |
SAVE15 |
Percentage | 15% | General 15% discount | Forever |
FREEPRO |
Free Access | Lifetime | Free lifetime access to Pro plan | Permanent |
FREEPLATINUM |
Free Access | Lifetime | Free lifetime access to Platinum plan | Permanent |
VIPACCESS |
Free Access | Lifetime | VIP access (Pro or Platinum) | Permanent |
FREE14DAYS |
Trial | 14 days | 14-day free trial (no card required) | One-time |
TRIAL14 |
Trial | 14 days | 14-day trial period | One-time |
TRYITFREE |
Trial | 14 days | Try it free for 14 days | One-time |
Stripe Webhook Events
| Event Type | Handler Function | Actions Performed |
|---|---|---|
checkout.session.completed |
handleCheckoutSessionCompleted() |
โข Update Firebase user plan โข Store Stripe customer ID โข Store Stripe subscription ID โข Send confirmation email (Resend) โข Generate HTML invoice โข Log analytics event |
customer.subscription.updated |
handleSubscriptionUpdated() |
โข Sync subscription status โข Update trial status โข Update billing period โข Log subscription change |
customer.subscription.deleted |
handleSubscriptionDeleted() |
โข Downgrade to Basic plan โข Set status to 'cancelled' โข Remove subscription ID โข Send cancellation notification โข Log cancellation event |
invoice.payment_succeeded |
handlePaymentSucceeded() |
โข Update last payment date โข Send payment receipt โข Extend subscription period โข Log successful payment |
invoice.payment_failed |
handlePaymentFailed() |
โข Set status to 'past_due' โข Set 7-day grace period โข Send notification email โข Attempt Stripe auto-retry |
Automated HTML Invoice System
- Format: Professional HTML invoice with embedded SVG logo (scalable)
- Filename:
AlphaVault_Invoice_AV-{YYMMDD}-{ID} - Content: Transaction details, plan summary, payment breakdown, customer info
- Design: Glassmorphism style matching email template (gradient headers, shadows)
- Attachment: Base64-encoded HTML file sent via Resend API
- Storage: Automatically stored in Firestore (/payments collection) for admin access
Security & Access Control
Multi-Layer Security Architecture
AlphaVault AI implements a defense-in-depth security strategy with multiple layers: TLS 1.3 encryption, Firebase JWT authentication, Firestore security rules, plan-based access control, CORS protection, API key rotation, and real-time activity monitoring.
Authentication System
| Component | Technology | Implementation Details |
|---|---|---|
| Email/Password Auth | Firebase Authentication |
โข Bcrypt password hashing (cost factor: 10) โข Min password length: 6 characters โข Email verification required โข Password reset via secure links |
| Google OAuth 2.0 | Firebase GoogleAuthProvider |
โข One-click sign-in/sign-up โข Automatic account linking โข Profile data import (name, photo) โข Custom OAuth scopes |
| JWT Tokens | Firebase Auth Tokens |
โข RS256 signature algorithm โข 1-hour expiration (auto-refresh) โข Secure storage (localStorage) โข Sent in Authorization header |
| Session Management | Firebase onAuthStateChanged() |
โข Real-time session monitoring โข Automatic logout on token expiry โข Cross-tab synchronization โข Persistent sessions (remember me) |
Plan-Based Access Control
| Page/Feature | Required Plan | Access Control Method | Enforcement |
|---|---|---|---|
| Dashboard Budget, Community Hub, Monte Carlo | Free+ | auth-guard.js only (authentication check) |
Client-side redirect to login if not authenticated |
| Investment Analytics, Risk Parity, Advanced Analysis, Forex Converter | Pro+ | access-control.js + Firebase plan check |
Upgrade modal + redirect to pricing after 3s if plan insufficient |
| IPO Intelligence, Insider Flow Tracker, M&A Predictor, Trend Prediction | Platinum | access-control.js + Firebase plan check |
Upgrade modal + redirect to pricing after 3s if plan insufficient |
| Admin Analytics, Admin Documentation | Admin Only | Email whitelist check ([email protected]) |
403 Forbidden + redirect to homepage if not admin |
API Key Management
| Service | Storage Location | Access Method | Security Measures |
|---|---|---|---|
| Firebase API Key | Public (firebaseConfig) | Client-side (firebase-config.js) |
โข Domain restrictions (alphavault-ai.com) โข Firestore Security Rules โข Auth required for all operations |
| Stripe Secret Key | Cloudflare Worker Environment Variables | Server-side only (finance-hub-api) |
โข Never exposed to client โข Webhook signature verification โข HTTPS-only communication |
| Resend API Key | Cloudflare Worker Secrets | Server-side only (finance-hub-api) |
โข Encrypted at rest โข Authorized sender addresses only โข Rate limiting (100 emails/hour) |
| Twelve Data API Key | Cloudflare Worker Environment | Proxied through Worker |
โข Hidden from client โข Request caching (KV Storage) โข Quota monitoring |
| Gemini AI API Key | Cloudflare Worker Secrets | Proxied through gemini-ai-proxy |
โข CORS restricted (alphavault-ai.com) โข Request validation โข Safety settings enforcement |
Firestore Security Rules Summary
| Collection | Read Access | Write Access | Special Rules |
|---|---|---|---|
/users/{userId} |
Any authenticated user | Owner or Admin |
โข Automated counters allowed (followersCount, postsCount) โข Admin: [email protected] |
/posts/{postId} |
Any authenticated user | Author or Admin |
โข Author must match authorId on create โข View/like counters allowed |
/comments/{commentId} |
Any authenticated user | Author or Admin |
โข Author must match authorId on create โข Like counter updates allowed |
/conversations/{convId} |
Participants only | Participants only |
โข User must be in participants array โข Supports 1-to-1 and group chats |
/messages/{msgId} |
Conversation participants | Sender (participant) |
โข Sender must match senderId on create โข Nested under /conversations |
/analytics_visits |
Admin only | Public (tracking) |
โข Create allowed for all (analytics tracking) โข Read restricted to admin |
/payments |
Admin only | Denied |
โข Read-only for admin โข Written by Stripe webhook only |
Additional Security Measures
APIs & Cloudflare Workers
Serverless Backend Infrastructure
AlphaVault AI's backend is powered by 10+ Cloudflare Workers deployed on the edge network, providing ultra-low latency (<50ms), infinite scalability, and zero server maintenance. Each worker is optimized for specific tasks (API proxying, payment processing, email delivery, analytics).
Worker 1: Admin Analytics API
๐ ADMIN ANALYTICS API
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Base URL: https://admin-analytics-api.raphnardone.workers.dev
Purpose: Aggregate Stripe & Cloudflare analytics for admin dashboard
๐ ENDPOINTS:
1. GET /stripe-analytics
โโ Purpose: Retrieve all Stripe subscription data
โโ Response: { customers, subscriptions, revenue, plans }
โโ Auth: Stripe Secret Key
2. GET /cloudflare-analytics?days=30
โโ Purpose: Cloudflare httpRequests1dGroups (up to 365 days)
โโ Response: { requests, bandwidth, threats, status_codes }
โโ Limitation: Max 365 days
3. GET /cloudflare-geo
โโ Purpose: Geographic distribution of visitors
โโ Response: { country_code, requests, bandwidth }
4. GET /cloudflare-devices
โโ Purpose: Device type breakdown (desktop/mobile/tablet)
โโ Response: { deviceType, requests, percentage }
5. GET /cloudflare-pages
โโ Purpose: Top pages by traffic
โโ Response: { path, requests, unique_visitors }
6. GET /cloudflare-cache
โโ Purpose: Cache hit/miss statistics
โโ Response: { hit_rate, cached_bytes, requests }
7. GET /cloudflare-referrers
โโ Purpose: Top referrer sources
โโ Response: { referrer, requests }
โโ Requirement: Cloudflare Pro plan
8. POST /send-alert-email
โโ Purpose: Send admin email alerts (Resend API)
โโ Body: { to, subject, html }
โโ Response: { success, messageId }
9. GET /health
โโ Purpose: Health check endpoint
โโ Response: { status: "ok", timestamp }
โ LIMITATIONS:
โข Cloudflare Overview: Up to 365 days
โข Cloudflare Details (httpRequestsAdaptiveGroups): Max 24 hours
โข Referrers: Requires Cloudflare Pro plan
Worker 2: SEC EDGAR API Proxy
๐ SEC EDGAR API PROXY
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Base URL: https://sec-edgar-api.raphnardone.workers.dev
Purpose: Proxy SEC EDGAR API (bypass 403 errors from Cloudflare IPs)
๐ ENDPOINTS:
1. GET /filings/form4/recent?count=100
โโ Purpose: Recent Form 4 insider trading filings
โโ Response: { filings: [...], count, date_range }
โโ User-Agent: "AlphaVault AI [email protected]"
2. GET /filings/s1/recent?count=50
โโ Purpose: Recent S-1 IPO registration filings
โโ Response: { filings: [...], count }
3. GET /filings/8k/recent?count=100
โโ Purpose: Recent 8-K current event reports
โโ Response: { filings: [...], count }
4. GET /company/{cik}/filings
โโ Purpose: All filings for a specific CIK number
โโ Example: /company/0000320193/filings (Apple)
โโ Response: { cik, company_name, filings: [...] }
5. GET /search?ticker=AAPL
โโ Purpose: Search company by ticker symbol
โโ Response: { cik, company_name, tickers }
โ KNOWN ISSUE:
SEC EDGAR blocks many cloud provider IPs (403 Forbidden).
Alternative: Use direct CIK numbers or pre-cached data.
Worker 3: Payment Flow Manager
๐ณ PAYMENT FLOW MANAGER
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Base URL: https://payment-flow-manager.raphnardone.workers.dev
Purpose: Handle complete payment flow (Stripe + Firebase + Resend)
๐ ENDPOINTS:
1. POST /create-checkout-session
โโ Body: { plan, userId, email, promoCode? }
โโ Process:
โ โข Validate plan & promo code
โ โข Create Stripe Coupon (if discount)
โ โข Create Stripe Checkout Session
โ โข Apply trial period (14 days)
โโ Response: { sessionId, url }
2. POST /webhook (Stripe Webhooks)
โโ Events Handled:
โ โข checkout.session.completed
โ โข customer.subscription.updated
โ โข customer.subscription.deleted
โ โข invoice.payment_succeeded
โ โข invoice.payment_failed
โโ Actions:
โ โข Update Firebase user plan
โ โข Send confirmation email (Resend)
โ โข Generate HTML invoice
โ โข Log analytics event
โโ Security: Signature verification (STRIPE_WEBHOOK_SECRET)
3. POST /create-free-customer
โโ Body: { userId, email, plan }
โโ Purpose: Create free access (FREEPRO/FREEPLATINUM codes)
โโ Response: { success, plan }
4. GET /verify-subscription?userId={uid}
โโ Purpose: Verify active subscription status
โโ Response: { active, plan, trialEnd, status }
5. POST /cancel-subscription
โโ Body: { userId, subscriptionId }
โโ Process:
โ โข Cancel Stripe subscription
โ โข Update Firebase (plan: "basic")
โ โข Send cancellation email
โโ Response: { success, message }
๐ง EMAIL TEMPLATES (Resend Integration):
โข Payment Confirmation (with HTML invoice attachment)
โข Trial Activation (14-day countdown)
โข Free Access Granted (lifetime confirmation)
โข Subscription Cancelled (downgrade notification)
โข Payment Failed (grace period warning)
Worker 4: Newsletter Automation
๐ฐ NEWSLETTER AUTOMATION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Base URL: https://newsletter-automation.raphnardone.workers.dev
Purpose: Automated weekly newsletters based on market events
๐ ENDPOINTS:
1. POST /generate-newsletter
โโ Body: { topics, period }
โโ Process:
โ โข Fetch top market news (FinnHub API)
โ โข Analyze major political events (News API)
โ โข Generate AI summary (Gemini 2.5 Flash)
โ โข Create HTML email template
โโ Response: { html, subject, preview_text }
2. POST /send-newsletter
โโ Body: { subject, html, subscribers }
โโ Process:
โ โข Fetch subscribers from Firestore (/users with newsletter: true)
โ โข Batch send via Resend API (max 100 recipients/email)
โ โข Track opens/clicks (UTM parameters)
โ โข Log campaign analytics
โโ Response: { sent, failed, campaign_id }
3. GET /subscribers
โโ Purpose: Get all newsletter subscribers
โโ Response: { count, subscribers: [...] }
4. POST /schedule-newsletter
โโ Body: { cron, topics }
โโ Purpose: Schedule recurring newsletters
โโ Response: { scheduled, next_send }
๐ค AI-POWERED CONTENT:
โข Major market movements (S&P 500, Nasdaq, Dow Jones)
โข Political events impacting markets (Fed decisions, elections, policy changes)
โข Top stock gainers/losers (daily/weekly)
โข Economic calendar highlights (CPI, NFP, GDP releases)
โข Sector rotation analysis
โข Expert commentary synthesis
Calculations & Financial Algorithms
Advanced Financial Modeling
AlphaVault AI implements professional-grade financial algorithms including machine learning models, Monte Carlo simulations, portfolio optimization (Markowitz, Risk Parity), and 14 Wall Street technical indicators used by institutional investors.
1. Trend Prediction (Machine Learning)
๐ค MACHINE LEARNING TREND PREDICTION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
File: assets/js/trend-prediction.js (2,485 lines)
Purpose: Predict stock price movements using 5 ML models + ensemble
๐ MODELS IMPLEMENTED:
1โฃ LINEAR REGRESSION
Formula: y = ฮฒโ + ฮฒโxโ + ฮฒโxโ + ... + ฮฒโxโ
Features: Price, Volume, MA20, MA50, RSI, MACD
Training: Least squares optimization
Prediction Horizon: 1-30 days
Accuracy: ~65-70% (short-term)
2โฃ RIDGE REGRESSION (L2 Regularization)
Formula: y = ฮฒโ + ฮฃ(ฮฒแตขxแตข) + ฮปฮฃ(ฮฒแตขยฒ)
Purpose: Prevent overfitting in volatile markets
Lambda (ฮป): Auto-tuned via cross-validation
Accuracy: ~68-73% (medium-term)
3โฃ LASSO REGRESSION (L1 Regularization)
Formula: y = ฮฒโ + ฮฃ(ฮฒแตขxแตข) + ฮปฮฃ|ฮฒแตข|
Purpose: Feature selection (automatic)
Best for: Identifying key market drivers
Accuracy: ~66-71% (long-term)
4โฃ RANDOM FOREST (Ensemble Decision Trees)
Trees: 100 estimators
Max Depth: 10 levels
Features: Technical indicators + volume patterns
Bootstrap Sampling: 80% of data per tree
Accuracy: ~72-78% (all horizons)
5โฃ LSTM (Long Short-Term Memory Neural Network)
Architecture: 3 layers (128, 64, 32 neurons)
Sequence Length: 60 days (lookback window)
Activation: Tanh (hidden), Linear (output)
Training: Adam optimizer, MSE loss
Epochs: 100 (with early stopping)
Accuracy: ~75-82% (best for time series)
๐ฏ ENSEMBLE PREDICTION:
Final Prediction = Weighted Average of 5 models
Weights: [0.15, 0.15, 0.15, 0.25, 0.30]
(LSTM gets highest weight due to superior accuracy)
Ensemble Accuracy: ~78-85% (production)
๐ BACKTESTING ENGINE:
โข Walk-forward validation (rolling window)
โข Out-of-sample testing (20% holdout)
โข Performance metrics: MAE, RMSE, Rยฒ, Sharpe Ratio
โข Signal accuracy: Directional hit rate (up/down/neutral)
๐ก FEATURES USED (Total: 18):
Price Features: Open, High, Low, Close, Volume
Moving Averages: SMA 20/50/100/200, EMA 20/50
Momentum: RSI (14), MACD (12,26,9), Stochastic (14,3,3)
Volatility: Bollinger Bands (20,2), ATR (14)
Trend: ADX (14), Parabolic SAR
2. Monte Carlo Simulation
๐ฒ MONTE CARLO PORTFOLIO SIMULATION
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
File: assets/js/monte-carlo.js (2,086 lines)
Purpose: Probabilistic forecasting with 6 statistical models
๐ข MODELS IMPLEMENTED:
1โฃ GEOMETRIC BROWNIAN MOTION (Normal Distribution)
Formula: S(t) = Sโ ร exp((ฮผ - ฯยฒ/2)t + ฯโt ร Z)
Where:
โข S(t) = Stock price at time t
โข Sโ = Initial price
โข ฮผ = Expected return (drift)
โข ฯ = Volatility (standard deviation)
โข Z ~ N(0,1) = Random normal variable
Use Case: Standard stock price simulation
Assumptions: Log-normal returns, constant volatility
2โฃ STUDENT-T DISTRIBUTION
Formula: S(t) = Sโ ร exp((ฮผ - ฯยฒ/2)t + ฯโt ร T)
Where:
โข T ~ t(df) = Student-t random variable
โข df = Degrees of freedom (default: 5)
Use Case: Fat-tailed distributions (market crashes)
Advantage: Captures extreme events better than Normal
3โฃ LOG-NORMAL DISTRIBUTION
Formula: S(t) = Sโ ร exp(ฮผt + ฯโt ร Z)
Where:
โข Returns are log-normally distributed
โข Ensures positive prices (S > 0)
Use Case: Long-term portfolio projections
Advantage: No negative prices possible
4โฃ JUMP DIFFUSION (Merton Model)
Formula: S(t) = Sโ ร exp((ฮผ - ฯยฒ/2)t + ฯโt ร Z + ฮฃ Jumps)
Where:
โข Jumps ~ Poisson(ฮป) process
โข Jump size ~ N(ฮผโฑผ, ฯโฑผยฒ)
โข ฮป = Jump intensity (avg jumps/year)
Use Case: Sudden market shocks (earnings, news)
Parameters:
โข ฮป = 2 jumps/year
โข ฮผโฑผ = -0.05 (avg -5% jump)
โข ฯโฑผ = 0.10 (10% jump volatility)
5โฃ REGIME SWITCHING (Markov Chain)
States: Bull Market (ฮผโ, ฯโ) โ Bear Market (ฮผโ, ฯโ)
Transition Matrix:
P = | 0.90 0.10 | (90% stay Bull, 10% switch to Bear)
| 0.20 0.80 | (20% switch to Bull, 80% stay Bear)
Bull: ฮผ = 12%, ฯ = 15%
Bear: ฮผ = -8%, ฯ = 25%
Use Case: Economic cycles, recession modeling
6โฃ GARCH (Generalized Autoregressive Conditional Heteroskedasticity)
Volatility Equation: ฯโยฒ = ฯ + ฮฑ ร ฮตโโโยฒ + ฮฒ ร ฯโโโยฒ
Where:
โข ฯ = Long-term variance baseline
โข ฮฑ = ARCH effect (reaction to shocks)
โข ฮฒ = GARCH effect (volatility persistence)
โข Constraint: ฮฑ + ฮฒ < 1 (stationarity)
Use Case: Time-varying volatility (VIX-like behavior)
Parameters: ฯ=0.000001, ฮฑ=0.15, ฮฒ=0.80
๐ฏ SIMULATION PARAMETERS:
โข Number of Simulations: 10,000 paths
โข Time Horizon: 1 day to 10 years
โข Time Steps: Daily granularity
โข Initial Capital: User-defined
โข Annual Return (ฮผ): Historical or user input
โข Volatility (ฯ): Historical std dev or implied vol
๐ OUTPUT METRICS:
โข Percentile Distribution: 5%, 25%, 50%, 75%, 95%
โข Value at Risk (VaR): 95% confidence level
โข Conditional VaR (CVaR): Expected loss in worst 5%
โข Probability of Loss: P(Final Value < Initial)
โข Maximum Drawdown: Worst peak-to-trough decline
โข Sharpe Ratio: Risk-adjusted return
3. Portfolio Optimization
๐ PORTFOLIO OPTIMIZATION ALGORITHMS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ฏ MARKOWITZ MEAN-VARIANCE OPTIMIZATION Objective: Maximize Sharpe Ratio Formula: SR = (E[Rโ] - Rีข) / ฯโ Where: โข E[Rโ] = Portfolio expected return = ฮฃ(wแตข ร E[Rแตข]) โข Rีข = Risk-free rate (default: 2%) โข ฯโ = Portfolio volatility = โ(wแต ร ฮฃ ร w) โข w = Asset weights (wโ, wโ, ..., wโ) โข ฮฃ = Covariance matrix Constraints: โข ฮฃwแตข = 1 (fully invested) โข 0 โค wแตข โค 1 (long-only, no short selling) โข wแตข โฅ min_weight (optional: 5% minimum per asset) โข wแตข โค max_weight (optional: 40% maximum per asset) Solver: Sequential Quadratic Programming (SQP) Output: Optimal weights for Maximum Sharpe Ratio โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ RISK PARITY ALLOCATION Objective: Equalize Risk Contribution Formula: RCแตข = wแตข ร (ฮฃw)แตข / ฯโ = 1/N (for all assets) Where: โข RCแตข = Risk contribution of asset i โข (ฮฃw)แตข = Marginal contribution to portfolio risk โข Target: RCแตข = RC_target = 1/N (equal risk) Algorithm: 1. Calculate covariance matrix ฮฃ from historical returns 2. Initialize weights: wโ = (1/N, 1/N, ..., 1/N) 3. Iterate until convergence: a. Calculate portfolio volatility: ฯโ = โ(wแตฮฃw) b. Calculate marginal risk: MRแตข = (ฮฃw)แตข / ฯโ c. Calculate risk contributions: RCแตข = wแตข ร MRแตข d. Adjust weights: w_new = w ร (RC_target / RCแตข)^ฮป e. Normalize: w_new = w_new / ฮฃw_new 4. Repeat until |RCแตข - RC_target| < tolerance (ฮต = 0.0001) Advantage: Better diversification in crisis periods Use Case: Risk-balanced portfolios (60/40 alternative) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ ๐ EFFICIENT FRONTIER CONSTRUCTION 1. Minimum Variance Portfolio (leftmost point) Minimize: ฯโ = โ(wแตฮฃw) Subject to: ฮฃwแตข = 1 2. Maximum Return Portfolio (rightmost point) Maximize: E[Rโ] = ฮฃ(wแตข ร E[Rแตข]) Subject to: ฮฃwแตข = 1 3. Intermediate Portfolios (100 points on frontier) For target return r โ [min_return, max_return]: Minimize: ฯโ Subject to: E[Rโ] = r, ฮฃwแตข = 1 4. Capital Allocation Line (CAL) Tangent line from risk-free rate to efficient frontier Slope = Maximum Sharpe Ratio Output: 100 portfolios (return, risk, weights) + CAL
4. Technical Indicators (14 Indicators)
๐ 14 WALL STREET TECHNICAL INDICATORS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1โฃ RSI (Relative Strength Index)
Period: 14
Formula: RSI = 100 - (100 / (1 + RS))
Where: RS = Average Gain / Average Loss
Signals:
โข RSI > 70: Overbought (sell signal)
โข RSI < 30: Oversold (buy signal)
โข RSI = 50: Neutral
2โฃ MACD (Moving Average Convergence Divergence)
Fast EMA: 12 periods
Slow EMA: 26 periods
Signal Line: 9-period EMA of MACD
Formula: MACD = EMA(12) - EMA(26)
Histogram: MACD - Signal
Signals:
โข MACD crosses above Signal: Bullish
โข MACD crosses below Signal: Bearish
3โฃ BOLLINGER BANDS
Period: 20
Standard Deviations: 2
Formula:
โข Middle Band = SMA(20)
โข Upper Band = SMA(20) + 2รฯ
โข Lower Band = SMA(20) - 2รฯ
Signals:
โข Price touches upper band: Overbought
โข Price touches lower band: Oversold
โข Bollinger Squeeze: Low volatility (breakout imminent)
4โฃ FIBONACCI RETRACEMENTS
Levels: 0%, 23.6%, 38.2%, 50%, 61.8%, 78.6%, 100%
Extensions: 161.8%, 261.8%
Formula: Level = High - (High - Low) ร Fib_Ratio
Use Case: Support/resistance levels
5โฃ MOVING AVERAGES
โข SMA 20 (Short-term trend)
โข SMA 50 (Medium-term trend)
โข SMA 100 (Long-term trend)
โข SMA 200 (Major trend line)
โข EMA 20 (Faster response)
โข EMA 50 (Faster response)
Signals:
โข Golden Cross: SMA(50) > SMA(200) โ Bullish
โข Death Cross: SMA(50) < SMA(200) โ Bearish
6โฃ ICHIMOKU CLOUD
Components:
โข Tenkan-sen (9): (Highโ + Lowโ) / 2
โข Kijun-sen (26): (Highโโ + Lowโโ) / 2
โข Senkou A: (Tenkan + Kijun) / 2 (shifted 26 ahead)
โข Senkou B: (Highโ
โ + Lowโ
โ) / 2 (shifted 26 ahead)
โข Chikou: Close (shifted 26 back)
โข Kumo (Cloud): Area between Senkou A & B
Signals:
โข Price above cloud: Bullish
โข Price below cloud: Bearish
7โฃ PIVOT POINTS (Standard, Fibonacci, Camarilla)
Standard:
โข Pivot (P) = (High + Low + Close) / 3
โข R1 = 2P - Low, S1 = 2P - High
โข R2 = P + (High - Low), S2 = P - (High - Low)
โข R3 = High + 2(P - Low), S3 = Low - 2(High - P)
Fibonacci:
โข R1 = P + 0.382(High - Low)
โข R2 = P + 0.618(High - Low)
Camarilla:
โข R4 = Close + (High - Low) ร 1.1/2
โข S4 = Close - (High - Low) ร 1.1/2
8โฃ ADX (Average Directional Index) + DMI
Period: 14
Components:
โข +DI (Positive Directional Indicator)
โข -DI (Negative Directional Indicator)
โข ADX (Trend Strength)
Formula: ADX = SMA(14) of DX
Where: DX = 100 ร |+DI - -DI| / (+DI + -DI)
Signals:
โข ADX > 25: Strong trend
โข ADX < 20: Weak trend (range-bound)
โข +DI > -DI: Uptrend
โข -DI > +DI: Downtrend
9โฃ STOCHASTIC OSCILLATOR
%K Period: 14
%D Period: 3 (SMA of %K)
Slow Period: 3
Formula: %K = 100 ร (Close - Lowโโ) / (Highโโ - Lowโโ)
Signals:
โข %K > 80: Overbought
โข %K < 20: Oversold
โข %K crosses above %D: Buy
โข %K crosses below %D: Sell
๐ ATR (Average True Range)
Period: 14
Formula: ATR = SMA(14) of True Range
Where: TR = max(High - Low, |High - Close_prev|, |Low - Close_prev|)
Use: Volatility measurement (not directional)
1โฃ1โฃ PARABOLIC SAR
Acceleration Factor: 0.02 (increments by 0.02, max 0.20)
Formula: SAR = SAR_prev + AF ร (EP - SAR_prev)
Where: EP = Extreme Point (highest high or lowest low)
Signals:
โข SAR below price: Uptrend
โข SAR above price: Downtrend
1โฃ2โฃ OBV (On-Balance Volume)
Formula: OBV = OBV_prev + Volume (if Close > Close_prev)
OBV = OBV_prev - Volume (if Close < Close_prev)
Use: Volume-based momentum indicator
1โฃ3โฃ SUPPORT & RESISTANCE LEVELS
Algorithm:
1. Identify local peaks (resistance)
2. Identify local troughs (support)
3. Cluster similar levels (ยฑ2% tolerance)
4. Rank by touch count (more touches = stronger level)
1โฃ4โฃ VOLUME ANALYSIS
Metrics:
โข Volume MA(20): Average daily volume
โข Relative Volume: Current / MA(20)
โข Volume Breakout: Volume > 2ร MA(20)
Signals:
โข High volume + price up: Strong bullish
โข High volume + price down: Strong bearish
โข Low volume: Weak trend (reversal risk)
Architecture Code Extractor
Extract Your Complete Codebase
This tool automatically scans your GitHub repository and generates a comprehensive report including all HTML, CSS, and JavaScript files with detailed analysis of functions, scripts, integrations, and component counts. Perfect for documentation, audits, and architecture reviews.
Configuration
Cloudflare Workers Analyzer
Extract Workers Configuration & Source Code
This tool connects to your Cloudflare account via a temporary worker proxy and extracts all workers scripts, bindings, routes, KV namespaces, and complete source code with detailed analysis. โ Delete the temporary worker immediately after extraction for security.
Worker Proxy Configuration
1. Deploy the temporary worker "workers-extractor-temp" on your Cloudflare account
2. Copy the worker URL (format:
https://workers-extractor-temp.your-account.workers.dev)3. Paste it below and click "Extract Workers Data"
4. Important: Delete the worker immediately after extraction for security