Real-time Bitcoin Notification with Faust

Alireza Moosavi
2 min readSep 4, 2020

In this story, a simple real-time application that has built with Python and Faust. This application is very useful for bitcoin miners; if bitcoin price is lower than certain amount of US dollar it will make sound then if it came up, it will make different sound.

This repo could be found here.

Data Model

I am going to use postgresql for database. Asyncpg and Tortoise is also employed to be ORM for my application. The model is this:

Model

The Tortoise is very good tool to create the tables in database; the by asyncpg I am querying into database, because it is the fastest.

Asyncpq Query

Faust App

In our faust application, a very simple feature of faust is going to be used, TIMER.

Config
Simple task

The bitcoin price will be captured by this script and data will be gathered from

https://developers.coinbase.com/api/v2

Simple Alarm handler
Bitcoin collector

This app every 10 seconds will make a request and gathered current bitcoin price.

Build and Run

docker-compose up --build

Reference:

--

--