def getType(self, idContrato): sellerId = Contract.getSellerId(self, idContrato) buyerId = Contract.getBuyerId(self, idContrato) if (sellerId == "-"): return "Available to Sell" if (buyerId == "-"): return "Available to Buy" else: return "-"
def getType(self, idContrato): sellerId = Contract.getSellerId(self, idContrato) buyerId = Contract.getBuyerId(self, idContrato) if (("'" + self.user + "'") == sellerId): return "Sell" if (("'" + self.user + "'") == buyerId): return "Buy" else: return "-"
def changeContract(self, contract, newLastPrice): todayDate = date.fromtimestamp(time.time()) sellPrice = Contract.getSellPrice(self, contract) endOfContract = Contract.getEndOfContract(self, contract) takeProfit = Contract.getTakeProfit(self, contract) stopLoss = Contract.getStopLoss(self, contract) sellerId = Contract.getSellerId(self, contract) buyerId = Contract.getBuyerId(self, contract) status = Contract.getStatus(self, contract) numberOfContracts = Contract.getNumberOfAssets(self, contract) Contract.updateContract(self, contract, newLastPrice, sellerId, buyerId, sellPrice, todayDate, endOfContract, takeProfit, stopLoss, status, numberOfContracts)
def buyButtonClicked(self): contract = self.E1.get() buyerId = Contract.getBuyerId(self, contract) assetId = Contract.getAssetId(self, contract) buyPrice = Asset.getLastPrice(self, assetId) if (buyerId == 0): value = Contract.addBuyer(self, contract, self.user, buyPrice) if (not value): messagebox.showerror("Buy error", value) else: messagebox.showinfo("Buy info", "You bought the contract") else: messagebox.showerror("Buy error", "Contract already has a buyer")