示例#1
0
    def loadMoves(self, moves):
        records = len(moves)
        data = []
        for i in range(records):
            data.append([])
            date = moves[i][0]
            data[i].append(date)
            time = moves[i][1]
            data[i].append(time)
            nameFrom = moves[i][2]
            data[i].append(nameFrom)
            QFrom = moves[i][3]
            #Verificamos si es float o int
            normalizeQFrom = utilities.isFloat(QFrom, 8)
            data[i].append(normalizeQFrom)
            nameTo = moves[i][4]
            data[i].append(nameTo)
            QTo = moves[i][5]
            #Verificamos si es float o int
            normalizeQTo = utilities.isFloat(QTo, 8)
            data[i].append(normalizeQTo)
            PU = QFrom / QTo
            #Verificamos si es float o int
            normalizePU = utilities.isFloat(PU, 8)
            data[i].append(normalizePU)

        return data
示例#2
0
    def sumTotalEuros(self):
        #Obtenemos el sumatorio total de cada criptomoneda
        totalEuro = self.simul.sumCrypto('EUR')

        #Si obtenemos beneficios, mostramos 0€ en la inversión y mostramos los beneficios en otro Entry
        if totalEuro < 0:
            invEur = '0€'
            totalEuro = utilities.isFloat(-totalEuro, 2)
            totalEuro = str(totalEuro) + '€'
            self.profits.set(totalEuro)
        else:
            #Redondeamos y cambiamos el '.' por la ','
            totalEuro = utilities.isFloat(totalEuro, 2)
            invEur = str(totalEuro) + '€'

        #Seteamos la variable de control para mostrar el valor en el Entry Inversión
        self.investedEuros.set(invEur)
示例#3
0
 def calcPU(self, rate):
     #Asignamos tasa conversión a Q_TO
     self.valQToDB = rate
     #Calculamos PU, lo redondeamos y mostramos en pantalla
     valuePU = float(self.valQFrDB) / float(self.valQToDB)
     #Formateamos el resultado
     normPU = utilities.isFloat(valuePU, 8)
     self.valPU.set(normPU)
示例#4
0
 def printTotalCrypto(self, totalCrypEuros):
     #Redondeamos y cambiamos el '.' por la ','
     totalCrypEuros = utilities.isFloat(totalCrypEuros, 2)
     #Si la cantidad en € de las criptomonedas, una vez redondeada, es cercana a 0, seteamos a cero el Entry
     if totalCrypEuros == '0,00':
         curVal = '0€'
     else:
         curVal = str(totalCrypEuros) + '€'
     #Seteamos la variable de control para mostrar el valor en el Entry Valor Actual
     self.currentValue.set(curVal)
示例#5
0
    def loadBalance(self, dataBalance):
        listBalance = []
        for item in dataBalance:
            name = item[0]
            quantity = item[2]
            if quantity >= _valueMinApi:
                quantityNorm = utilities.isFloat(quantity, 8)
                symbol = item[1]
                value = apiCoin.priceConv(quantity, symbol, 'EUR')
                if value:
                    valueNorm = utilities.isFloat(value, 2)
                    valueNorm = str(valueNorm) + '€'
                    data = (name, quantityNorm, valueNorm)
                    listBalance.append(data)
                else:
                    break
            else:
                value = True

        return listBalance, value
示例#6
0
    def validateQFrom(self):
        #Eliminamos los espacios por la derecha y lo volvemos a pintar en el Entry
        self.valQFrDB = self.valQFrom.get().rstrip()
        self.valQFrom.set(self.valQFrDB)
        #Transformación para aceptar la ',' como decimal y no el '.'
        try:
            if isinstance(float(self.valQFrDB), float):
                self.valQFrDB = self.valQFrDB.replace('.', ',')
        except:
            self.valQFrDB = self.valQFrDB.replace(',', '.')

        try:

            if len(self.records) != 0:
                for item in self.totalCryptoTO:
                    if item[0] == self.symbolFrom:
                        maxValue = item[1]

            if self.symbolFrom != 'EUR':
                if float(self.valQFrDB) and float(self.valQFrDB) > 0 and float(
                        self.valQFrDB) <= maxValue:
                    return True
                elif float(self.valQFrDB) > maxValue:
                    messagebox.showwarning(
                        message=
                        """Q Entry value must be a number less than {}.""".
                        format(utilities.isFloat(maxValue, 0)),
                        title="Warning")
                    return False
                else:
                    messagebox.showwarning(
                        message=
                        """Q Entry value must be a positive real number.""",
                        title="Warning")
                    return False
            else:
                if float(self.valQFrDB) and float(self.valQFrDB) > 0:
                    return True
                else:
                    messagebox.showwarning(
                        message=
                        """Q Entry value must be a positive real number.""",
                        title="Warning")
                    return False

        except:
            messagebox.showwarning(
                message="""Q Entry value must be a number.""", title="Warning")
            return False
示例#7
0
 def calcQTO(self, rate):
     #Formateamos el resultado
     normQTo = utilities.isFloat(rate, 8)
     self.valQTo.set(normQTo)