IntelligentTrading / telegram-bot

Intelligent Trading Technologies | Telegram Bot
MIT License
3 stars 2 forks source link

Charts #19

Open Brbb opened 6 years ago

Brbb commented 6 years ago

Description

The user gets live charts and/or static png delivered to his Telegram chat

Chart list

Possible solution

Flow 1:

  1. Bot/Express server API calls the endpoint and passes a chat_id + params to the Image rendering service (on different Heroku?)which makes its own.
  2. The Bot/Express will send the text and the url to the webpage
  3. The Image rendering service will send back the PNG to the chat_id or editMessage

chart-rendering.png

Flow 2:

  1. Single API call from the main Bot/Express server and redirect of the data to the Express server and the image rendering service (on different Heroku?) with chat_id.
  2. The Bot/Express will send the text and the url to the webpage
  3. The Image rendering service will send back the PNG to the chat_id or editMessage

chart-rendering-2.png

tomcounsell commented 6 years ago

@Brbb

The PNG worker should be separate from the function that sends the photo to the Telegram chat. Those are separate concerns. So looking at Flow2, we will split the blue worker into 2 parts: PNG worker and Telegram sendPhoto. The PNG worker also should ask for the data it needs as shown in Flow 1.

For 5a(serve webpage), that can be compiled on-demand for now, so we will not trigger anything from the API side as 5a implies. Instead, for webpages, we will use a standard url schema so the web server knows what kind of page to compile and serve to the user.

If we treat everything as a micro-service, we can reuse them for other things in the future.

Brbb commented 6 years ago

Proposed architecture: Architecture-Dispatcher.png