X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=portfolio.py;h=946a96abdafd8e23be5b799acbfbc2fc3a55d504;hb=643767f141505c5e62dbaa402ac84a7b0c5511f2;hp=acb61b24623dec2e07019a2e1ab102a77dec11f5;hpb=a9950fd073198f3c9dc938fd731d97c9821a3845;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git 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: