Exemple #1
0
 def btnSellClicked(self):
     valid = True
     if not self.edtSellQuantity.text().toDouble()[1]:
         self.edtSellQuantity.setStyleSheet('background:#FF8080')
         valid = False
     if not self.edtSellPrice.text().toDouble()[1]:
         self.edtSellPrice.setStyleSheet('background:#FF8080')
         valid = False
     if not valid:
         return
     moniker = str(self.cbMoniker.currentText())
     asset = wallet.get_asset_definition(moniker)
     value = self.edtSellQuantity.text().toDouble()[0]
     bitcoin = wallet.get_asset_definition('bitcoin')
     price = self.edtSellPrice.text().toDouble()[0]
     delta = wallet.get_available_balance(asset) - asset.parse_value(value)
     if delta < 0:
         message = 'The transaction amount exceeds available balance by %s %s' % \
             (asset.format_value(-delta), moniker)
         QtGui.QMessageBox.critical(self, '', message, QtGui.QMessageBox.Ok)
         return
     offer = wallet.p2ptrade_make_offer(True, {
         'moniker': moniker,
         'value': value,
         'price': price,
     })
     wallet.p2p_agent.register_my_offer(offer)
     self.update_offers()
     self.edtSellQuantity.setText('')
     self.edtSellPrice.setText('')
Exemple #2
0
 def btnSellClicked(self):
     valid = True
     if not self.edtSellQuantity.text().toDouble()[1]:
         self.edtSellQuantity.setStyleSheet('background:#FF8080')
         valid = False
     if not self.edtSellPrice.text().toDouble()[1]:
         self.edtSellPrice.setStyleSheet('background:#FF8080')
         valid = False
     if not valid:
         return
     moniker = str(self.cbMoniker.currentText())
     asset = wallet.get_asset_definition(moniker)
     value = self.edtSellQuantity.text().toDouble()[0]
     bitcoin = wallet.get_asset_definition('bitcoin')
     price = self.edtSellPrice.text().toDouble()[0]
     delta = wallet.get_balance(asset) - asset.parse_value(value)
     if delta < 0:
         message = 'The transaction amount exceeds the balance by %s %s' % \
             (asset.format_value(-delta), moniker)
         QtGui.QMessageBox.critical(self, '', message, QtGui.QMessageBox.Ok)
         return
     offer = wallet.p2ptrade_make_offer(True, {
         'moniker': moniker,
         'value': value,
         'price': price,
     })
     wallet.p2p_agent.register_my_offer(offer)
     self.update_offers()
     self.edtSellQuantity.setText('')
     self.edtSellPrice.setText('')
Exemple #3
0
 def btnSellClicked(self):
     quantity = self._to_decimal(self.edtSellQuantity)
     price = self._to_decimal(self.edtSellPrice)
     if not self.validate_sell_input(quantity, price):
         return # invalid input
     moniker = str(self.cbMoniker.currentText())
     offer = wallet.p2ptrade_make_offer(True, {
         'moniker': moniker,
         'value': quantity,
         'price': price,
     })
     wallet.p2p_agent.register_my_offer(offer)
     self.update_offers()
     self.edtSellQuantity.setText('')
     self.edtSellPrice.setText('')