开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: How do I select the "Show log" checkbox in the IB Gateway window through IBC?

 

开云体育

You can’t set this with IBC.

?

What would be the point? If you have xvfb, you can run a VNC client so that you can see the Gateway GUI, and then you can set it manually. And if you’re not using VNC, you wouldn’t be able to see the log pane anyway.

?

Richard

?

?

From: [email protected] <[email protected]> On Behalf Of tsa21 via groups.io
Sent: Tuesday, May 30, 2023 3:20 PM
To: [email protected]
Subject: [ibc] How do I select the "Show log" checkbox in the IB Gateway window through IBC?

?

Hi,
I'm running the IB Gateway through the IBC on a Linux server, using xvfb as the virtual buffer. I can't find any setting through which I can select the tick box named "Show log" that appears at the top of the window? Does someone know how this can be done?

Thanks,
Tulika


How do I select the "Show log" checkbox in the IB Gateway window through IBC?

 

Hi,
I'm running the IB Gateway through the IBC on a Linux server, using xvfb as the virtual buffer. I can't find any setting through which I can select the tick box named "Show log" that appears at the top of the window? Does someone know how this can be done?

Thanks,
Tulika


Re: Gateway crashing on AWS

 

FWIW, I've been running on an older Ubuntu (20LTS) with?IBC/TWS (not gateway)/Xvfb/x11vnc unattended on Linode for over a year now.? Rarely do I need to do anything besides the Sunday afternoon 2FA.

I was seeing x11vnc die once every few weeks or so, but a cron job takes care of restarting that now.



On Sat, May 6, 2023, 1:08 PM Richard L King <rlking@...> wrote:

Just for completeness, I want to report that running TWS and Gateway on Ubuntu Server, using Xvfb and x11vnc, has worked flawlessly, including daily auto-restarts, since my previous post on this thread on 27 April.

?

So I’m convinced that the cause of the problem reported by PaulMac (originally on the ‘Gateway crashing’ thread) was something other than merely the combination of IBC/Gateway/Xvfb/x11vnc.

?

One thing I discovered is that the ‘built-in’ JVM included in the TWS/Gateway install makes assumptions about dependencies that it presumes are already installed on the target platform. So for example the libnss3.so library was not found, and while this didn’t stop things working, it prevented TWS/Gateway from creating logfiles, since presumably Log4J uses the crypto services in libnss to encrypt the files. I presume this was because I was using a minimal Ubuntu Server installation, so many packages that would normally be found on a ‘desktop’ or non-minimal server weren’t present. Once I installed the missing libraries everything was fine. So it may well be that Paul’s AWS server was also missing something that caused the JVM to stumble.

?

Richard


Re: Gateway crashing on AWS

 

开云体育

Just for completeness, I want to report that running TWS and Gateway on Ubuntu Server, using Xvfb and x11vnc, has worked flawlessly, including daily auto-restarts, since my previous post on this thread on 27 April.

?

So I’m convinced that the cause of the problem reported by PaulMac (originally on the ‘Gateway crashing’ thread) was something other than merely the combination of IBC/Gateway/Xvfb/x11vnc.

?

One thing I discovered is that the ‘built-in’ JVM included in the TWS/Gateway install makes assumptions about dependencies that it presumes are already installed on the target platform. So for example the libnss3.so library was not found, and while this didn’t stop things working, it prevented TWS/Gateway from creating logfiles, since presumably Log4J uses the crypto services in libnss to encrypt the files. I presume this was because I was using a minimal Ubuntu Server installation, so many packages that would normally be found on a ‘desktop’ or non-minimal server weren’t present. Once I installed the missing libraries everything was fine. So it may well be that Paul’s AWS server was also missing something that caused the JVM to stumble.

?

Richard


Re: Redundancy

 

开云体育

Yes, sure, but bear in mind that the second user has to pay separately for all the market data subscriptions it needs.

?

Given that both TWS and Gateway are pretty stable, it’s likely that there would only be a few minutes per day (during the daily reset period, where nothing much is happening in the markets anyway) that this could provide any benefit, and it probably won’t be needed then anyway, so I doubt whether it would be worth the additional costs involved.

?

My philosophy has always been that things will inevitably happen that prevent you trading for one reason or another, and it’s better to just accept that and deal with the issue manually on a case-by-case basis rather than try to program round them in some way. This philosophy makes it imperative to ensure that you always have a suitable stop-loss in place when you have an open position. I would say that it really doesn’t matter if you miss a trading opportunity occasionally: the markets will still be there tomorrow…

?

Richard

?

From: [email protected] <[email protected]> On Behalf Of PaulMac
Sent: Tuesday, May 2, 2023 1:52 AM
To: [email protected]
Subject: [ibc] Redundancy

?

As IB allows for multiple userts for the same account it is possible to build in redundancy.

I have not implemented this yet but planning to.

?A 2nd user running a 2nd instance of the IBC/GW

If a trade signal comes in and the Primary GW is down for some reason (or is busy restarting) the client can simply send the Order to the Backup GW

For a fully redundant system, one could use a seperate virtual EC2 server on AWS

Paul.


Re: IBC headless gateway with wsl2?

 

开云体育

I’ve been meaning to add a section to the User Guide about the IBC command server for quite a while. It’s only quite recently that people have started to make much use of it, in particular with the STOP and RESTART commands, so it’s getting more urgent to do that.

?

The available commands are:

?

STOP

RESTART

ENABLEAPI (ensures that the ‘Enable ActiveX and Socket Clients’ checkbox in the API configuration is set)

RECONNECTDATA (tells TWS/Gateway to refresh all its market data connections – same as the user pressing Ctrl-Alt-F)

RECONNECTACCOUNT (tells TWS/Gateway to reconnect to the IB login server – same as the user pressing Ctrl-Alt-R)

EXIT (closes the connection to the command server)

?

I don’t understand what you mean by CONNECT and RECONNECT. IBC doesn’t connect to anything, and it has no involvement in API connections from API client programs. If your mental picture is that IBC ‘connects’ to TWS/Gateway, that picture is incorrect. IBC loads TWS or Gateway into the IBC process – ie IBC and TWS/Gateway are all running in the same address space. It hooks into low-level AWT event mechanisms that enable it to detect things like windows opening and closing. For some operation IBC actually directly uses the TWS/Gateway menus as if it were a user.

?

Your suggestion about acting on the 5-minute restart warning is very similar to how IBC used to work (for many years) with the 5-minute auto-logoff warning – in those days IBC could keep TWS running continuously for days or weeks by changing the auto-logoff time (and Gateway would just keep running until you stopped it back then). But when TWS 974 was released, which is when auto-restart was introduced, IB prevented this mechanism working, and auto-restart was soon introduced to Gateway as well.? I haven’t tried doing the same thing with the auto-restart warning popup because firstly I see no point – auto-restart works pretty well now; and secondly it’s quite clear that IB definitely require TWS/Gateway to be restarted every day, and I don’t think it’s a good idea to try to get round this (quite apart from the fact that IB almost certainly would prevent this in exactly the same way as for auto-logoff). So no, this is not going to happen.

?

Richard


Redundancy

 

As IB allows for multiple userts for the same account it is possible to build in redundancy.

I have not implemented this yet but planning to.

?A 2nd user running a 2nd instance of the IBC/GW

If a trade signal comes in and the Primary GW is down for some reason (or is busy restarting) the client can simply send the Order to the Backup GW

For a fully redundant system, one could use a seperate virtual EC2 server on AWS

Paul.


Re: IBC headless gateway with wsl2?

 

On Fri, Aug 12, 2022 at 03:54 AM, Richard L King wrote:
telnet 127.0.0.1 7462
Hi,

A list of commands that IBC server accepts on port 7462 would be very useful.

There is no CONNECT or RECONNECT commands for example

Also

The GW issues a warning 5 minutes before it is about to restart (via a popup window). The user has the opportunity at this point to change the time. Would it be possible for IBC to change the restart time to say 5 minutes before the current time and thereby it never restarts as everyday the restart time is reset 10 mins earlier and thus IBC maintains its connection.

Paul


Re: IBC headless gateway with wsl2?

 

开云体育

Hi all,

?

I am running a headless system locally on arch Linux using a virtual display driver. I do not have a monitor attached to the system. ?Yes, because the system is local to my network, I can directly use ssh to administer it. However, even if I were to put the system in the cloud, I would probably follow the same approach except that I would put the ssh behind a VPN perhaps.

?

The reason I came to ibc is because I did not want to have to work with the GUI of the gateway.

?

Usually, the ibc logs are sufficient for troubleshooting.

?

Admittedly, my situation is unique since I am blind and the IB gateway does not work with my screen reader hence I have to go headless, but the entire setup can work without any vnc software being used.

?

Pranav

?


Re: IBC headless gateway with wsl2?

 

开云体育

I completely understand where you’re coming from, and if I were starting today with a blank slate I’d perhaps make very different decisions. But I started using TWS API back in 2003, and my ‘infrastructure’ has been evolving since 1991.

?

I’ve looked at cloud offerings many times over the years (primarily AWS and Azure) and to accommodate all my ‘stuff’ it would be an extra expense that I don’t want to incur, quite apart from the effort of moving it all over. And there isn’t a LightSail Windows machine that could possibly take on what my in-house Dell server does – the top offering with 32GB is too small, and costs $240 per month.

?


Re: IBC headless gateway with wsl2?

 

Richard, I think it is a philosophical question, do you want to own and manage your own infrastructure or delegate it to someone else?

Good thing is you can try it for free with Aws. Lightsail is the easy way to get up and running?

I have had my GW/IBC running with tigervnc-standalone-server for nearly 24hrs now

So now its time to focus on my Java-SpringBoot Rest-API connection to TradingView for signals

Using ? as a base and inheriting and building functionality on top of that......

Paul


Re: IBC headless gateway with wsl2?

 

开云体育

Well, I think perhaps you’re being too dismissive, Paul.

?

My Ubuntu 22.04 LTS server has now been running faultlessly for more than 17 hours with IBC, TWS 1022, Gateway 1019, and the other components that you claim don’t work together. This includes auto-restarts of both Gateway and TWS.

?

So while you clearly had a problem while using them, it’s not clear to me that there wasn’t some other environmental issue that was the cause, rather than just that you were using Xvfb, x11vnc and TightVNC.

?

I’m interested in this because I want to add a section to the IBC User Guide on headless running. I’d like it to be as simple to set up as possible, so I may well go with TigerVNC to avoid the need to install Xvfb. I’ll let my current setup run for the rest of this week, just to convince myself it really does work long-term, then switch it over to TigerVNC and see how that goes.

?

Richard

?


Re: IBC headless gateway with wsl2?

 

I decided to try amazon_linux_2 on Aws, as usually the amazon product is going to be less buggy on Aws


Re: IBC headless gateway with wsl2?

 

All working well now for several hours using tigervnc-standalone-server package and port 5900 open

Next step is to implement the loopback option with port forwarding.

This is a major breakthrough for me as the documented solution :
?which is a summary of?
?
doesn't work

Thanks to 闯ü谤驳别苍 for publishing the solution!!

Happy Bot trading everyone!


Re: Gateway crashing on AWS

 

开云体育

I’ve now got both my live TWS and paper Gateway running on my new Ubuntu Server 22.04 LTS, including auto-restarts at 05:50 GMT.

?

I’m using xvfb and x11vnc, with RealVNC viewer, so pretty much the same setup as you on the server. If it hits the same problem you described, I’ll try switching to TigerVNC as 闯ü谤驳别苍 suggested in the ‘IBC headless gateway with wsl2?’ thread.

?

Richard

?


Re: IBC headless gateway with wsl2?

 

Thanks a lot Jurgen, that was the answer I was looking for. let me try this out and report back to the community here


Re: IBC headless gateway with wsl2?

 

The setup you are following is way too complex and outright dangerous when you run it within a cloud instance. You will severely compromise your server's security if you punch a hole into the AWS firewall for port 5900 so you can access VNC directly. The correct way is for the VNC server as well as TWS/IBGW to operate only on the loopback/localhost interface and to shield them completely from any and all direct access outside of the server. You would then use ssh port forwarding with strong encryption and authentication to connect your VNC client securely through the AWS firewall.

TWS/IBGW use JavaFX for their GUIs and the recent V10 versions require a pretty sophisticated "graphics" card. There is a good chance that Xvfb/TightVNC just are not good enough.

We run an AWS instance with TWS rock stable for years and use TigerVNC. I'd suggest you uninstall Xvfb and TightVNC and replace it with just the tigervnc-standalone-server package.It performs both the frame buffer and VNC server functions and, for startup, you'd use a simple command such as "vncserver :0 -localhost -nolisten tcp"

You can also look at the topic "Can anyone help with crashing IB gateway?" that describes similar IBGW crashes.

闯ü谤驳别苍


Re: Gateway crashing on AWS

 

开云体育

Ok, yes I understand now where the TWS log stuff is coming from: it’s actually what’s displayed in the Gateway’s log pane at the time the window was opened or activated.

?

You didn’t say whether you tried the export DISPLAY=:0 command. The reason I thought this might help is that it’s just possible that Gateway occasionally, for some reason, spawns a separate GUI process, so it would need to inherit the DISPLAY variable which won’t happen if it hasn’t been exported. But I have no evidence that this actually happens.

?

I’ve actually just created an Ubuntu Server 22.04 LTS virtual machine so I can try setting this all up myself. I’ll let you know how I get on.

?

Regarding running on home hardware and internet connection: my internet connection is full fibre to the premises, running at 140Mbps. It’s almost completely reliable: I can’t actually recall any failures at all – other than power failures which knock out the router but are rare here these days, in spite of being in very rural Scotland (rare enough that I’ve never seriously considered bothering with UPSs). The only negative is a ping time of 34ms to the IB servers, so I’m not going to win any races to hit the latest bid or ask!

?

I run TWS/Gateway on a Dell server from 2014 (actually in a Hyper-V VM hosted on that machine). The host has two 6-core hyperthreaded CPUs, and 48GB of RAM. It’s absolutely rock solid. It also runs two sizeable SQL Server databases for market data collection, a mail server, an Ubuntu VM, and a handful of Windows VMs. The VMs are all also rock solid – except Ubuntu which I have to re-install every so often because it gets itself in a mess that I don’t have enough Linux-fu to dig myself out of.

?

I have two other physical computers of around the same age: one is a Microsoft Surface Pro 2, and the other is a desktop from a UK manufacturer. They are also entirely reliable, if a bit slow. If push came to shove, I’d be happy to run my trading stuff on any of them.

?

So I really don’t see there’s any real issue with running on home hardware. Of course, if I were running some AI-driven resource-hungry trading bot that might be a different story in terms of required computing power, but reliability is not really a factor.

?

I would also say that there’s little point in worrying about cloud servers until one has something approaching a viable trading strategy.

?

Richard

?

?


Re: IBC headless gateway with wsl2?

 

Can you give me more details please....

I have followed the setup from


But it doesn't stay up more than a couple of hours before a fatal Java error


Re: Gateway crashing on AWS

 

I changed the config files to spit out as much logging info as possible. This logfile is not editted

I am surprissed that you and others are not running the GW/IBC on the cloud, how can you have a bot rely on your home hardware and internet connection?

I have almost exhausted my options with the xvfb and vnc server combo on ubuntu, might have to try doing the same on amazon linux ......