From 643767f141505c5e62dbaa402ac84a7b0c5511f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Mon, 22 Jan 2018 01:03:38 +0100 Subject: Add debug mode parameter rather than global flag --- portfolio.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/portfolio.py b/portfolio.py index acb61b2..946a96a 100644 --- a/portfolio.py +++ b/portfolio.py @@ -4,8 +4,6 @@ from decimal import Decimal as D # Put your poloniex api key in market.py from market import market -debug = False - class Portfolio: URL = "https://cryptoportfolio.io/wp-content/uploads/portfolio/json/cryptoportfolio.json" liquidities = {} @@ -408,7 +406,6 @@ class Trade: self.action) class Order: - DEBUG = debug def __init__(self, action, amount, rate, base_currency, market): self.action = action @@ -436,11 +433,11 @@ class Order: def finished(self): return self.status == "closed" or self.status == "canceled" - def run(self): + def run(self, debug=False): symbol = "{}/{}".format(self.amount.currency, self.base_currency) amount = self.amount.value - if self.DEBUG: + if debug: print("market.create_order('{}', 'limit', '{}', {}, price={})".format( symbol, self.action, amount, self.rate)) else: -- cgit v1.2.3