how to run desktop version of interactive brokers tws on android phone

you can run full TWS on android phone, to use, for example, with Samsung DEX using following steps:

. install TERMUX and AVNC from f-droid (version on google play is outdated)
. install ubuntu on termux

termux-setup-storage
apt-get update && apt-get upgrade
apt-get install wget proot git
git clone https://github.com/MFDGaming/ubuntu-in-termux.git
cd ubuntu-in-termux
chmod +x ubuntu.sh
./ubuntu.sh -y
./startubuntu.sh
apt update
apt install tightvncserver
apt install wm2
export USER=root

.download tws and install java8 and java11 using

wget https://download2.interactivebrokers.com/installers/tws/latest/tws-latest-linux-x64.sh
apt install gnupg
wget -q -O - https://download.bell-sw.com/pki/GPG-KEY-bellsoft | apt-key add -
echo "deb [arch=arm64] https://apt.bell-sw.com/ stable main" | tee /etc/apt/sources.list.d/bellsoft.list
apt-get update
apt-get install bellsoft-java8
apt-get install bellsoft-java11-full

. run downloaded tws installer by executing

app_java_home="/usr/lib/jvm/bellsoft-java8-aarch64" sh tws-latest-linux-x64.sh

run TWS using

export USER=root
export DISPLAY=:1
vncserver &
app_java_home="/usr/lib/jvm/bellsoft-java11-full-aarch64" sh Jts/tws

to stop vncserver use

vncserver -kill :1

to disable autoupdates :
edit file ./Jts/tws.vmoptions . Add line at the end -DskipUpdateCheck=true

if updating, dont forget to backup scanner files .stp in Jts subdirs

to run WTS you can create following script named runtws.sh and run it by source command with
. runtws.sh

#!/bin/sh
rm -f /tmp/.X1-lock
rm -rf /tmp/.X11-unix
export DISPLAY=:1
vncserver &
app_java_home="/usr/lib/jvm/bellsoft-java11-full-aarch64" sh Jts/tws

Posted in quant trading