-
Overview: A server-side website that retrieves real-time cryptocurrency data for Bitcoin, Matic, and Ethereum using the CoinGecko API.
-
Key Features:
- Fetches the latest cryptocurrency statistics, including price, market cap, and 24-hour change.
- Runs a background job every 2 hours to automatically update and store data.
- Provides two API endpoints:
/stats
: Returns current data for a specified cryptocurrency./deviation
: Calculates the standard deviation of prices from the last 100 records.
-
Technologies Used:
- Node.js and Express.js for server-side development.
- MongoDB (or another database) for data storage.
- Axios for making API requests to CoinGecko.
- Cron for scheduling background jobs.
-
Setup Instructions:
- Install dependencies using
npm install
. - Configure your database connection in a
.env
file. - Start the server with
npm start
.
- Install dependencies using
-
API Endpoints:
-
/stats?coin=bitcoin
: Returns the latest price, market cap, and 24-hour change.{ "price": 40000, "marketCap": 800000000, "24hChange": 3.4 }
-
/deviation?coin=bitcoin
: Returns the standard deviation of the price based on the last 100 records.{ "standardDeviation": 4082.48 }
-
This project offers an efficient way to access real-time cryptocurrency statistics, making it a valuable resource for developers and enthusiasts.