raising exceptions if keys are not defined

This commit is contained in:
Giulio De Pasquale 2020-12-07 12:27:32 +00:00
parent 6c7f0989a6
commit 074de41e57

View File

@ -8,6 +8,14 @@ from bfxbot.models import SymbolStatus, Ticker, EventHandler, Strategy
class BfxBot:
def __init__(self, api_key: str, api_secret: str, tick_duration: int = 1):
if api_key is None:
print("API_KEY is not set!")
raise ValueError
if api_secret is None:
print("API_SECRET is not set!")
raise ValueError
self.bfx: BfxWrapper = BfxWrapper(api_key, api_secret)
self.status: Dict[Symbol, SymbolStatus] = {}
self.ticker: Ticker = Ticker(tick_duration)