Trying to program a trading bot using pyqt5 for window desing & ib-insync api window,connection and data retriving seem to work fine but I cant manage to make both window and real time data work. any suggestion ? keep in mind im new to python
`
import threading
import time
import ib_insync
from ib_insync import contract
from ib_insync import *
import sys
import pandas
from ib_insync import util
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow
import PyQt5.QtGui
from ib_insync import ticker
from threading import Thread
ib = IB()
ib.connect('127.0.0.1', 7496, clientId=15)
QQQ = Stock('QQQ', 'SMART', 'USD')
bar = ib.reqHistoricalData(QQQ, endDateTime='', durationStr='2 D', barSizeSetting='1 day', whatToShow='TRADES', useRTH=False)
df = util.df(bar)
print(bar)
def Pending_tickers(tickers):
print("------")
print(tickers)
time.sleep(2)
def run_loop():
ib.pendingTickersEvent += Pending_tickers
ib.run()
class Window(QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.setWindowTitle("QQQ Trade Bot")
self.setGeometry(800, 400, 600, 600)
self.setWindowTitle("QQQ Trade Bot")
**the rest of the window desing**
qqq_market = ib.reqMktData(QQQ, '', False, False)
**Tried to make a thread for run_loop so it will load the window**
threading.Thread(target=run_loop).start()
def app():
app = QApplication(sys.argv)
win = Window()
win.show()
sys.exit(app.exec_())
app()
`