if verbose:
print("All orders finished")
+ @classmethod
+ def update_all_orders_status(cls):
+ for order in cls.all_orders(state="open"):
+ order.get_status()
+
def __repr__(self):
return "Trade({} -> {} in {}, {})".format(
self.value_from,
self.currency,
self.action)
-class Order:
+ @classmethod
+ def print_all_with_order(cls):
+ for trade in cls.trades.values():
+ trade.print_with_order()
+
+ def print_with_order(self):
+ print(self)
+ for order in self.orders:
+ print("\t", order, sep="")
+class Order:
def __init__(self, action, amount, rate, base_currency, market):
self.action = action
self.amount = amount
self.status = result["status"]
return self.status
+ def cancel(self):
+ self.market.cancel_order(self.result['id'])
+
def print_orders(market, base_currency="BTC"):
Balance.prepare_trades(market, base_currency=base_currency, compute_value="average")
Trade.prepare_orders(compute_value="average")
for currency, balance in Balance.known_balances.items():
print(balance)
- for currency, trade in Trade.trades.items():
- print(trade)
- for order in trade.orders:
- print("\t", order, sep="")
+ portfolio.Trade.print_all_with_order()
def make_orders(market, base_currency="BTC"):
Balance.prepare_trades(market, base_currency=base_currency)