-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwsstartmacos.sh
157 lines (129 loc) · 5.72 KB
/
twsstartmacos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/bash
#=============================================================================+
# +
# This command file starts the Interactive Brokers' Trader Workstation. +
# +
# If you run it without any arguments it will display a new window showing +
# useful information and then start the Gateway. If you supply -inline as +
# the first argument, the information will be displayed in the current +
# terminal window. +
# +
# The following lines are the only ones you may need to change, and you +
# probably only need to change the first one. +
# +
# The notes below give further information on why you might need to +
# change them. +
# +
#=============================================================================+
TWS_MAJOR_VRSN=972
IBC_INI=~/ibc/config.ini
TRADING_MODE=
IBC_PATH=/opt/ibc
TWS_PATH=~/Applications
TWS_SETTINGS_PATH=
LOG_PATH=~/ibc/logs
TWSUSERID=
TWSPASSWORD=
JAVA_PATH=
# PLEASE DON'T CHANGE ANYTHING BELOW THIS LINE !!
#==============================================================================
# Notes:
#
# TWS_MAJOR_VRSN
#
# Specifies the major version number of TWS to be run. If you are
# unsure of which version number to use, run TWS manually from the
# icon on the desktop, then click Help > About Trader Workstation. In the
# displayed information you'll see a line similar to this:
#
# Build 954.2a, Oct 30, 2015 4:07:54 PM
#
# Here the major version number is 954. Do not include the rest of the
# version number in this setting.
# IBC_INI
#
# This is the location and filename of the IBC configuration file.
# This file should be in a folder in your personal filestore, so that
# other users of your computer can't access it. This folder and its
# contents should also be encrypted so that even users with administrator
# privileges can't see the contents. Note that you can use the HOMEPATH
# environment variable to address the root of your personal filestore
# (HOMEPATH is set automatically by Windows).
# TRADING_MODE
#
# TWS 955 introduced a new Trading Mode combo box on its login dialog.
# This indicates whether the live account or the paper trading account
# corresponding to the supplied credentials is to be used. The values
# allowed here are 'live' and 'paper' (not case-sensitive). For earlier
# versions of TWS, setting this has no effect. If no value is specified
# here, the value is taken from the TradingMode setting in the
# configuration file. If no value is specified there either, the value
# 'live' is assumed.
# IBC_PATH
#
# The folder containing the IBC files.
# TWS_PATH
#
# The folder where Gateway is installed. The Gateway installer always
# installs to ~/Applications. Note that even if you have installed from a
# Gateway download rather than a TWS download, you should still use this
# default setting. It is possibe to move the TWS installation to a
# different folder, but there are virtually no good reasons for doing so.
# TWS_SETTINGS_PATH
#
# The directory where TWS is to store its settings. This setting is ignored
# if the IbDir setting in the configuration file is specified. If no value
# is specified in either place, the settings are stored in the TWS_PATH
# directory.
# LOG_PATH
#
# Specifies the folder where diagnostic information is to be logged while
# this command file is running. This information is very valuable when
# troubleshooting problems, so it is advisable to always have this set to
# a valid location, especially when setting up IBC. You must
# have write access to the specified folder.
#
# Once everything runs properly, you can prevent further logging by
# removing the value as show below (but this is not recommended):
#
# LOG_PATH=
# TWSUSERID
# TWSPASSWORD
#
# If your TWS user id and password are not included in your IBC
# configuration file, you can set them here. However you are strongly
# advised not to set them here because this file is not normally in a
# protected location.
# JAVA_PATH
#
# IB's installer for TWS/Gateway includes a hidden version of Java which
# IB have used to develop and test that particular version. This means that
# it is not necessary to separately install Java. If there is a separate
# Java installation, that does not matter: it won't be used by IBC
# or TWS/Gateway unless you set the path to it here. You should not do this
# without a very good reason.
# End of Notes:
#==============================================================================
APP=TWS
export TWS_MAJOR_VRSN
export IBC_INI
export TRADING_MODE
export IBC_PATH
export TWS_PATH
export TWS_SETTINGS_PATH
export LOG_PATH
export TWSUSERID
export TWSPASSWORD
export JAVA_PATH
export APP
if [[ "$1" == "-inline" ]]; then
exec "${IBC_PATH}/scripts/displaybannerandlaunch.sh"
else
# run in a new terminal session.
# NB: "tell app Terminal" doesn't pass the current
# environment, so we just run this script again
# inside a new terminal session with the -inline argument
osascript -e "tell app \"Terminal\"
do script \"$0 -inline\"
end tell"
fi