Inspiration
$GME
On a more serious note, keeping up to date with current trends when you are invested in the stock market is an integral part of not losing everything you own. Being able to detect early patterns and hot or cold stocks can either multiply your investment or prevent you from losing enormously. What if you could learn from internet history what these patterns were before the big story develops? We thought that it might be possible to use recent submission history on popular internet sites such as Reddit to detect hot stocks early on, so we went ahead and did it!
What it does
Retalica looks for trends within r/Wallstreetbets to try and identify them before they take off. The application scrapes through submissions from this subreddit and evaluates their popularity so you can be ahead of the trend. Our frontend takes in stock information from our backends and draws out a stock graph for at a glance trends of it’s price. We also provide an easy to navigate web paradigm.
The app has two main functions. The first function displays the top ten trending stocks. The second function allows for users to search the subreddit for a stock and displays various statistics.
How we built it
This project has two distinct hosted parts. The frontend of this app is written in Flutter and Dart. Flutter is a front end API for the Dart language. We leveraged it's simplistic approach to web development to facilitate the development of the webapp. Flutter itself was used by taking it's widgets and weaving them together to build increasingly complex and interesting web pages with embedded functionality. We also used pre-existing packages to help facilitate the functionality and development of the app.
The back end of this app is written entirely using Python and utilizes a Django web server to accept queries from the Flutter app. The HTTP requests are handled and processed by the Django framework and the web scraping is handled by PRAW, which is a Python wrapper to facilitate interacting with the Reddit API. The back end server is hosted on Google Cloud using the Cloud Run API and accepts JSON objects from the HTTP requests sent by our front end to search for specific stock information on the web.
Challenges we ran into
The largest challenge was the development of the figures that represent the stock movements through time. This was a fairly complex functionality and required API’s to pull data, format and process the data to be plotable for the graph. Another large challenge for the front end was the need to find a new API service 8 hours before project submission. This was due to limitations in the pulling capacity of the API, only allowing for 5 pulls a minute where we needed at least 30 a minute. Once we did find a new API, entire sections of code written to process and graph the figure needed to be rewritten. The final major hurdle for the front end team was the time constraints when attempting to design an aesthetic webpage.
We ran into several algorithmic and storage related challenges when developing the back end of this app. One of the biggest challenges we faced was developing an effective way to compare Reddit submission titles against our list of stocks that we were looking for. Because of the lack of any consistent (and sometimes not even coherent) formatting on the internet, doing any kind of strict comparison between stock and title was off the table. We spent several hours iterating through various methods of formatting our strings to avoid as many false positives (where a stock ticker appears in the title, but in another word and not as the stock itself) and false negatives (where, for example, a company name is abbreviated in a submission title which renders the comparison false when it shouldn’t be) as possible. We ended up taking several measures to enhance accuracy through mass text editing of our lists, generating new lists with altered stock information to be more detectable, ignoring comparisons with strings too short to be safe, and several other preventative measures.
Another issue we encountered was working with the cloud to upload our back end server for outside access. The depth of Google’s cloud services is utterly terrifying for complete beginners to sink their teeth into, and we really struggled to find the right help to get our server up and running. Once we were able to settle on using Cloud Run, we iterated through several versions of the Docker file used to build the app until we were finally able to compile a stable version onto the cloud.
Accomplishments that we're proud of
We’re proud to have set such ambitious goals with regards to new languages, technologies, and visions and achieved everything we set out to and more. We’re also proud about how well our front end to back end data transfer performs (when we were able to flawlessly communicate both ways, our entire group’s morale improved ten-fold) and being able to put existing packages and technologies to good use enhancing this project. Being able to run our back end server on Cloud run and access it from anyone’s computer was an extremely satisfying payoff to several hours of stressing over hosting options. We’re also proud of the metric we developed to categorize stock popularity and its balanced reflection of several pieces of data about a submission. The Frontend team was most proud of our accomplishments in compiling the market figures. While being an extensive labor, success proved extremely satisfying in the end.
What we learned
Even being a mix of Hackathon first-timers and experienced veterans, our entire team learned far more than we expected to from the start. On the back end of the project, we learned how to implement the Django framework, use PRAW to interact with Reddit, and take advantage of the Google Cloud API. We were given plenty of time to develop our knowledge of Python and web services working with Django. We also learned how to work with HTTP and how to handle JSON objects. PRAW was an essential tool to this project and entirely new to us. We learned how to create a Reddit instance and use that instance to retrieve data on the posts within the Subreddit. Finally, we learned how to create projects on Google Cloud and set up our environment to upload our work to be hosted. With regards to the front end work, the team learned a lot about the flutter application and it's expansive community. We also learned a lot about HTTP requests when doing connections with the backend and linking those with flutter.
What's next for Retalica
The sky is truly the limit for Retalica. We thought about some minor changes such as including more stocks in our database or optimizing our data structures and algorithms. Retalica could see an implementation of paper trading as a more advanced move forward. We also talked about adding more search features to allow users to search different subreddits or possibly even different websites. We would also like to expand our popularity function by adding more metrics to make the results truly reflect rising trends.
Team Leader: Brandon Ward - https://swamphacks-vii.slack.com/archives/D01LMRPCJKW
Backup contact: Elijah Smith - https://swamphacks-vii.slack.com/team/U01L5G7Q6MU


Log in or sign up for Devpost to join the conversation.