Inspiration
The inspiration for the project came from MongoDB's Atlas Vector Search capability along with the sample Analytics dataset. My initial idea was to find 'similarity' in the dataset and explain the implication of the comparison to the user. This way, the user can clearly understand their divergence compared to their peers and consider the AI's recommendation for the future.
What it does
When a user enters their username, the app finds the user in the database and does a $vectorSearch on their portfolio vectors to identify the top five customers with similar portfolios. Finally, the application finds all unique stocks of the most similar twin and passes them with the user's unique stocks to the AI to analyze the difference between their portfolios.
How we built it
First, the transactions collection in the Analytics dataset was processed to create one-hot encoded vectors representing each customer's unique stock portfolio. These 18-dimensional vectors were then stored in a portfolio_vector field within the customers collection. Next, I configured a Vector Search Index in the Atlas UI. This index powers the core findSimilarCustomers function, which executes a $vectorSearch query to find the top five most similar investors. For the application, I used Firebase Studio to quickly generate the Next.js frontend and the Genkit AI flow. Then, I manually integrated custom API routes to handle the backend logic, connecting the UI to the MongoDB database and the Gemini model.
Challenges, Accomplishments and Learnings
This hackathon was both insightful and challenging for me as I had no prior experience with MongoDB or concepts like vector embeddings and searches. The initial learning curve was steep and I had missed out on a lot of time. However, I decided to try and create a small simple project to learn about these critical technologies.
I'm proud of overcoming initial hurdles and successfully creating a full-stack application that can accomplish its task. I am grateful to Google's amazing AI development tools that significantly sped up the development of this application and enabled me to complete this project on time. Lastly, this hackathon pushed me to learn about these crucial concepts and gave me confidence to continue building with cutting-edge AI tools.
What's next for Investor Twin
The next evolution for Investor Twin would be to replace the simple one-hot encoded vectors with sophisticated, dense embeddings using Vertex AI's Embedding API. This would allow the application to create richer 'financial fingerprint' for each investor, incorporating the stocks they own as well as data like transaction volume and the financial sectors of their holdings.
With this deeper understanding, the AI agent could then perform a more detailed analysis, comparing a user's nuanced strategy to the current market and providing clear, actionable next steps for their investment journey.
Built With
- cursor
- firebase
- genkit
- google-cloud
- mongodb
- nextjs
- node.js
- shadcn
- tailwindcss
- typescript
Log in or sign up for Devpost to join the conversation.