This project is an experiment that pits a ChatGPT-powered AI trader against a "monkey" trader (simulating random stock picks) in a virtual stock market (using real market news and data). The goal is to compare the performance of AI-driven trading strategies against random selection over time.
- Real-time stock market data integration
- AI-powered trading decisions using ChatGPT
- Random stock selection for the "monkey" trader
- Automated trading simulation
- Performance tracking and visualization
- Web interface to view results and trading history
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- Backend: Python (AWS Lambda)
- Database: AWS DynamoDB
- Deployment: Vercel (frontend), AWS SAM (backend)
- APIs: OpenAI API, Yahoo Finance API
- Node.js (v14 or later)
- Python 3.9
- AWS CLI
- SAM CLI
-
Clone the repository:
git clone https://github.com/belkacemb/monkey-vs-gpt.git cd monkey-vs-gpt
-
Install frontend dependencies:
cd app npm install
-
Set up backend:
cd ../functions/daily-trade pip install -r requirements.txt
-
Set up environment variables:
- Create a
.env.local
file in theapp
directory with the following variables:NEXT_PUBLIC_BASE_URL=http://localhost:3000 AWS_DB_REGION=your-aws-region AWS_DB_ACCESS_KEY=your-aws-access-key AWS_DB_ACCESS_SECRET=your-aws-secret-key
- Create an
env.json
file in thefunctions/daily-trade
directory with:{ "DailyTradeFunction": { "OPENAI_API_KEY": "your-openai-api-key", "TRADING_TABLE_NAME": "TradingTable" } }
- Create a
-
Start the frontend:
cd app npm run dev
-
Deploy the backend:
cd functions/daily-trade sam build sam deploy --guided
-
Visit
http://localhost:3000
to view the application.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.