예제 #1
0
 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 "-"
예제 #2
0
 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 "-"
예제 #3
0
 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)
예제 #4
0
 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")
예제 #5
0
 def sellButtonClicked(self):
     asset = self.E1.get()
     endOfContract = self.E2.get()
     takeProfit = self.E3.get()
     stopLoss = self.E4.get()
     numberOfContracts = self.E5.get()
     result = Contract.isValidContract(self, asset, endOfContract, takeProfit, stopLoss, numberOfContracts)
     if(result==True):
         assetId = AssetType.getTypeId(self, asset)
         sellPrice = Asset.getLastPrice(self, assetId)
         Contract.createContract(self, assetId, self.user, endOfContract, sellPrice, takeProfit, stopLoss, numberOfContracts)
         messagebox.showinfo("sell info", "You're selling the contract")
     else:
         messagebox.showerror("Sell error", result)
예제 #6
0
    def run(self):
        while True:
            newLastPrice = 0
            for x in range(1, 9):
                newLastPrice = DBUpdater.changeAsset(self, x)

            contracts = Contract.getOpenAssetContracts(self, x)
            for contract in contracts:
                DBUpdater.changeContract(self, contract, newLastPrice)

            secondsToSleep = randint(1, 5)
            time.sleep(secondsToSleep)
예제 #7
0
    def __init__(self, email):
        self.user = email
        self.contractsTable = tkinter.Tk()
        self.W = Label(self.contractsTable, text="OTP")
        self.L = Label(self.contractsTable, text="Contracts Available:")
        self.W.grid(row=1, columnspan=2)
        self.L.grid(row=2, columnspan=2)

        self.createTableContractsAvailable()
        self.tableContents = Contract.getAvailableContracts(self)

        getBack = Button(self.contractsTable,
                         text="Back to Menu",
                         command=self.getBackClicked)
        getBack.grid(columnspan=2)
예제 #8
0
 def getStopLoss(self, idContrato):
     return Contract.getStopLoss(self, idContrato)
예제 #9
0
 def getTakeProfit(self, idContrato):
     return Contract.getTakeProfit(self, idContrato)
예제 #10
0
 def getEndOfContract(self, idContrato):
     return Contract.getEndOfContract(self, idContrato)
예제 #11
0
 def getAssetId(self, idContrato):
     return Contract.getAssetId(self, idContrato)
예제 #12
0
 def getSellPrice(self, idContrato):
     return Contract.getSellPrice(self, idContrato)
예제 #13
0
 def getNumberOfAssets(self, idContrato):
     return Contract.getNumberOfAssets(self, idContrato)
예제 #14
0
 def getAssetId(self, idContrato):
     assetId = Contract.getAssetId(self, idContrato)
     return assetId
예제 #15
0
 def observerUpdate(self):
     self.tableContents = Contract.getAvailableContracts(self)
예제 #16
0
 def getBuyPrice(self, idContrato):
     return Contract.getBuyPrice(self, idContrato)
예제 #17
0
 def getStatus(self, idContrato):
     return Contract.getStatus(self, idContrato)