You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've used this repo for 3 years now with varying success. My use case involves needing to run my model and possibly make trades every hour, with a sleeping period inbetween, at a high level:
letib;while(true){try{ib=newIB({clientId: 1,host: '127.0.0.1',port: 4003});// add IB event handlers herebreak;}catch(e){console.log('IB is down, restarting in 3 minutes',e);sleep(1000*60*3);}}while(true){constmainArgs={ ib, sheets, sheetData, cacheEnabled, adjustLeverage, noTrades, longLeverage, shortLeverage };awaitmainLoop(mainArgs);constnextHourStart=getNextHourStart();constnextHourWait=nextHourStart.diff(moment().tz('America/New_York'));console.log('\nWaiting',roundTo(nextHourWait/(1000*60)),'minutes to start at',nextHourStart.format('lll'),'EST\n');awaitsleep(nextHourWait);}
inside mainLoop:
constmainLoop=({ ib,})=>{ib.connect();runModel(ib);// evaluate algorithm and possibly place tradesib.disconnect();};
I've always had the problem that sometimes the IB client would fail to reconnect at the next hour, and even calling ib.disconnect() and ib.connect() again in a trycatch would not resolve it. It's as if the client has died and only completely restarting my script and the Docker container for IB Gateway would fix it. This used to be an ok solution until IB started forcing the 2FA requirement. Now it's terrible as I'm trading futures and often asleep or not by my phone which means I experience downtime until I'm at my phone again to re-authenticate.
Has anyone else had intermittent connection issues? How did you resolve them? Is there a less buggy and more up to date Node IB API I should use instead?
The text was updated successfully, but these errors were encountered:
I've used this repo for 3 years now with varying success. My use case involves needing to run my model and possibly make trades every hour, with a sleeping period inbetween, at a high level:
inside mainLoop:
I've always had the problem that sometimes the IB client would fail to reconnect at the next hour, and even calling
ib.disconnect()
andib.connect()
again in atry
catch
would not resolve it. It's as if the client has died and only completely restarting my script and the Docker container for IB Gateway would fix it. This used to be an ok solution until IB started forcing the 2FA requirement. Now it's terrible as I'm trading futures and often asleep or not by my phone which means I experience downtime until I'm at my phone again to re-authenticate.Has anyone else had intermittent connection issues? How did you resolve them? Is there a less buggy and more up to date Node IB API I should use instead?
The text was updated successfully, but these errors were encountered: