def set_ticker_ask(self, value): if value == None: text = 'n/a' else: text = money.to_long_string(value, self.__get_quote_currency()) self.__set_data(1, 5, text)
def set_wallet_b(self, value): if value == None: text = 'n/a' else: text = money.to_long_string(value, self.__get_quote_currency()) self.__set_data(1, 1, text)
def display_userorder(self, price, size, order_type, oid, status): if order_type == "": self.status_message('Order <a href="{0}">{0}</a> {1}.'.format(oid, status)) if status == "removed" and self.get_order_id() == oid: self.set_order_id("") else: self.status_message( '{0} size: {1}, price: {2}, oid: <a href="{3}">{3}</a> - {4}'.format( # @IgnorePep8 str.upper(str(order_type)), money.to_long_string(size, self.get_base_currency()), money.to_long_string(price, self.get_quote_currency()), oid, status, ) ) if status == "post-pending": self.set_order_id(oid)
def set_wallet_b(self, value): if value == None: self.ui.pushButtonWalletB.setEnabled(False) self.ui.pushButtonWalletB.setText("n/a") return self.ui.pushButtonWalletB.setEnabled(True) self.ui.pushButtonWalletB.setText(money.to_long_string(value, self.get_quote_currency()))
def execute_trade(self): trade_type = self.get_selected_trade_type() size = self.get_trade_size() price = self.get_trade_price() total = money.multiply(price, size) trade_name = "BID" if trade_type == "BUY" else "ASK" self.status_message( "Placing order: {0} {1} at {2} (total {3})...".format( # @IgnorePep8 trade_name, money.to_long_string(size, self.get_base_currency()), money.to_long_string(price, self.get_quote_currency()), money.to_long_string(total, self.get_quote_currency()), ) ) if trade_type == "BUY": self.market.buy(price, size) else: self.market.sell(price, size)
def test_to_long_string(self): self.assertEquals('2,000.00000 EUR', money.to_long_string(200000000000, Currency('EUR')))