forked from s-brez/trading-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessaging_clients.py
43 lines (31 loc) · 1012 Bytes
/
messaging_clients.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
trading-server is a multi-asset, multi-strategy, event-driven trade execution
and backtesting platform (OEMS) for trading common markets.
Copyright (C) 2020 Sam Breznikar <sam@sdbgroup.io>
Licensed under GNU General Public License 3.0 or later.
Some rights reserved. See LICENSE.md, AUTHORS.md.
"""
from abc import ABC, abstractmethod
from telegram.ext import Updater, MessageHandler, Filters
import os
class MessagingClient(ABC):
"""
"""
def __init__(self):
pass
class Telegram(MessagingClient):
"""
"""
def __init__(self, logger):
super().__init__()
self.logger = logger
self.token = self.get_token()
self.updater = Updater(token=self.token, use_context=True)
def get_token(self):
"""
Load bot token from environment variable.
"""
if os.environ['TELEGRAM_BOT_TOKEN']:
return os.environ['TELEGRAM_BOT_TOKEN']
else:
raise Exception("Telegram bot token missing.")