I'd like to get feedback on the crypto trading bots architecture(django, celery) [closed]

I want to make crypto trading bots using python, django and celery. But I have no idea how to design architecture. So If you don't mind, Please let me know how to do it. (Sorry for my poor English skills. If there's anything you don't understand, comment me anytime)

Requirements

  1. Get all of crypto's price every second from openAPI
  2. Buy/Sell crypto by comparing between user's average buy price and current price
  3. User can see their balance's state by dashboard(django)

If the current price exceeds the threshold and the trade process(requirements 2) is executed, the process of receiving crypto price from openAPI(requirements 1) will be delayed. So I planned to separate a process of getting crypto prices from openAPI and storing them in DB. And if the current price exceeds the threshold, the process generates events and delivers them to other processes through a message queue.

Also, getting all of the user's average buy price from openAPI every second(requirements 2) can exceed API call limit. So I planned to store user's balance info in DB and synchronize everyday and when buy/sell events occur.

I draw architecture with my ideas. I use django for dashboard and celery beat for scheduling, worker for processes. I would like to ask if my initial thought works well or not. If not, I would be happy if you know the reason why.

architecture

Back to Top