π€ Prompt for AI Developer
Copy and paste this entire prompt to your AI coding assistant:
YOUR TASK
You are tasked with UPDATING an existing HuggingFace Space to implement a comprehensive cryptocurrency data API with 30+ endpoints.
β οΈ CRITICAL: THIS IS AN UPDATE REQUEST, NOT A NEW PROJECT!
You are NOT creating a new HuggingFace Space. You are UPDATING and ENHANCING an existing one.
MANDATORY READING ORDER
You MUST read the following files in this EXACT order before starting implementation:
Step 1: Read HF_DEPLOYMENT_SUMMARY.md (5 minutes)
- Get quick overview of the project
- Understand what we're building and why
Step 2: Read SEND_TO_HF_TEAM.md (10 minutes)
- Understand the official scope and priorities
- Review success criteria
Step 3: Read DATA_ARCHITECTURE_ANALYSIS_REPORT.md (30 minutes)
- Understand current architecture
- Identify problems we're solving
- Review proposed solution
Step 4: Read HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md (2-3 hours) β THIS IS YOUR MAIN REFERENCE
- Complete specifications for ALL 30+ API endpoints
- Request/Response formats with examples
- Complete Python/FastAPI implementation code
- Data source integration (CoinGecko, Binance, NewsAPI, etc.)
- Caching strategy with Redis
- Rate limiting implementation
- AI/ML model integration (BERT, LSTM)
- WebSocket real-time implementation
- Dockerfile and requirements.txt
- Environment variables
- Testing procedures
- Deployment steps
This file contains EVERYTHING you need. Read it thoroughly.
Step 5 (Optional): Read ENGINEERING_GUIDE.md (1 hour)
- Coding standards and best practices for this project
WHAT TO IMPLEMENT
You need to implement a FastAPI backend with:
REST API Endpoints (25+ endpoints):
Market Data:
- GET
/api/market- List of cryptocurrencies - GET
/api/price/{symbol}- Current price - GET
/api/ohlcv- Chart data (OHLCV/candlestick) - GET
/api/ticker/{symbol}- Real-time ticker
News & Sentiment:
- GET
/api/news/latest- Latest crypto news - GET
/api/sentiment/global- Global market sentiment (Fear & Greed) - GET
/api/sentiment/symbol/{symbol}- Symbol-specific sentiment
Trading:
- GET
/api/exchange-info- Trading pairs and exchange info - GET
/api/orderbook/{symbol}- Order book depth - GET
/api/trades/{symbol}- Recent trades
AI & Predictions:
- GET
/api/ai/signals- AI trading signals - POST
/api/ai/predict- Price predictions - GET
/api/ai/analysis/{symbol}- Comprehensive AI analysis
Blockchain:
- GET
/api/blockchain/transactions/{address}- Transaction history - GET
/api/blockchain/whale-alerts- Large transaction alerts
Statistics:
- GET
/api/stats- Global market statistics - GET
/api/stats/dominance- Market dominance breakdown - GET
/api/history/price/{symbol}- Historical price data
WebSocket Endpoints (2 channels):
- WS
/ws/ticker- Real-time price updates - WS
/ws/trades- Real-time trade stream
Special Endpoints:
- GET
/health- Health check - GET
/docs- API documentation (auto-generated by FastAPI)
TECHNICAL REQUIREMENTS
Tech Stack:
- Python 3.9+
- FastAPI framework
- Redis for caching
- aiohttp for async HTTP requests
- PyTorch + Transformers for AI models
- ccxt for exchange integration
- WebSockets for real-time updates
Data Sources to Integrate:
- CoinGecko API - Market data (primary)
- Binance API - OHLCV and trades (primary)
- NewsAPI / CryptoPanic - News feeds
- Alternative.me - Fear & Greed Index
- AI Models - ElKulako/cryptobert for sentiment, custom LSTM for predictions
Key Features:
- β Automatic Fallback - If CoinGecko fails, try Binance, then CMC
- β Smart Caching - Different TTL for different data (5s-10min)
- β Rate Limiting - Respect external API limits
- β Error Handling - Consistent JSON error format
- β CORS Enabled - Allow all origins
- β Async/Await - All endpoints must be async
IMPLEMENTATION STEPS
Phase 1: Setup
- Access the existing HuggingFace Space repository
- Set up Python 3.9+ environment
- Install Redis (local or cloud)
- Create virtual environment
- Install dependencies from requirements.txt (provided in specs)
Phase 2: Core Framework
- Create FastAPI application
- Configure CORS middleware
- Set up Redis connection
- Create health check endpoint
- Test basic server startup
Phase 3-9: Implement All Endpoints
Follow the detailed specifications in HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md for each endpoint.
Priority order:
MUST HAVE (implement first):
- GET /api/market
- GET /api/ohlcv
- GET /api/news/latest
- GET /api/sentiment/global
- GET /api/ai/signals
SHOULD HAVE (implement second):
- All other REST endpoints
- WebSocket /ws/ticker
NICE TO HAVE (if time permits):
- Advanced AI features
- Blockchain endpoints
Phase 10: WebSocket
- Implement connection manager
- Create ticker channel
- Create trades channel
- Test real-time updates
Phase 11: Performance
- Implement caching layer (Redis)
- Add rate limiting
- Optimize queries
Phase 12: Testing
- Test all endpoints individually
- Test error scenarios
- Test fallback mechanisms
- Load test with concurrent users
Phase 13: Deployment
- Create Dockerfile (example provided in specs)
- Configure environment variables in HF Space
- Push to HuggingFace Space
- Verify all endpoints in production
- Monitor for 24 hours
CRITICAL REMINDERS
β οΈ THIS IS AN UPDATE!
β
You are UPDATING an existing HuggingFace Space
β
DO NOT create a new space
β
ADD new endpoints to existing deployment
β
ENHANCE existing functionality
β
Keep existing features working
β οΈ QUALITY STANDARDS
β
All endpoints MUST return valid JSON
β
All errors MUST follow standard format (see specs)
β
All endpoints MUST have caching
β
All responses MUST include timestamp
β
All code MUST use async/await
β
All data sources MUST have fallback mechanisms
β οΈ PERFORMANCE REQUIREMENTS
Response Times:
- Price endpoints: < 100ms
- Market data: < 500ms
- News/Sentiment: < 1s
- AI predictions: < 2s
Caching TTL:
- Prices: 5 seconds
- OHLCV: 60 seconds
- News: 5 minutes
- AI signals: 2 minutes
β οΈ ERROR FORMAT (use this for ALL errors)
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "Human readable message",
"details": {}
},
"timestamp": 1733432100000
}
SUCCESS CRITERIA
You are DONE when:
β
All 30+ endpoints return valid responses
β
WebSocket connections are stable
β
Caching improves response times
β
Fallback mechanisms work when primary source fails
β
AI models generate predictions
β
/docs endpoint shows interactive API documentation
β
/health endpoint returns service status
β
All endpoints tested in production
β
No errors in logs for 24 hours
β
Response times meet requirements above
WHERE TO FIND INFORMATION
While implementing, refer to these files:
| Need | Check File | Section |
|---|---|---|
| Endpoint specs | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
"DETAILED API SPECIFICATIONS" |
| Request/Response formats | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
Each endpoint section |
| Backend code | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
"TECHNICAL REQUIREMENTS" |
| Data sources | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
"Data Sources Integration" |
| Caching code | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
"Caching Strategy" |
| AI models | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
"AI/ML Models Integration" |
| WebSocket code | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
"WebSocket Implementation" |
| Dockerfile | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
"DEPLOYMENT CONFIGURATION" |
| Testing | HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md |
"VERIFICATION CHECKLIST" |
COMMON MISTAKES TO AVOID
β DON'T DO THESE:
- β Create a new HuggingFace Space (it exists! UPDATE it!)
- β Remove or break existing functionality
- β Hard-code API keys in code (use environment variables)
- β Skip error handling
- β Ignore caching requirements
- β Use synchronous code (must be async)
- β Return inconsistent response formats
- β Deploy without testing locally first
β DO THESE:
- β Update the existing Space
- β Use environment variables for all secrets
- β Implement proper error handling everywhere
- β Add caching to every endpoint
- β Test locally before deploying
- β Use async/await throughout
- β Follow the standard response format
- β Implement fallback mechanisms
- β Log all errors properly
YOUR STARTING POINT
First Actions:
- Read
HF_DEPLOYMENT_SUMMARY.md - Read
SEND_TO_HF_TEAM.md - Read
HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.mdcarefully (your main reference)
Then:
- Set up your local development environment
- Access the existing HuggingFace Space repository
- Start implementing Phase 1 (Setup)
- Follow the implementation steps above
- Test thoroughly
- Deploy
FINAL CHECKLIST
Before you start coding, confirm:
- I understand this is an UPDATE, not a new project
- I have read all required documentation
- I understand the priority order (MUST/SHOULD/NICE TO HAVE)
- I have access to the existing HuggingFace Space
- I have Python 3.9+ installed
- I have Redis installed or know how to use cloud Redis
- I understand the success criteria
- I know where to find specifications (main file:
HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md)
ESTIMATED TIME
- Reading documentation: 3-4 hours
- Setup: 1-2 hours
- Implementation: 3-5 days (full-time work)
- Testing: 1-2 days
- Deployment: 1 day
Total: 5-8 days for complete implementation
π BEGIN NOW
Start by reading: HF_DEPLOYMENT_SUMMARY.md
Your main reference: HUGGINGFACE_SPACE_DEPLOYMENT_REQUEST.md (contains ALL specifications and code)
Remember: This is an UPDATE REQUEST. You are enhancing an existing HuggingFace Space, not creating a new one.
Good luck with the implementation! π―
Version: 1.0
Date: December 5, 2025
Project: Dreammaker Crypto Trading Platform
Type: HuggingFace Space Update Request
Priority: HIGH