Our first 2018 Hackathon

METHODOLOGIES

By
Quentin
Vika

January 30, 2018


Each month, we organize a two-day internal hackathon during which WATTx-ers dedicate their time to working on side projects and get a chance to explore new trends in design, tech, and data science. In January, the number of projects and the enthusiasm of the team was astonishing. We hacked on projects around Cryptocurrency, smart meeting rooms, and various new usages of the Raspberry Pi. Here’s what we did.


A Tracking Tool for Your Crypto Portfolio

Current cryptocurrency exchange platforms do not calculate the average cost of shares a person is holding at any given point of time, making it hard for investors to determine their balance. What all exchanges have in common is an indicator on the ticker for a specific coin and information on how each coin is behaving compared to its performance of the last 24 hours.

The screenshot shows the an example of the performance of each coin in respect to the previous day (24h)

Our Software Engineer Omar, who likes to invest in cryptocurrencies himself, built a command line tool that pulls all wallet balances. Then, it calculates the average stock price (by adding up the total cost of the buys and dividing it by the sum of the prices per share).

Omar’s result is a tool that can determine the average sell and buy price of all ongoing transactions an investor has made.

For the next hackathon project, Omar plans to make the tool look at trades and movements of each wallet in order to determine which coins make up the balance someone is currently holding. This way, it is possible to determine the average cost per share of the current balances instead of the entire history of trades. In a next step, he plans to connect his tool to other exchanges easily, and finally, Omar would like to convert from a Command Line Interface (CLI) to an API service, as the first is only accessible via terminal whereas an API service could be placed on a server and therefore consumed by a frontend or another App.


Cryptocurrency Price Prediction or “How to get 4x richer in 28 days”

For this Hackathon, our new Data Scientist Kostya took on the challenge to predict the very dynamic price fluctuation of current cryptocurrencies.

In order to do so, he first collected historical data (from the 28th April, 2013 till the 10th January, 2018) on every cryptocurrency’s daily market price from Kaggle. The data consisted of each currency with its abbreviation; the trading date; the opening and closing price, as well as the highest and lowest value within a day; and the trading volume and market capitalizations, as can be seen in the table below.

In a next step, he generated features based on the coin closing price for the past 24 days using the Refresh library with its many built-in calculators. The goal was to identify the closing price of the following day. An exemplary illustration can be seen in this table:

Finally, Kostya selected the top 65 cryptocoins and built a model that he used for the next day predictions and also for long term predictions.

Eventually, by trying to use prediction results to simulate trading activity, Kostya found out that his current model was not good enough for making decisions based on it. The simple strategy of investing into a few cryptocurrencies and waiting yielded better results.

For the next hackathon, Kostya has a lot of ideas on how to improve his model, such as trying to use more features or more coins, or make use of external sources like Twitter or detailed trading data.


Crypto-Analytics

During this hackathon, our Head of Data Science Rafael set out to gather quantitative information about the current state of the cryptocurrency market by connecting to different data sources, and then, in a consecutive step, analyse and visualise that data. The resulting metrics could potentially then be used to make informed decisions for traders and investors.

Using Python and Jupyter notebooks, Rafael retrieved data from multiple APIs and looked into interesting metrics to identify patterns from the extracted data. The results were very promising as he was able to cross-check various data sources in order to understand better where to invest, for what exact reasons and at what point in time.

For future hackathons, an objective of his is to continue expanding this initial approach with more sophisticated metrics and technical analyses.


Gasoline Dreams - Visualizing Prices From Gas Stations Over Time

As someone who frequently drives a car, our Software Engineer Tassilo is always interested in where to find the cheapest gas station. For this reason, he decided to investigate and visualise the change of prices for different gas stations around Berlin.

To do his calculations, Tassilo used data published by the Bundeskartellamt since 2013. Although it isn’t a straightforward process to gain access to the data directly from the Bundeskartellamt, he was able, with the help of the website Tankerkönig, to gather the historical data in a Postgres dump. He then loaded the historical data into a dockerized Postgres database in order to explore it by using a Jupyter notebook.

The dataset from Tankerkönig contained about 15K gas stations with over 90M price changes from the years 2016 and 2017. From this dataset, Tassilo first started to extract the gas price for E10 fuel for a particular day for each gas station in Berlin. For visualization he used Folium, a Python wrapper around leaflet (a Javascript mapping library). After that, he mapped the prices to a color ramp from green and cheap (1,20€) to yellow and costly (1,40€), and displayed the gas stations as colored dots in a map.

But Tassilo wasn’t done yet. He further set out to display the price with Voronoi diagrams - diagrams that divide spaces into cells according to a set of points; in this case the locations of the individual gas stations. Next, he extracted weekly averages of the E10 price per gas station and stored it in a JSON file, while using leaflet and d3 (another Javascript visualization library) to load the data. To display the data, Tassilo made use of colored Voronoi cells according to the E10 price (green and yellow).

And the result is worth checking it out: an interactive map where you can get a general overview of the gas prices in Berlin and Germany, and how they change for each location. In addition, with the help of a slider, you can go through the weeks of the year 2017 to see how the prices change over time.


“Alexa, tell Pablo”

Our IoT Engineer Pedro is a big fan of the voice-UI Alexa developed by Amazon. He uses the voice-command system in the office and also at home, and enjoys experimenting with its various skills.

For this hackathon, Pedro’s objective was to enable Alexa to execute and respond to commands, such as “Alexa, ask Pablo what the temperature inside my house is”, using a Raspberry Pi that adds the possibility of easily connecting sensors. In order to be able to do so, he built an Alexa skill that triggers an AWS Lambda function which in turn writes to AWS IoT. The Raspberry Pi then listens to an MQTT topic and sends the intent to Alexa which performs the action.

The results of Pedro’s successful hackathon experiment are that we at WATTx now can open the door to our office, take a picture from the camera attached to the Raspberry Pi which was subscribed to the MQTT topic, or turn on the TV in one of our meeting rooms just by asking Pablo - the name given to our new voice assistant - all through Alexa.

Pedro’s intended next steps? To make Pablo even better by further developing it in a way that would enable anyone owning an Amazon Echo and a Raspberry Pi to use it.


Turning Raspberry Pi into a Remote Controller

Nowadays, it is possible to make each home smarter by using the Amazon’s Echo Dot. This smart device can for instance turn on smart lights installed in a living room, simply by asking Alexa.

However, there are still household legacy appliances, such as LED lights used for decorating christmas trees or windows, that are not connected to the Internet and can only be controlled via a remote control. Our Software Developer Wen wanted to change that.

In this hackathon, he repurposed a Raspberry Pi to act as a TV controller by regulating an infrared light to mimic the real signal coming from a TV controller. He also exposed an API endpoint locally that allowed a user to launch commands.

Raspberry Pi as a TV Controller

In the end, Wen’s project integrated with Pedro’s (see ““Alexa, tell Pablo”) and allowed to instruct Alexa to, for instance, turn on the TV in one of our meeting rooms.

Unfortunately, Wen wasn’t able to find the LG TV controller infrared protocol needed for our specific TV model. Instead, he used the LIRC library and an infrared receiver to get the real signal from the controller and to decode it in a further step. Based on this decoding, Wen sent the infrared light to mimic a TV controller.

In the next hackathon, Wen will use a smaller chip, for instance one from Wemos instead of Pi, which is more affordable and less energy-consuming.


What’s Going on in Our Meeting Rooms? Pt. II

Our developers Blake and Franziska decided to pick up the project regarding meeting room occupancy they had started in November: An issue we often encounter here at WATTx is that once the doors to our meeting rooms are shut, there is no way of knowing what is going on inside: Is there anyone in the room? Can I just walk in, or is there an important meeting going on? You may have encountered the issue in your own company.

This time, Blake and Franzi finished the project in two days, and the results are promising: they installed displays in front of our two meeting rooms that now tell us if the room is free within the next hour or occupied, and, in case of the latter, who the organizer of the respective meeting is. Additionally to the two E-Ink displays they used in the previous hackathon, they ordered a third one with the ability to display more colours (black, white and red). However, the technical architecture on the Raspberry Pi remained untouched.

The E-Ink display shows the occupancy of our Small Meeting Room


KiwiPI gets a face-lifting

Do you remember Rafal’s project regarding face recognition and smart doors? Back in August, September, and October 2017, our Software Engineer Rafal built a system he called KiwiPi, using a Raspberry Pi and the App Kiwi, which is able to open our entry door using a face-recognition algorithm.

For the January hackathon, Rafal decided to pick up the project again in order to add visual feedback to it, as the process of opening the door would sometimes lead to frustration among colleagues in the office when the feedback on whether their faces were captured correctly or not wasn’t given. More precisely; it was impossible to assess whether it was a network or an API issue, or if the face-recognition had failed.

For the visual element, Rafal added a small OLED display (Adafruit 128x64) to the KiwiPi which displayed a live preview to the person standing in front of it. Furthermore, it notified users about all steps happening when a request was processed: capturing, processing, success, failure, or network issue, etc.

To avoid a burn-in (permanent image retention) of the OLED display, he also added an extra “screensaver” feature which turned off the device if there was no motion or face detected. To wake up the display and see the live preview again, only a few seconds and motion in front of the camera are required.

By adding the extra component to his KiwiPi project, Rafal had the possibility to reflect over the current code and refactor the core which was created in the past hackathon, several months ago.

And of course, Rafal already has ideas for the upcoming hackathons: He now plans to experiment with bigger OLED or E-Ink displays, and also considers designing a new case for our Pi which then would be able to put the camera and display next to each other to make it look more professional and consistent. To have a better understanding of the whole project, head over to the Kiwi blog and read their take on it (find their blogpost here, in German).


As you can see, January was a prolific month and the team is already looking forward to having the next hackathon in February to keep working on exciting projects.