X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=portfolio.py;h=3257bcff8b2d91301ef08f5dc0efe309516f8f0a;hb=ecba11139e357567c46f7ba2a0cf8dbd98266fe8;hp=1fe56b5992222f8eafddae8479ae0fdbb9f1b987;hpb=66c8b3dd07f4e45be2242d06f8f357adefeb2a4c;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FTrader.git diff --git a/portfolio.py b/portfolio.py index 1fe56b5..3257bcf 100644 --- a/portfolio.py +++ b/portfolio.py @@ -467,12 +467,13 @@ class Trade: print("\t", order, sep="") class Order: - def __init__(self, action, amount, rate, base_currency, market): + def __init__(self, action, amount, rate, base_currency, market, account="exchange"): self.action = action self.amount = amount self.rate = rate self.base_currency = base_currency self.market = market + self.account = account self.result = None self.status = "pending" @@ -498,16 +499,16 @@ class Order: amount = self.amount.value if debug: - print("market.create_order('{}', 'limit', '{}', {}, price={})".format( - symbol, self.action, amount, self.rate)) + print("market.create_order('{}', 'limit', '{}', {}, price={}, account={})".format( + symbol, self.action, amount, self.rate, self.account)) else: try: - self.result = self.market.create_order(symbol, 'limit', self.action, amount, price=self.rate) + self.result = self.market.create_order(symbol, 'limit', self.action, amount, price=self.rate, account=self.account) self.status = "open" except Exception as e: self.status = "error" - print("error when running market.create_order('{}', 'limit', '{}', {}, price={})".format( - symbol, self.action, amount, self.rate)) + print("error when running market.create_order('{}', 'limit', '{}', {}, price={}, account={})".format( + symbol, self.action, amount, self.rate, self.account)) self.error_message = str("{}: {}".format(e.__class__.__name__, e)) print(self.error_message)