Example #1
0
    def add_pairs(self):

        jsonfiles = os.listdir(os.path.join(self.datafolder, "telegram_data"))
        while len(jsonfiles) <= 1:
            sleep(300)
        row = 2
        for file in jsonfiles:
            if not "data.json" in file:
                data = self.read_file(file)

                tpair = TextBox(app, grid=[0, row], width=15, align="top")
                exchange = TextBox(app, grid=[1, row], width=15)
                lastaction = TextBox(app, grid=[2, row], width=15)
                curprice = TextBox(app, grid=[3, row], width=15)
                margin = TextBox(app, grid=[4, row], width=15)
                delta = TextBox(app, grid=[5, row], width=15)
                ERI = TextBox(app, grid=[6, row])
                BULL = TextBox(app, grid=[7, row])
                EMA = TextBox(app, grid=[8, row])
                MACD = TextBox(app, grid=[9, row])
                OBV = TextBox(app, grid=[10, row])

                tpair.value = file.replace(".json", "")
                exchange.value = data[
                    "exchange"] if "exchange" in data else "waiting to buy"

                margin.repeat(5100,
                              self.update_textbox,
                              args=[margin, file, "margin"])
                delta.repeat(5100,
                             self.update_textbox,
                             args=[delta, file, "delta"])
                curprice.repeat(5100,
                                self.update_textbox,
                                args=[curprice, file, "price"])
                lastaction.repeat(5100,
                                  self.update_lastaction,
                                  args=[lastaction, file])
                ERI.repeat(5100,
                           self.update_indicator,
                           args=[ERI, file, "ERI"])
                BULL.repeat(5100,
                            self.update_indicator,
                            args=[BULL, file, "BULL"])
                EMA.repeat(5100,
                           self.update_indicator,
                           args=[EMA, file, "EMA"])
                MACD.repeat(5100,
                            self.update_indicator,
                            args=[MACD, file, "MACD"])
                OBV.repeat(5100,
                           self.update_indicator,
                           args=[OBV, file, "EMA"])

                row += 1
Example #2
0
text.disable()

textBoxData = ""


def loop():
    """
    Loop used to update display
    """
    try:
        newData = logFile.read("all")

        global textBoxData
        for x in reversed(newData):
            textData = config.conversion.capitalize() + ": " + str(
                x["value"]) + " Time: " + x["time"][0] + "\n"
            if textData not in text.value:
                textBoxData = textData + textBoxData
                text.enable()
                text.value = textBoxData
                text.disable()
    except:
        print("UI error")


print("starting ui")

text.repeat(300, loop)

app.display()