This project is a real-time opinion trading platform where users can place bets or opinions on different events, similar to prediction markets.
The system is designed to handle real-time updates and asynchronous order processing for the order book. Below is a breakdown of the architecture:
-
Client:
- Users places/trades new orders and receiving real-time updates on the order book.
- Orders are submitted to the backend for processing.
-
Backend:
- The backend handles the core application logic and communicates with the queue for order management (orderbook).
- It processes incoming requests and interacts with other services to handle new orders and match them efficiently.
-
Queue:
- Orders are placed in a queue by asynchronously handling of multiple orders without blocking the system.
-
Worker:
- Workers consume orders from the queue and update the order book, performing the core matching logic to ensure the order book is always up-to-date.
- After processing the order, the workers push updated order book data to the WebSocket server.
-
WebSocket Server:
- Responsible for broadcasting real-time updates of the order book to all connected clients.
- Ensures that users always have the latest information and that their views are synchronized across all sessions.
-
Real-time Order Book Updates:
- The platform provides live updates to all connected clients using WebSockets. When an order is placed, the order book is immediately updated and broadcast to all users.
-
Dynamic Order Matching:
- The platform adjusts the prices and quantities in the order book dynamically based on the incoming orders.
-
Portfolio Management:
- A new
/portfolio
endpoint will be introduced to track user gains and losses based on the fluctuation of top prices in the order book.
- A new
-
Payment Integration:
- We have integrated Cashfree to enable secure and seamless payments within the platform.
We welcome contributions to the project! If you have any ideas or suggestions, please feel free to open an issue or submit a pull request. We are always looking for ways to improve and expand the functionality of the platform.