Skip to content

Commit

Permalink
Update IBC
Browse files Browse the repository at this point in the history
  • Loading branch information
forhire committed Aug 7, 2024
1 parent b820d2b commit 57276dc
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Logs/*
node_modules/

*.local
.env*
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ARG IB_GATEWAY_VERSION=stable-standalone
ARG IB_CONTROLLER_VERSION=3.19.0
ARG IB_GATEWAY_INSTVER=stable-standalone

# https://github.com/IbcAlpha/IBC/releases/download/3.18.0-Update.1/IBCLinux-3.18.0.zip
# https://github.com/IbcAlpha/IBC/releases/download/3.19.0/IBCLinux-3.19.0.zip

# Install necessary packages
RUN set -x && apt-get update && \
Expand Down Expand Up @@ -59,7 +59,7 @@ RUN set -x && \
rm ibgateway-${IB_GATEWAY_VERSION}-linux-x64.sh && \
mkdir -p /opt/IBController/Logs && \
cd /opt/IBController/ && \
wget -q https://github.com/IbcAlpha/IBC/releases/download/${IB_CONTROLLER_VERSION}-Update.1/IBCLinux-${IB_CONTROLLER_VERSION}.zip && \
wget -q https://github.com/IbcAlpha/IBC/releases/download/${IB_CONTROLLER_VERSION}/IBCLinux-${IB_CONTROLLER_VERSION}.zip && \
unzip IBCLinux-${IB_CONTROLLER_VERSION}.zip && \
rm IBCLinux-${IB_CONTROLLER_VERSION}.zip && \
chmod -R u+x ./*.sh ./scripts/*.sh
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
IB Gateway running in Docker with [IB Controller](https://github.com/ib-controller/ib-controller/) and VNC

* TWS Gateway: 10.29.1e
* IBC: 3.18.0
* IBC: 3.19.0

### Docker container image

Expand Down
245 changes: 200 additions & 45 deletions ib/IBController.ini
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ReloginAfterSecondFactorAuthenticationTimeout=no
# after the user acknowledges the second factor authentication
# alert at the IBKR Mobile app. If login has not completed after
# this time, IBC terminates.
# The default value is 40.
# The default value is 60.

SecondFactorAuthenticationExitInterval=

Expand Down Expand Up @@ -191,7 +191,7 @@ ExitAfterSecondFactorAuthenticationTimeout=no
# account must be supplied. If it is set to 'paper', then either
# the live or the paper-trading credentials may be supplied.

TradingMode=paper
TradingMode=live


# Paper-trading Account Warning
Expand All @@ -205,7 +205,7 @@ TradingMode=paper
# confirm acceptance. Setting it to 'no' will leave the dialog
# on display, and the user will have to deal with it manually.

AcceptNonBrokerageAccountWarning=yes
AcceptNonBrokerageAccountWarning=no


# Login Dialog Display Timeout
Expand Down Expand Up @@ -270,16 +270,19 @@ IbDir=
# Store settings on server
# ------------------------
#
# If you wish to store a copy of your TWS settings on IB's
# servers as well as locally on your computer, set this to
# TWS only: if you wish to store a copy of your TWS settings on
# IB's servers as well as locally on your computer, set this to
# 'yes': this enables you to run TWS on different computers
# with the same configuration, market data lines, etc. If set
# to 'no', running TWS on different computers will not share the
# same settings. If no value is specified, TWS will obtain its
# settings from the same place as the last time this user logged
# in (whether manually or using IBC).
#
# Note that this setting does not apply to Gateway, which does not
# provide this capability.

StoreSettingsOnServer=yes
StoreSettingsOnServer=


# Minimize TWS on startup
Expand Down Expand Up @@ -323,21 +326,38 @@ MinimizeMainWindow=no
#
# The default is 'manual'.

ExistingSessionDetectedAction=primary
ExistingSessionDetectedAction=manual


# Override TWS API Port Number
# ----------------------------
#
# If OverrideTwsApiPort is set to an integer, IBC changes the
# 'Socket port' in TWS's API configuration to that number shortly
# after startup. Leaving the setting blank will make no change to
# the current setting. This setting is only intended for use in
# certain specialized situations where the port number needs to
# If OverrideTwsApiPort is set to an integer, IBC changes the
# 'Socket port' in TWS's API configuration to that number shortly
# after startup (but note that for the FIX Gateway, this setting is
# actually stored in jts.ini rather than the Gateway's settings
# file). Leaving the setting blank will make no change to
# the current setting. This setting is only intended for use in
# certain specialized situations where the port number needs to
# be set dynamically at run-time, and for the FIX Gateway: most
# non-FIX users will never need it, so don't use it unless you know
# you need it.

OverrideTwsApiPort=


# Override TWS Master Client ID
# -----------------------------
#
# If OverrideTwsMasterClientID is set to an integer, IBC changes the
# 'Master Client ID' value in TWS's API configuration to that
# value shortly after startup. Leaving the setting blank will make
# no change to the current setting. This setting is only intended
# for use in certain specialized situations where the value needs to
# be set dynamically at run-time: most users will never need it,
# so don't use it unless you know you need it.

OverrideTwsApiPort=
OverrideTwsMasterClientID=


# Read-only Login
Expand All @@ -357,7 +377,6 @@ OverrideTwsApiPort=
# If the user is not enrolled in IB's account security programme,
# this setting is ignored. The default is 'no'.

LogToConsole=yes
ReadOnlyLogin=no


Expand All @@ -374,7 +393,44 @@ ReadOnlyLogin=no
# set the relevant checkbox (this only needs to be done once) and
# not provide a value for this setting.

ReadOnlyApi=no
ReadOnlyApi=


# API Precautions
# ---------------
#
# These settings relate to the corresponding 'Precautions' checkboxes in the
# API section of the Global Configuration dialog.
#
# For all of these, the accepted values are:
# - 'yes' sets the checkbox
# - 'no' clears the checkbox
# - if not set, the existing TWS/Gateway configuration is unchanged
#
# NB: thess settings are really only supplied for the benefit of new TWS
# or Gateway instances that are being automatically installed and
# started without user intervention, or where user settings are not preserved
# between sessions (eg some Docker containers). Where a user is involved, they
# should use the Global Configuration to set the relevant checkboxes and not
# provide values for these settings.

BypassOrderPrecautions=

BypassBondWarning=

BypassNegativeYieldToWorstConfirmation=

BypassCalledBondWarning=

BypassSameActionPairTradeWarning=

BypassPriceBasedVolatilityRiskWarning=

BypassUSStocksMarketDataInSharesWarning=

BypassRedirectOrderWarning=

BypassNoOverfillProtectionPrecaution=


# Market data size for US stocks - lots or shares
Expand Down Expand Up @@ -429,19 +485,93 @@ AcceptBidAskLastSizeDisplayUpdateNotification=
SendMarketDataInLotsForUSstocks=


# Trusted API Client IPs
# ----------------------
#
# NB: THIS SETTING IS ONLY RELEVANT FOR THE GATEWAY, AND ONLY WHEN FIX=yes.
# In all other cases it is ignored.
#
# This is a list of IP addresses separated by commas. API clients with IP
# addresses in this list are able to connect to the API without Gateway
# generating the 'Incoming connection' popup.
#
# Note that 127.0.0.1 is always permitted to connect, so do not include it
# in this setting.

TrustedTwsApiClientIPs=


# Reset Order ID Sequence
# -----------------------
#
# The setting resets the order id sequence for orders submitted via the API, so
# that the next invocation of the `NextValidId` API callback will return the
# value 1. The reset occurs when TWS starts.
#
# Note that order ids are reset for all API clients, except those that have
# outstanding (ie incomplete) orders: their order id sequence carries on as
# before.
#
# Valid values are 'yes', 'true', 'false' and 'no'. The default is 'no'.

ResetOrderIdsAtStart=


# This setting specifies IBC's action when TWS displays the dialog asking for
# confirmation of a request to reset the API order id sequence.
#
# Note that the Gateway never displays this dialog, so this setting is ignored
# for a Gateway session.
#
# Valid values consist of two strings separated by a solidus '/'. The first
# value specifies the action to take when the order id reset request resulted
# from setting ResetOrderIdsAtStart=yes. The second specifies the action to
# take when the order id reset request is a result of the user clicking the
# 'Reset API order ID sequence' button in the API configuration. Each value
# must be one of the following:
#
# 'confirm'
# order ids will be reset
#
# 'reject'
# order ids will not be reset
#
# 'ignore'
# IBC will ignore the dialog. The user must take action.
#
# The default setting is ignore/ignore

# Examples:
#
# 'confirm/reject' - confirm order id reset only if ResetOrderIdsAtStart=yes
# and reject any user-initiated requests
#
# 'ignore/confirm' - user must decide what to do if ResetOrderIdsAtStart=yes
# and confirm user-initiated requests
#
# 'reject/ignore' - reject order id reset if ResetOrderIdsAtStart=yes but
# allow user to handle user-initiated requests

ConfirmOrderIdReset=



# =============================================================================
# 4. TWS Auto-Logoff and Auto-Restart
# 4. TWS Auto-Logoff, Auto-Restart and Cold Restart
# =============================================================================
#
# TWS and Gateway insist on being restarted every day. Two alternative
# automatic options are offered:
#
# - Auto-Logoff: at a specified time, TWS shuts down tidily, without
# restarting.
# restarting. The user must make their own arrangements for restarting
# as required.
#
# - Auto-Restart: at a specified time, TWS shuts down and then restarts
# without the user having to re-autheticate.
# without the user having to re-authenticate (in particulaar this avoids
# the need for second factor authentication after the initial login). Make
# sure to read the section on Auto-Restart limitations and Cold Restart
# below for important further information.
#
# The normal way to configure the time at which this happens is via the Lock
# and Exit section of the Configuration dialog. Once this time has been
Expand All @@ -466,45 +596,72 @@ SendMarketDataInLotsForUSstocks=
# (for example on a desktop computer) the value will be persisted as if the
# user had set it via the configuration dialog.
#
# If you choose to auto-restart, you should take note of the considerations
# described at the link below. Note that where this information mentions
# 'manual authentication', restarting IBC will do the job (IBKR does not
# recognise the existence of IBC in its docuemntation).
#
# https://www.interactivebrokers.com/en/software/tws/twsguide.htm#usersguidebook/configuretws/auto_restart_info.htm
#
# If you use the "RESTART" command via the IBC command server, and IBC is
# running any version of the Gateway (or a version of TWS earlier than 1018),
# note that this will set the Auto-Restart time in Gateway/TWS's configuration
# dialog to the time at which the restart actually happens (which may be up to
# a minute after the RESTART command is issued). To prevent future auto-
# restarts at this time, you must make sure you have set AutoLogoffTime or
# AutoRestartTime to your desired value before running IBC. NB: this does not
# apply to TWS from version 1018 onwards.
# running any version of the Gateway, note that this will set the Auto-Restart
# time in Gateway's configuration dialog to the time at which the restart
# actually happens (which may be up to a minute after the RESTART command is
# issued). To prevent future auto-restarts at this time, you must make sure you
# have set AutoLogoffTime or AutoRestartTime in this file to your desired value
# before running IBC again.

AutoLogoffTime=

AutoRestartTime=


# Auto-Restart limitations and Cold Restart
# -----------------------------------------
#
# If you choose to use auto-restart, you should take note of the considerations
# described at the link below. Note that where this information mentions
# 'manual authentication', closing down and restarting IBC will do the job
# (IBKR does not recognise the existence of IBC in its docuemntation). IBC
# calls this procedure a Cold Restart.
#
# https://www.ibkrguides.com/tws/usersguidebook/configuretws/auto_restart_info.htm?Highlight=auto-restart
#
# To assist in complying with the requirement to fully shut down TWS on
# Sundays, IBC can be configured with a Cold Restart Time, which is a time
# (specified in your local timeframe) that is after 01:00 US/Eastern. When
# this time is reached on Sundays, IBC tidily closes TWS, and the script then
# reloads IBC thus starting a new instance of TWS and initiating the usual full
# logon. There is thus no need to make any other arrangements for closing and
# restarting at the weekend. For a live account, the time chosen should be
# convenient for you to handle 2FA alerts.
#
# When deciding what time to use for Cold Restart, bear in mind that the offset
# between your timezone and US/Eastern may vary if transitions to and from
# Daylight Saving Time occur on different days. For example in the UK, this
# offset can vary between 4 hours and 6 hours, so in this case it would be
# reasonable to set the Cold Restart time to, for example, 07:05, which is
# always after 01:00 US/Eastern. However if you're not an early riser on
# Sundays you might prefer a more sociable time such as 13:00.
#
# To initiate Cold Restart on Sundays, set this value to <hh:mm>, this being a
# time in yoour local timezone that is after 01:00 US/Eastern:

ColdRestartTime=



# =============================================================================
# 5. TWS Tidy Closedown Time
# =============================================================================
#
# Specifies a time at which TWS will close down tidily, with no restart.
#
# There is little reason to use this setting. It is similar to AutoLogoffTime,
# but can include a day-of-the-week, whereas AutoLogoffTime and AutoRestartTime
# apply every day. So for example you could use ClosedownAt in conjunction with
# AutoRestartTime to shut down TWS on Friday evenings after the markets
# close, without it running on Saturday as well.
# This is similar to AutoLogoffTime, but can include a day-of-the-week, whereas
# AutoLogoffTime applies every day. So for example you could use ClosedownAt in
# conjunction with AutoRestartTime to keep TWS running during the week, and to
# shut down on Friday evenings after the markets close, without it running on
# Saturday as well.
#
# To tell IBC to tidily close TWS at a specified time every
# day, set this value to <hh:mm>, for example:
# To tell IBC to tidily close TWS at a specified time every day, set this value
# to <hh:mm>, for example:
# ClosedownAt=22:00
#
# To tell IBC to tidily close TWS at a specified day and time
# each week, set this value to <dayOfWeek hh:mm>, for example:
# To tell IBC to tidily close TWS at a specified day and time each week, set
# this value to <dayOfWeek hh:mm>, for example:
# ClosedownAt=Friday 22:00
#
# Note that the day of the week must be specified using your
Expand Down Expand Up @@ -539,7 +696,7 @@ ClosedownAt=
# configuration page, as this is much more secure (in this case, no
# incoming API connection dialogs will occur for those IP addresses).

AcceptIncomingConnectionAction=accept
AcceptIncomingConnectionAction=manual


# Allow Blind Trading
Expand All @@ -556,7 +713,7 @@ AcceptIncomingConnectionAction=accept
# no means the dialog remains on display and must be
# handled by the user.

AllowBlindTrading=yes
AllowBlindTrading=no


# Save Settings on a Schedule
Expand Down Expand Up @@ -802,6 +959,4 @@ LogStructureWhen=never
#LogComponents=


ShowAllTrades=no
ForceTwsApiPort=4001

0 comments on commit 57276dc

Please sign in to comment.