Inspiration

Being part of COINS (Commodity Investing by Students) club, we have inclined interest towards trading and markets research. After facing the difficulties of dealing with a large amounts of data and spending hours and hours of time doing modelling and time-series analysis, we saw it as a big problem that researchers and every person who wants to invest in the market faces all the time. Hence, we thought of building an application that would automate significant amount of analysis using an AI agent.

What it does

It is a comprehensive markets research tool linked with an AI agent, that connects to 470 stock market ETFs time-series data and provide a summarized explanation and econometrics analysis about the symbols selected by the user along with an interactive dashboard and makes the information more accessible and easier to interpret in order to trade and research.

How we built it

We started with building a time-series database and creating an AWS ec2 instance to host it. The database is know as Market Database, which contains time-series data for 470 tickers/ETFs. We created a database manager to connect the database with alpaca API. After connecting, we initialized the database using workbench and hosted it over EC2 instance. We also have an cronjob running over the same instance that updates the data once everyday. The second step was to create a framework that has front-end and backend, and connects to the database to fetch the data based on given requests. We use JavaScript, HTML, CSS for frontend and python in the backend. We connected the ends using Flask. Initially, we started with building an authentication system using which you can login or register. Then in the backend, we added GARCH model and other statistics and connected the AI agent, so that it could read the statistics from there. We made some plots on cumulative returns of the ETFs and volatility analysis on the frontend side. Using, openai API we also created a custom vector database to store the analysis on all the ETF symbols and connected to the AI agent. The vector database updates everyday since we put it on a cronjob. Finally, that led to the creation of an app which has access to real-time daily data and provides the user with accurate econometrics analysis.

Challenges we ran into

  • Setting up database on ec2 instance: When we started with the database framework, we estimated the space of the market database to be around 10 gigabytes, so took small tier on the AWS. But, as we were populating it, it crashed because it ran out of CPU usage, which lead us frustrated us. We tried to figure the problem out and tried to set up new ec2 instance a couple of times, until we figured out the size of our data. The database was 63 gigabytes in memory, then we set-up final ec2 instance (t2-medium) and hosted the database over it.
  • One of the challenge was to set-up a vector database (converting text to vectors in-order to train the AI agent). This challenge was more about patience, while generating the training data and training the AI agent, we failed a lot of times due to insufficient RAM, longer time of iterations etc. But, finally we figured out the vector database by getting the data in smaller batches.

Accomplishments that we're proud of

I thinking completing the project that we initially though of, is the biggest achievement for us. Dribbling the challenges as we encountered them is something we are proud of. We also believe that being considerate towards each other's ideas was something that we are proud of.

What we learned

We learnt not to cry while working with multiple technologies (especially AWS) at one time. Seriously, not giving up is something that we learnt, initially when we faced the ec2 crashing multiple times issue, we thought to give up since the whole project was dependent on the database aspect, but kept working until we figured it out.

What's next for Chapybara

The next thing is to get data on different markets like electricity data, options data, futures data and news data. Being able to make all-in-one econometrics analytics AI agent that provides the real time analysis is the end goal.

Built With

Share this project:

Updates