A modern web application for analyzing the portfolios and performance metrics of eToro's most popular investors (PIs). Built with Next.js 15, TypeScript, and Tailwind CSS featuring an optimized architecture for robust data collection and analysis.
- Fear & Greed Index: Market sentiment using linear scale (30% cash = 0, 0% cash = 100)
- Portfolio Diversification: Distribution of unique instruments per portfolio
- Cash Allocation: Cash percentage distribution across investors
- Returns Distribution: Performance ranges across analyzed investors
- Risk Score Distribution: Risk appetite analysis (Conservative, Moderate, Aggressive, Very High Risk)
- Average Trades: Mean number of trades executed across investors (current year)
- Average Win Ratio: Mean percentage of winning trades across investors
- Ranked by number of copiers (social proof)
- Profile pictures and investor details
- Performance metrics (YTD gain, trades count, win ratio, risk score)
- Cash % with colored badges (green >25%, blue 5-25%, red <5%)
- Pagination support (20 per page, unlimited total)
- Most popular instruments with asset images
- Average allocation percentages
- Ownership statistics across portfolios
- Yesterday, Week-to-Date (WTD), and Month-to-Date (MTD) returns for each instrument
- Color-coded return indicators (green: positive, red: negative, blue: zero)
- Pagination support (20 per page, unlimited total)
- Server-Sent Events for live analysis updates
- Detailed progress messages during processing
- Optimized batch processing for maximum performance
- Range: 1-1500 investors (input validation)
- Default: 100 investors
- API Limit: eToro API caps at exactly 1,500 investors
- Year to Date (default)
- Current Month/Quarter
- Last Year/Two Years
- Historical periods (1, 3, 6 months ago)
The project includes powerful analysis tools for deep behavioral insights:
# Analyze behavior across investor tiers (100, 500, 1000, 1500)
node analysis-tools/market-behavior/analyze-investor-bands.js all
- Asset adoption/exit tracking by investor tier
- Cash position changes across bands
- Cross-band behavioral comparison
# Individual investor cash tracking with sentiment analysis
node analysis-tools/market-behavior/analyze-cash-trends.js 100
- Individual investor cash position changes
- Risk sentiment indicators (defensive vs aggressive)
- Performance correlation analysis
analyze-investor-position-deltas.js
- Overall market sentimentanalyze-popularity-trends-top100.js
- Elite vs masses behavioranalyze-holdings-vs-positions.js
- Accumulation vs distribution patterns
See analysis-tools/README.md
for complete documentation.
- One API fetch collects ALL data (investors, portfolios, trade info, instruments, user details)
- Multiple analyses generated from the same dataset
- No redundant API calls - eliminates rate limiting issues
- Circuit breakers and adaptive delays for reliability
- Trade Info Integration - Fetches trades count and win ratio with fallback handling
- DataCollectionService: Comprehensive data gathering with progress tracking
- AnalysisService: Fast analysis generation without API dependencies
- Smart batching: 50 items per API call with intelligent error handling
- Timeout protection: 30-second timeouts with graceful fallbacks
- Framework: Next.js 15.2.4 with App Router
- Language: TypeScript with strict typing
- Styling: Tailwind CSS with Radix UI components
- Validation: Zod schemas for data models
- Optimized Endpoint:
/api/optimized-report
for all report generation - Streaming: Server-Sent Events for real-time progress
- Error Handling: Comprehensive error boundaries and recovery
- Data Export: JSON data export with all collected information
- Authentication: X-API-KEY, X-USER-KEY, X-REQUEST-ID headers
- Endpoints: Popular investors, user portfolios, instrument details, closing prices
- Data Models: Strongly typed interfaces for all API responses
- Rate Limiting: Intelligent delays and circuit breakers
Generate formatted posts for the eToro community:
# Daily census update
node analysis/generate-daily-post.js
# Weekly summary
node analysis/generate-weekly-post.js
# Monthly report with insights
node analysis/generate-monthly-post.js
src/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β β βββ optimized-report/ # Main optimized analysis endpoint
β β βββ extract-instruments/ # Instrument extraction utility
β β βββ list-reports/ # Report listing endpoint
β β βββ users/ # User data endpoint
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Main dashboard page
βββ components/
β βββ census/ # Analysis components
β β βββ cash-allocation.tsx
β β βββ fear-greed-gauge.tsx
β β βββ investor-selector.tsx
β β βββ portfolio-diversification.tsx
β β βββ returns-distribution.tsx
β β βββ risk-score-distribution.tsx
β β βββ top-holdings.tsx
β β βββ top-performers.tsx
β βββ ui/ # Reusable UI components
βββ lib/
β βββ models/ # TypeScript interfaces
β β βββ census.ts # Analysis data models
β β βββ user.ts # User and investor models
β β βββ user-portfolio.ts # Portfolio data models
β βββ services/ # Optimized business logic
β β βββ data-collection-service.ts # Comprehensive data collection
β β βββ analysis-service.ts # Fast multi-band analysis
β β βββ instrument-service.ts # Asset data service
β β βββ user-service.ts # User data service
β βββ etoro-api-config.ts # API configuration
β βββ utils.ts # Utility functions
βββ middleware.ts # Next.js middleware
The project includes comprehensive analysis tools for deep data insights:
# Key market insights (start here)
node analyze.js deltas
# Bitcoin analysis
node analyze.js btc
# Any instrument trends
node analyze.js instrument nvidia
# Elite investor behavior
node analyze.js top100
# Help and all commands
node analyze.js help
- π Market Behavior: Investor vs position dynamics, trends, accumulation patterns
- π Instruments: Individual asset analysis, top holders, trends over time
- π Elite Insights: Top 100 investor behavior vs general population
- π Examples: Common queries and data exploration
See analysis-tools/README.md
for detailed documentation.
- Node.js 18+
- npm/yarn/pnpm
- eToro API credentials
-
Clone the repository
git clone <repository-url> cd etoro_census
-
Install dependencies
npm install
-
Environment setup Create a
.env.local
file:ETORO_API_BASE_URL=https://www.etoro.com/api/public ETORO_API_KEY=your_api_key_here ETORO_USER_KEY=your_user_key_here
-
Run development server
npm run dev
-
Open browser Navigate to http://localhost:3600
npm run build
npm start
X-API-KEY
: eToro API authentication keyX-USER-KEY
: eToro user-specific keyX-REQUEST-ID
: UUID for request tracking
- Popular Investors:
/v1/user-info/people/search
- User Portfolios:
/v1/user-info/people/{username}/portfolio/live
- Trade Info:
/v1/user-info/people/{username}/tradeinfo?period=currYear
- Instrument Details:
/v1/market-data/instruments
- Historical Closing Prices:
/v1/market-data/instruments/history/closing-price
- User Details:
/v1/user-info/people
(for avatars)
- Single-pass collection: One API fetch collects ALL required data
- Circuit breakers: Automatic error recovery with adaptive delays
- Timeout protection: 30-second timeouts prevent hanging requests
- Smart batching: 50 items per API call with intelligent error handling
- Zero API calls: Analysis generated from pre-collected data
- Multiple bands: 100, 500, 1000, 1500 investor analyses simultaneously
- Shared data: Same dataset used for all analysis bands
- Fast processing: No waiting for redundant API calls
- Server-Sent Events: Real-time progress via
/api/optimized-report
- Detailed progress: Phase-by-phase updates with error rates
- Non-blocking UI: Responsive interface during long operations
- Graceful degradation: Comprehensive error handling and recovery
- TypeScript with strict typing
- ESLint and Prettier configuration
- Consistent naming conventions
- Comprehensive error handling
- Functional components with hooks
- Props interfaces for all components
- Responsive design with Tailwind CSS
- Accessibility considerations
This project is for educational and analysis purposes. Please ensure compliance with eToro's API terms of service.
For questions or issues, please check the existing documentation or create an issue in the repository.