Causality is a web-based stock trading simulation app built using Next.js, Firebase, and the Finnhub API. It allows users to create a virtual portfolio, track real-time asset prices, and review transaction history.
Causality.mov
Before running the application, make sure you have the following installed and configured:
- Node.js (v16 or higher)
- npm or yarn
- Firebase project with:
- Google Authentication enabled
- Firestore database enabled
- Finnhub API key
- User Authentication: Sign in securely using your Google account via Firebase.
- Real-Time Stock Prices: Live stock data from Finnhub API for realistic simulation.
- Buy & Sell Stocks: Trade virtual shares with a simulated balance.
- Watchlist: Add favorite stocks to your personal watchlist.
- Transaction History: Track and review past buy/sell activity.
- Responsive UI: Built with Tailwind CSS and React for a seamless experience across devices.
causality/
├── app/
│ ├── account/
│ | ├── page.js
│ ├── Components/
| | ├── account.js
| | ├── ...
| ├── dashboard/
│ | ├── page.js
│ └── config.js
├── public/
├── .env
└── ...
- Clone the repository
git clone https://github.com/yourusername/causality.git
cd Causality/causality
- Install dependencies
npm install
# or
yarn install- Set up environment variables
Create a .env file in the root directory and add:
NEXT_PUBLIC_FINNHUB_API_KEY=your_finnhub_api_key- Configure Firebase
Create a Firebase project and update
/app/config.jswith your Firebase project credentials or include it in your.envfile:
export const firebaseConfig = {
apiKey: "YOUR_API_KEY",
authDomain: "YOUR_PROJECT.firebaseapp.com",
projectId: "YOUR_PROJECT_ID",
storageBucket: "YOUR_PROJECT.appspot.com",
messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
appId: "YOUR_APP_ID"
};- Start the development server
npm run dev
# or
yarn devOpen your browser and go to http://localhost:3000
- Sign in with your Google account.
- Search and add stocks to your watchlist.
- Buy and sell stocks with your virtual balance.
- Monitor your portfolio and review the transaction history.
- Simulate trading strategies without any financial risk.
Enjoy paper trading with Causality