The Micro-Investment Education Platform is a highly scalable and robust educational application designed to empower beginners in the domain of investment strategies. By leveraging virtual currency to simulate micro-investments in a risk-free environment, this platform allows users to experiment with real-world investment strategies while avoiding the potential downsides of actual financial exposure. The platform's core functionality includes integration with real-time stock data through Alpha Vantage API, providing users with actionable insights into market trends and stock performance. By utilizing MongoDB for efficient data storage and React.js for a dynamic, responsive user interface, the platform ensures an engaging learning experience.
The ultimate goal is to equip users with the technical knowledge and practical skills required to assess risks, forecast market behavior, and appreciate the complexities of portfolio management, all while gaining the confidence to navigate the stock market with informed decision-making capabilities. ππ
- Features
- Code Structure
- Installation
- Demo Recording
- Future Enhancements
- Requirements
- API Interaction with Postman
- Contributing
- Contact
- Virtual Money Management: Each user receives a set amount of virtual currency to simulate real-world investing.
- Real-Time Market Data: Users can access up-to-date stock prices and market conditions through integrated stock market APIs.
- Latest Stock News: The platform provides the latest stock news through a news API, keeping users informed about market trends and events.
- Transaction History: Users can view their transaction histories for buying and selling in a detailed table format, including price per share, date, and time.
- Popular Stocks Section: A dedicated section displays current popular stocks with clickable links to view their live prices.
- Leaderboard & Gamification: Track portfolio performance and foster healthy competition through a leaderboard showcasing top-performing users.
- User-Friendly Interface: A responsive and interactive UI built with React, providing a seamless user experience.
The platform is built using the following technologies:
- Frontend: Developed with React for an engaging user interface.
- Backend: Node.js with Express for handling user authentication, data processing, and API integrations.
- Database: MongoDB stores user profiles, transaction history, and leaderboard data.
- API: Integrated with Alpha Vantage for real-time stock market data and a NEWS API for the latest news.
- Clone the repository:
gh repo clone mariarodr1136/MicroInvestmentPlatform
- Alternatively, if you prefer to use HTTPS:
https://github.com/mariarodr1136/MicroInvestmentPlatform.git
- Navigate to the backend directory:
cd MicroInvestmentPlatform/backend
- Install backend dependencies:
npm install
- Set up the database and configure environment variables:
- Create a
.env
file in thebackend
directory. - Add your API keys and database connection string. Example:
MONGODB_URI= your_mongodb_uri REACT_APP_STOCK_API_KEY= your_react_stock_api PORT=5001
- Start the backend server:
node index.js
- In a new terminal, navigate to the frontend directory:
cd MicroInvestmentPlatform/client
- Install frontend dependencies:
npm install
- Update the API key for news in the LatestNews.js file:
- Open client/LatestNews.js and update line 7 as follows:
const API_KEY = process.env.NEWS_API_KEY; const API_URL = `news_api_url`;
- Start the frontend server:
npm start
Note: To get the necessary API keys:
- For stock market data, register at Alpha Vantage.
- For news data, register at NewsAPI.
MicroInvestmentPlatform.mov
- Personalized Recommendations: Use machine learning to suggest investments based on user preferences and past activities.
- Interactive Tutorials: Add gamified tutorials to teach investment basics and advanced strategies in an engaging way.
- Portfolio Visualization: Create interactive charts to display portfolio performance and growth over time.
- Mobile Application: Develop a mobile app for iOS and Android to make the platform more accessible.
- Node.js (v14 or later)
- MongoDB
- React (v17 or later)
- Stock market and NEWS API access key (e.g., Alpha Vantage)
Once you have a user ID, update your App.js to view data in frontend:
- const userId = '60d21b4667d0d8992e610c85'
You can use Postman to interact with the API and perform various actions. Below are some common operations:
-
Register a User
- Endpoint:
/api/user/register
- HTTP Method:
POST
- Description: Adds a new
User
with username, email, and password. - Request Body:
{ "username": "string", "email": "string", "password": "string", }
- Response: The created
User
object with balance, portfolio, and ID.
- Endpoint:
-
Retrieve All Users
-
Endpoint:
api/user
-
HTTP Method:
GET
-
Description: Retrieves all registered
User
objects -
Response: All
User
objects withid, username, balance
, andstock portfolio
.
-
-
Retrieve a User Portfolio by ID
- Endpoint:
/api/user/{id}/portfolio
- HTTP Method:
GET
- Description: Fetches
User
portfolio by their ID. - Response:
{ "symbol": "stock string", "shares": "integer", "avgPrice": "integer", "id": "integer" }
- Endpoint:
-
Create a Transaction
-
Endpoint:
/api/transactions/buy
-
HTTP Method:
POST
-
Description: Purchase Stock Option
-
Request Body:
{ "userId": "integer", "symbol": "string - Stock symbol", "shares": "integer - Number of shares to buy", }
-
Response: "Stock purchased successfully"
-
Endpoint:
/api/transactions/sell
-
HTTP Method:
POST
-
Description: Sell Stock Option
-
Request Body:
{ "userId": "integer", "symbol": "string - Stock symbol", "shares": "integer - Number of shares to sell", }
-
Response:
{ "message": "Stock sold successfully", "balance": "integer", "soldShares": "integer", "revenue": "integer" }
-
-
Retrieve User Current Balance
- Endpoint:
/api/user/{id}/balance
- HTTP Method:
GET
- Description: Retrieves
User
current balance - Response:
{ "balance": "integer" }
- Endpoint:
Feel free to submit issues or pull requests for improvements or bug fixes. You can also open issues to discuss potential changes or enhancements. All contributions are welcome to enhance the appβs features or functionality!
To contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feat/your-feature-name
- Alternatively, for bug fixes:
git checkout -b fix/your-bug-fix-name
- Make your changes and run all tests before committing the changes and make sure all tests are passed.
- After all tests are passed, commit your changes with descriptive messages:
git commit -m 'add your commit message'
- Push your changes to your forked repository:
git push origin feat/your-feature-name.
- Submit a pull request to the main repository, explaining your changes and providing any necessary details.
If you have any questions or feedback, feel free to reach out at mrodr.contact@gmail.com.