Inspiration
The inspiration for Neural Networth came from my fascination with the stock market and real-time trading. I wanted to create an interactive platform where users could experience the thrill of trading in a dynamic market environment, without the risks associated with real-world trading.
What It Does
Overview
I have developed a real-time trading simulation game built using React (Vite) for the frontend, a Go backend, and a MongoDB database.
The game simulates a dynamic trading environment where players can execute trades and react to market fluctuations.
- Companies: Companies are listed on the market and have stocks that can be bought or sold. Each company has a ticker symbol, a name, and a value.
- Market: Created by Gemini, the market is a dynamic environment that changes every round. The market is influenced by the actions of the players.
- Portfolio: Players can view their portfolio, which shows their current holdings and their value.
- Trades: Players can execute trades to buy or sell stocks. Trades are executed in real-time and affect the market.
How I Built It
Neural Networth is a real-time market simulation platform I built using state‑of‑the‑art web technologies. My backend is built with Go and Gin, enabling rapid HTTP development and robust WebSocket support for real-time communication. The frontend is developed in React with Vite for lightning‑fast builds and modern component architecture. MongoDB powers my database, providing scalability and flexible data models. I incorporated WebSockets to ensure that changes in market data and portfolio states are delivered instantly to users.
Tech Stack
- Frontend: React (Vite)
Leveraging component‑based architecture for modular and maintainable user interfaces. - Backend: Go (Gin)
Offering high performance with efficient concurrency patterns and robust REST and WebSocket communication. - Database: MongoDB
A NoSQL solution chosen for its flexibility and scalability in managing market data. - Real-time Communication: WebSockets
Ensuring seamless, low‑latency updates between the server and client, critical for market simulations.
Challenges I Ran Into
CORS & WebSocket Integration:
Integrating Cross-Origin Resource Sharing (CORS) with WebSockets under tight deadlines posed significant challenges. I addressed these by carefully configuring Gin and Gorilla WebSocket to allow all origins during development and later tightening security for production.Concurrency & Thread-Safety:
Managing real‑time rounds and portfolio updates required careful handling of race conditions and thread‑safety. I implemented robust locking mechanisms in my round management logic to ensure consistent state updates.Scalability Under Time Constraints:
Balancing rapid feature development with ensuring a maintainable codebase was challenging. I focused on auto‑scaling rounds and real‑time updates without compromising performance.Deployment of Backend:
I faced significant challenges in deploying the backend. Despite having a functional backend locally, setting up the deployment environment proved difficult. Time constraints and complexities with server configurations hindered my ability to properly deploy the Go-based backend. Issues with hosting services, containerization, and ensuring compatibility between the frontend and backend systems meant that I could not make the backend accessible over the web in time for the project deadline. This was a crucial part of the project, and not being able to deploy it limited the functionality that users could experience. Moving forward, I plan to delve deeper into backend deployment strategies, perhaps utilizing cloud platforms like AWS or Docker containers to streamline this process.
Accomplishments That I'm Proud Of
Real-Time AI Market Simulation:
Successfully built an AI-driven market simulator that allows users to participate in dynamic rounds and interact in real time.Robust Backend Architecture:
My Go‑based backend efficiently manages WebSocket connections, ensuring that real‑time data flows seamlessly without interruption.Streamlined Frontend Experience:
Utilization of React with Vite has enabled me to create a responsive, modern user interface that feels both fast and intuitive.
What I Learned
Integration of Diverse Technologies:
Working across Go, React, and MongoDB has given me a deeper understanding of how to integrate disparate systems into a cohesive platform.Real-Time Communication Nuances:
I learned the intricacies of WebSocket communication alongside dealing with browser-specific CORS policies.Building Under Pressure:
Tight deadlines pushed me to focus on essential functionality and make smart decisions about trade-offs between feature complexity and release schedules.
What's Next for Neural Networth
Enhanced AI Decision Making:
I plan to improve the AI algorithms powering the market simulation, providing more dynamic and realistic market behaviors.Expanded User Features:
Upcoming features include leaderboards, detailed portfolio analyses, and social features that allow users to compete and collaborate in a simulated market environment.Scalability & Security Enhancements:
Improvements in the backend architecture and WebSocket management are planned to handle a growing user base while ensuring the platform remains secure.
Game Features
Rounds: The game is played in rounds, with each round representing a day in the market. At the end of each round, the market changes, and players can see how their trades have affected the market and their portfolio.
Advisors: Provide advice on when to buy or sell stocks, given by Gemini. Sometimes they are right, sometimes they are wrong.
News: News articles that affect the market. News articles are generated by Gemini and can be positive or negative.
Neural Networth is only just beginning its journey. With each iteration, I plan to introduce new features to enrich the simulation and make it a truly engaging experience.
Log in or sign up for Devpost to join the conversation.