def data(self, index, role): if role == Qt.TextAlignmentRole: return Qt.AlignRight | Qt.AlignVCenter if (not index.isValid()) or (role != Qt.DisplayRole): return QVariant() row = index.row() col = index.column() if col == 0: return QVariant(utilities.internal2str(self.get_price(row), 5)) if col == 1: return QVariant(utilities.internal2str(self.get_size(row))) if col == 2: return QVariant(utilities.internal2str(self.get_total(row)))
def display_userorder(self, price, size, order_type, oid, status): size = utilities.gox2internal(size, 'BTC') price = utilities.gox2internal(price, 'USD') size = utilities.internal2str(size) price = utilities.internal2str(price) 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)), size, price, oid, status)) if status == 'post-pending': self.set_order_id(oid)
def execute_trade(self): trade_type = self.get_selected_trade_type() size = utilities.internal2str(self.get_trade_size()) price = utilities.internal2str(self.get_trade_price(), 5) total = utilities.internal2str(self.get_trade_total(), 5) trade_name = 'BID' if trade_type == 'BUY' else 'ASK' self.status_message('Placing order: {0} {1} BTC at $ {2} USD (total $ {3} USD)...'.format(# @IgnorePep8 trade_name,size,price,total)) sizeGox = int(D(size)*B) priceGox = int(D(price)*U) mapdict = {"BUY":self.gox.buy,"SELL":self.gox.sell} mapdict[trade_type](priceGox, sizeGox)
def execute_trade(self): trade_type = self.get_selected_trade_type() size = self.get_trade_size() price = self.get_trade_price() total = self.get_trade_total() trade_name = 'BID' if trade_type == 'BUY' else 'ASK' self.status_message('Placing order: {0} {1} BTC at {2} USD (total {3} USD)...'.format(# @IgnorePep8 trade_name, utilities.internal2str(size), utilities.internal2str(price, 5), utilities.internal2str(total, 5))) if trade_type == 'BUY': self.market.buy(price, size) else: self.market.sell(price, size)
def display_userorder(self, price, size, order_type, oid, status): size = utilities.gox2internal(size, 'BTC') price = utilities.gox2internal(price, 'USD') size = utilities.internal2str(size) price = utilities.internal2str(price) 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)), size, price, oid, status)) if status == 'post-pending': self.set_order_id(oid)
def execute_trade(self): trade_type = self.get_selected_trade_type() size = self.get_trade_size() price = self.get_trade_price() total = self.get_trade_total() trade_name = 'BID' if trade_type == 'BUY' else 'ASK' self.status_message( 'Placing order: {0} {1} BTC at {2} USD (total {3} USD)...'. format( # @IgnorePep8 trade_name, utilities.internal2str(size), utilities.internal2str(price, 5), utilities.internal2str(total, 5))) sizeGox = utilities.internal2gox(size, 'BTC') priceGox = utilities.internal2gox(price, 'USD') if trade_type == 'BUY': self.gox.buy(priceGox, sizeGox) else: self.gox.sell(priceGox, sizeGox)
def set_wallet_usd(self, value): self.mainWindow.pushButtonWalletB.setEnabled(value > 0) self.mainWindow.pushButtonWalletB.setText( 'USD: ' + utilities.internal2str(value, 5))
def set_wallet_btc(self, value): self.mainWindow.pushButtonWalletA.setEnabled(value > 0) self.mainWindow.pushButtonWalletA.setText( 'BTC: ' + utilities.internal2str(value))