From 0122e9ed544f2b30665c9a498f66cabf7ba8bd4f Mon Sep 17 00:00:00 2001 From: null Date: Fri, 8 Mar 2024 07:22:48 +0100 Subject: [PATCH] refactor static methods to superclass --- models/Abc.py | 8 -------- models/Strategy.py | 10 +++++++++- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/models/Abc.py b/models/Abc.py index e9cef6a..872ac1c 100644 --- a/models/Abc.py +++ b/models/Abc.py @@ -8,11 +8,3 @@ class Abc(Strategy): stop: float tp: float risk: float - - @staticmethod - def get_table_name(): - return "Abc" - - @staticmethod - def get_route_prefix(): - return "/strategies/abc" \ No newline at end of file diff --git a/models/Strategy.py b/models/Strategy.py index b14003f..451a3c1 100644 --- a/models/Strategy.py +++ b/models/Strategy.py @@ -5,4 +5,12 @@ class Strategy(): id: str enabled: bool fulfilled: bool - created: str \ No newline at end of file + created: str + + @classmethod + def get_table_name(cls): + return cls.__name__ + + @classmethod + def get_route_prefix(cls): + return "/strategies/" + cls.__name__.lower() \ No newline at end of file