Trader Workstation

From Wiki
Revision as of 11:28, 18 January 2021 by Marcluer (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Linux installation

  • install oracle java [1]
    • sudo apt-add-repository ppa:webupd8team/java
    • sudo apt-get update
    • sudo apt-get install oracle-java8-installer
  • download tws
  • ~/TWS/tws.sh
#!/bin/bash
cd IBJts
java -cp jts.jar:hsqldb.jar:jcommon-1.0.12.jar:jfreechart-1.0.9.jar:jhall.jar:other.jar:rss.jar -Xmx512M -XX:MaxPermSize=512M jclient.LoginFrame . &
  • ~/TWS/gateway.sh
#!/bin/bash
cd IBJts
java -cp jts.jar:hsqldb.jar:jcommon-1.0.12.jar:jhall.jar:other.jar:rss.jar -Dsun.java2d.noddraw=true -Xmx512M ibgateway.GWClient . &

autologin + keep alive

  • apt-get install devilspie xdotool
  • ~/.devilspie/tws_login.ds
(if (matches (application_name) "Login")
	(begin
		(if (matches (window_name) "Login")
			(begin
				(if (is (window_class) "jclient-LoginFrame")
					(begin
						(println "TWS Login window detected")
						(center)
						(above)
						(spawn_async 'sh /home/user/.devilspie/tws_login.sh')
					)
				)
			)
		)
	)
)
  • ~/.devilspie/tws_login.sh
#!/bin/bash

wid=$(xdotool search --onlyvisible --name Login)

xdotool windowactivate $wid

xdotool type "tws_user"
sleep 0.2
xdotool key Tab
sleep 0.2
xdotool type "tws_pass"
sleep 0.2
xdotool type --delay 50 "					"
sleep 0.2
xdotool type --delay 50 " "

  • ~/.devilspie/tws_autologoff.ds
(if (matches (application_name) "Exit Session Setting")
	(begin
		(if (matches (window_name) "Exit Session Setting")
			(begin
				(if (is (window_class) "jclient-LoginFrame")
					(begin
						(println "TWS Exit window detected")
						(center)
						(above)
						(spawn_async 'sh /home/user/.devilspie/tws_autologoff.sh')
					)
				)
			)
		)
	)
)
  • ~/.devilspie/tws_autologoff.sh
#!/bin/bash

wid=$(xdotool search --onlyvisible --name 'Exit Session Setting')

pwd

xdotool windowactivate $wid

sleep 0.2
xdotool type --delay 50 "	"

sleep 0.2
xdotool key --delay 50 Home
sleep 0.2
xdotool keydown --delay 50 shift
sleep 0.2
xdotool key --delay 50 End
sleep 0.2
xdotool keyup --delay 50 shift
sleep 0.2
xdotool key --delay 50 Delete



sleep 0.2
if [ -e tws_autologoff.var ]
    then
	xdotool type --delay 100 "02"
	rm tws_autologoff.var
    else
	xdotool type --delay 100 "01"
	touch tws_autologoff.var
fi

sleep 0.2
xdotool key --delay 50 colon
sleep 0.2
xdotool type --delay 100 "00"


sleep 0.2
xdotool type --delay 50 "			"
sleep 0.2
xdotool type --delay 50 " "

sleep 0.2
xdotool type --delay 50 "	"
sleep 0.2
xdotool type --delay 50 " "