ethemguner / dobot

Real Time Crypto Currency Price Tracker by using Django
2 stars 0 forks source link

notification over email for coins that increased too much in a short time #35

Closed ethemguner closed 2 years ago

ethemguner commented 2 years ago

Case

Let's say we have a coin and its price increased %30 in an hour.

Feature

System will recognize this type of movements in binance market and will send notification over email.

Reason of this feature

When a coin's price increases in a very short time, It's highly possible It will continue to increase for a while. So, If system can catch these movements, we can make some mooooneey 😈

Development Details

About sending e-mail: Django's built-in send_mass_email seems fine for now. We will use an email address belongs to system (dobot@gmail.com is good for now) to send email to a particular receipents list. We will keep its secrets in our .localsecrets file.

About module design: Notifications will be sent by a subscription. If someone subscribed to get notification, system will send it.

Model Design:

Subscription Model

Notification Model

  • subject
  • content
  • subscription foreign key. system will create a notification over a subscription.
  • send_notification method. this method will be called if there is a extreme situation on targeted coins. it will use its classe's subject, content and subscription attributes to send proper notification.

Celery Periodic Tasks

We already have a task named update_coins_prices. We create CoinPriceChange instance in database which represents the previous change ratio. We may change some behaviors in this task. Task will run every 30 minute (I don't know why), this means that system will know what happened in 30 minutes for a coin. And If change ratio is too high or low, system will send notification.