Skip to content

kdotambuj/coin-o-scope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project: Cryptocurrency Stats API

This project is a server-side application built with Node.js and MongoDB that fetches cryptocurrency data (Bitcoin, Ethereum, Matic) from the CoinGecko API and provides various statistics through a set of API routes. The background service runs every 2 hours to update the cryptocurrency prices in the MongoDB database.


Hosted Site

The API is hosted at: https://koinx-assignment-4cav.onrender.com


Requirements

  • Node.js
  • MongoDB
  • npm (Node Package Manager)

Setup Instructions

  1. Clone the repository:

    git clone <repository-url>
  2. Install dependencies:

    npm install
  3. Create a .env file with the following content:

    MONGO_URI=<Your MongoDB URI>
    
  4. Start the server:

    npm start

API Endpoints

  1. Get Latest Cryptocurrency Stats

  2. Get Price Standard Deviation


Background Job

  • The application runs a background job every 2 hours using node-cron that fetches the current price, market cap, and 24-hour price change for Bitcoin, Ethereum, and Matic from the CoinGecko API, and stores it in the MongoDB database.

Folder Structure

crypto-app/
│
├── .env                # Environment variables
├── package.json        # Project dependencies
├── index.js            # Main application entry point
├── models/
│   └── cryptoModel.js  # Mongoose schema for storing crypto data
├── services/
│   └── fetchCryptoData.js  # Service to fetch crypto data from CoinGecko
│   └── saveCryptoData.js   # Service to save the fetched data to MongoDB
└── node_modules/

Dependencies

  • Express: For creating API routes
  • Mongoose: For interacting with MongoDB
  • Node-Cron: For scheduling background tasks
  • Axios: For making HTTP requests to the CoinGecko API

About

Coin-o-scope: Like a horoscope but for crypto! Peeks into cryptocurrency trends and stats. All the tasks has been implemented with the best practises.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors