From 096a6426dbf1142c5443371f9569e4f51870d148 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 14 Aug 2019 10:22:54 +0200 Subject: [PATCH] Override equality operator --- freqtrade/configuration/timerange.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/freqtrade/configuration/timerange.py b/freqtrade/configuration/timerange.py index b44704682..f980b71ea 100644 --- a/freqtrade/configuration/timerange.py +++ b/freqtrade/configuration/timerange.py @@ -14,14 +14,19 @@ class TimeRange(): if *type is None, don't use corresponding startvalue. """ - def __init__(self, starttype: Optional[str], stoptype: Optional[str], - startts: int, stopts: int): + def __init__(self, starttype: Optional[str] = None, stoptype: Optional[str] = None, + startts: int = 0, stopts: int = 0): self.starttype: Optional[str] = starttype self.stoptype: Optional[str] = stoptype self.startts: int = startts self.stopts: int = stopts + def __eq__(self, other): + """Override the default Equals behavior""" + return (self.starttype == other.starttype and self.stoptype == other.stoptype + and self.startts == other.startts and self.stopts == other.stopts) + @staticmethod def parse_timerange(text: Optional[str]): """