Feb-20-2021, 12:10 AM
Let me just get this out of the way
So what do I need to change to get the logic explained above to work?
from ibapi.client import EClient from ibapi.wrapper import EWrapper from ibapi.order import * import threading import time class Program (EWrapper, EClient): def __init__(self): EClient.__init__(self,self) def pnl(self, reqId, dailyPnL, unrealizedPnL, realizedPnL): print("UnrealizedPnL:", round(unrealizedPnL)) def run_program(): app.run() app = Program() app.connect("127.0.0.1", 7497, 0) time.sleep(1) api_thread = threading.Thread(target=run_program, daemon=True) api_thread.start() app.reqPnL(1000, "account", "")Thats the entire program, it gives me an endless stream of of pnl updates being printed.
So what do I need to change to get the logic explained above to work?