This project is a backend application developed using Node.js and MongoDB to track cryptocurrency prices for Bitcoin, Matic, and Ethereum. It fetches current market data every minute, stores it in a MongoDB database, and provides APIs for fetching the latest stats and calculating price deviation.
- Fetches and stores the current price, market cap, and 24-hour change for Bitcoin, Matic, and Ethereum.
- Provides an API endpoint to retrieve the latest data for a specific cryptocurrency.
- Calculates and returns the standard deviation of the last 100 price records for a requested cryptocurrency.
- Node.js: JavaScript runtime for building the server-side application.
- Express: Web framework for building APIs.
- MongoDB: NoSQL database for storing cryptocurrency data.
- Mongoose: ODM library for MongoDB.
- Axios: For making HTTP requests to the CoinGecko API.
- Node-cron: For scheduling background jobs.
- dotenv: For managing environment variables.
The data is stored in a MongoDB collection named cryptos with the following schema:
coin: String (required)price: Number (required)marketCap: Number (required)change24h: Number (required)timestamp: Date (default: current date)
Deployed on Vercel at following url: https://koinx-task-harsh.vercel.app
-
Endpoint:
/api/stats -
Method:
GET -
Examples:
-
Endpoint:
/api/deviation -
Method:
GET -
Examples:
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.





