This project is an API service that calculates the asset-wise balance of an account at any given timestamp. The API uses a MongoDB database to store transaction data and allows users to query the balance of various assets (such as BTC, MATIC, etc.) at specific timestamps.
- Asset Balance Calculation: Retrieve the balance of assets like BTC, MATIC, etc., at any specified timestamp.
- Mongoose Integration: Uses Mongoose to connect to a MongoDB Atlas database.
- CSV Data Import: Import transaction data from CSV files into the MongoDB database.
- Node.js: Make sure you have Node.js installed (v14.x or later).
- MongoDB Atlas: This project uses a MongoDB Atlas cluster. Ensure you have a MongoDB Atlas account and cluster set up.
-
Clone the Repository:
git clone git@github.com:ashish07-07/KoinX.git cd Koinx
-
Install Dependencies:
npm install
-
Set Up Environment Variables: Create a
.env
file in the root directory and add the following:MONGODB_URI="your_mongodb_connection_string"
-
Build the Project:
npm run build
-
Run the Project:
npm start
![New users](./PUBLIC/image.jpg)
-
POST /api/balance
Send a POST request to http://localhost:3000/api/balance
with a JSON body containing a timestamp
to get the balance of assets at that timestamp.
- src/
index.ts
: Entry point of the application.routes/
: Contains the API route handlers.db/schema.ts
: Defines the Mongoose schema for the transactions.