From 074de41e57853bd985c06b964d7f2c999fccf0c4 Mon Sep 17 00:00:00 2001 From: Giulio De Pasquale Date: Mon, 7 Dec 2020 12:27:32 +0000 Subject: [PATCH] raising exceptions if keys are not defined --- bfxbot/bfxbot.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bfxbot/bfxbot.py b/bfxbot/bfxbot.py index 10ff142..13a32f8 100644 --- a/bfxbot/bfxbot.py +++ b/bfxbot/bfxbot.py @@ -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)