From 9e3292af1b8a4caf65cfdb8d79ea2768f474fa67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20S=C3=A1nchez?= Date: Tue, 7 Jan 2025 10:05:45 -0300 Subject: [PATCH] setters and getters --- libraries/earner.py | 43 ++++++++++++++++++++++++++++++++++++------- main.py | 2 +- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/libraries/earner.py b/libraries/earner.py index 0e83400..cd4245c 100644 --- a/libraries/earner.py +++ b/libraries/earner.py @@ -27,31 +27,60 @@ class earner: def __str__(self): return str(self.connector) - def toggle_pause(self): self.is_paused = not self.is_paused return self.is_paused + def set_step_size(self, step_size): + self.step_size = step_size + return self.step_size + + def get_step_size(self): + return self.step_size + + def set_percentage(self, percentage): + self.percentage = percentage + return self.percentage + + def get_percentage(self): + return self.percentage + + def set_minimum_amount_in_trading_account(self, minimum_amount_in_trading_account): + self.minimum_amount_in_trading_account = minimum_amount_in_trading_account + return self.minimum_amount_in_trading_account + + def get_minimum_amount_in_trading_account(self): + return self.minimum_amount_in_trading_account + def set_time_between_subscriptions(self, time_between_subscriptions): + self.time_between_subscriptions = time_between_subscriptions + return self.time_between_subscriptions + + def get_time_between_subscriptions(self): + return self.time_between_subscriptions + + def set_time_between_redemptions(self, time_between_redemptions): + self.time_between_redemptions = time_between_redemptions + return self.time_between_redemptions + + def get_time_between_redemptions(self): + return self.time_between_redemptions + def get_last_subscription(self): return {str(self.connector): self.last_subscription_time} - def get_last_redemption(self): return {str(self.connector): self.last_redemption_time} - - + def get_status_string(self): return self.status_string - def get_trading_balance(self): return float(self.trading_balance) - def get_earning_balance(self): return float(self.earning_balance) - + def subscribe(self,amount): print(f"{str(self.connector)} | Subscribing {amount} {self.currency}") diff --git a/main.py b/main.py index 1c23605..0657ed9 100644 --- a/main.py +++ b/main.py @@ -114,7 +114,7 @@ def main(): earn_api = Flask(__name__) @earn_api.route("/toggle_pause", methods=['POST']) -def return_global_status(): +def toggle_pause(): ''' GET request