def information_about_offer(offer, action, buysell_text): A, B = offer.get_data()['A'], offer.get_data()['B'] bitcoin = wallet.get_asset_definition('bitcoin') sell_offer = B['color_spec'] == '' asset = wallet.get_asset_definition_by_color_set( (A if sell_offer else B)['color_spec']) value = (A if sell_offer else B)['value'] total = (B if sell_offer else A)['value'] text = '{action} {type} {value} {moniker} @{price} btc ea. (Total: {total} btc)'.format(**{ 'action': action, 'type': buysell_text[sell_offer], 'value': asset.format_value(value), 'moniker': asset.get_monikers()[0], 'price': bitcoin.format_value(total*asset.unit/value), 'total': bitcoin.format_value(total), }) self.add_log_entry(text)
def information_about_offer(offer, action='Create'): A, B = offer.get_data()['A'], offer.get_data()['B'] bitcoin = wallet.get_asset_definition('bitcoin') sell_offer = B['color_spec'] == '' asset = wallet.get_asset_definition_by_color_set( (A if sell_offer else B)['color_spec']) value = (A if sell_offer else B)['value'] total = (B if sell_offer else A)['value'] text = '{action} {type} offer {value} {moniker} for {price} btc. (Total: {total} btc)'.format(**{ 'action': action, 'type': 'sell' if sell_offer else 'buy', 'value': asset.format_value(value), 'moniker': asset.get_monikers()[0], 'price': bitcoin.format_value(total*asset.unit/value), 'total': bitcoin.format_value(total), }) QtGui.QMessageBox.information(self, '{action} offer'.format(action=action), text, QtGui.QMessageBox.Yes)
def information_about_offer(offer, action='Create'): A, B = offer.get_data()['A'], offer.get_data()['B'] bitcoin = wallet.get_asset_definition('bitcoin') sell_offer = B['color_spec'] == '' asset = wallet.get_asset_definition_by_color_set( (A if sell_offer else B)['color_spec']) value = (A if sell_offer else B)['value'] total = (B if sell_offer else A)['value'] text = '{action} {type} offer {value} {moniker} for {price} btc. (Total: {total} btc)'.format( **{ 'action': action, 'type': 'sell' if sell_offer else 'buy', 'value': asset.format_value(value), 'moniker': asset.get_monikers()[0], 'price': bitcoin.format_value(total * asset.unit / value), 'total': bitcoin.format_value(total), }) QtGui.QMessageBox.information( self, '{action} offer'.format(action=action), text, QtGui.QMessageBox.Yes)