Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to `ibg-controller` are documented here. The
format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and the project follows [Semantic Versioning](https://semver.org/).

## [Unreleased]

### Added

- **`BYPASS_ORDER_PRECAUTIONS` (issue #68).** `yes` ticks Gateway's
"Bypass Order Precautions for API Orders" box under Configure →
Settings → API → Precautions, `no` unticks it, and unset leaves it as
it is. Some accounts show the box as "Bypass Order and Ticket
Precautions for API Orders and Tickets"; the controller sets whichever
label Gateway shows. It's read back after OK: `Verified: … reads back
as True`, or `ALERT_CONFIG_NOT_APPLIED ... env_var=BYPASS_ORDER_PRECAUTIONS`
if Gateway didn't keep it or the box isn't there to set.
`scripts/ibc_config_to_env.py` maps IBC's `BypassOrderPrecautions` to it.

## [0.16.1] - 2026-10-12

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Deeper guides:
| Multi-method 2FA | ⚠️ needs one method | ⚠️ needs one method | both dialog shapes are detected and driven, but IBKR kicks the session on most accounts we've seen when the method is switched mid-login; run a single method, see [2FA](#2fa) |
| Passkey prompt (`PASSKEY_AUTHENTICATE=yes`) | ⚠️ contributor-validated | ⚠️ untested | presses Authenticate; your authenticator completes WebAuthn; amd64 plus extra libraries; see [2FA](#2fa) |
| Existing-session dialog | ✅ verified | ⚠️ code in place | also answered when it appears after the TOTP code (v0.16.0, unit-tested) |
| Post-login config (`READ_ONLY_API`, `TWS_MASTER_CLIENT_ID`, auto logoff/restart times) | ✅ verified | ⚠️ untested | selecting Auto restart and the AM/PM buttons: v0.16.0, unit-tested |
| Post-login config (`READ_ONLY_API`, `BYPASS_ORDER_PRECAUTIONS`, `TWS_MASTER_CLIENT_ID`, auto logoff/restart times) | ✅ verified | ⚠️ untested | `BYPASS_ORDER_PRECAUTIONS` (v0.16.2) and selecting Auto restart with Gateway's notice (v0.16.1): run on a paper 10.50.1f Gateway; the AM button: unit-tested |
| Command server (`STOP`, `RESTART`, `RECONNECTACCOUNT`, `ENABLEAPI`) | ✅ verified | ⚠️ untested | `RECONNECTDATA` is TWS-only |

✅ verified = run end-to-end against a real IB account.
Expand Down Expand Up @@ -253,6 +253,7 @@ real product.
|---|---|
| `TWS_MASTER_CLIENT_ID` | Master API client ID |
| `READ_ONLY_API` | `yes`/`no`. Read back after login; `ALERT_CONFIG_NOT_APPLIED` if Gateway didn't keep it. |
| `BYPASS_ORDER_PRECAUTIONS` | `yes`/`no` (also `true`/`false`, `on`/`off`, `1`/`0`): ticks or unticks Configure → Settings → API → Precautions → Bypass Order Precautions for API Orders. Unset leaves it as it is. Read back after login like `READ_ONLY_API`. |
| `AUTO_LOGOFF_TIME` / `AUTO_RESTART_TIME` | `HH:MM` / `HH:MM AM/PM`. Gateway shows one field or the other, depending on whether its Auto logoff (the default) or Auto restart button is selected; set both vars and the controller handles whichever is displayed. With only `AUTO_RESTART_TIME` set, the controller selects **Auto restart** first, since Gateway starts in Auto logoff mode (11:45 PM). It also selects the AM or PM radio button beside the time, and the read-back after login confirms what Gateway kept (`ALERT_CONFIG_NOT_APPLIED` if not). Gateway's own logoff timer is unreliable, so if the same Gateway is still running 5 minutes after `AUTO_LOGOFF_TIME`, the controller logs it off itself (`LOGOFF_BACKSTOP`). It only does this for a time written with AM or PM (`05:01 PM`) that Gateway showed back on that login, for a session that logged in before that time, within an hour after it, and only when `AUTO_RESTART_TIME` is unset and Gateway's time zone (`TIME_ZONE`) matches the container's (`TZ`) — so it never adds a logoff Gateway wasn't already scheduled to do. With no `AUTO_LOGOFF_TIME`, nothing changes. |
| `AUTO_RESTART_ADOPT` | Default `yes`: when Gateway restarts itself at `AUTO_RESTART_TIME`, adopt the new JVM instead of launching a second one. Gateway normally carries the session across, so no login and no 2FA; when it doesn't, the controller re-drives login on the adopted JVM. `no` restores always-relaunch. Wait budget: `AUTO_RESTART_ADOPT_TIMEOUT_SECONDS` (90). |

Expand Down
10 changes: 7 additions & 3 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,9 @@ Why each was added:
(live) / 4002 (paper) until it accepts a connection. **This is the
definitive readiness signal.**
9. **Post-login config** (v0.2): `handle_post_login_config()` — if any
of `TWS_MASTER_CLIENT_ID` / `READ_ONLY_API` / `AUTO_LOGOFF_TIME` /
`AUTO_RESTART_TIME` is set, open Configure → Settings, navigate
of `TWS_MASTER_CLIENT_ID` / `READ_ONLY_API` /
`BYPASS_ORDER_PRECAUTIONS` / `AUTO_LOGOFF_TIME` / `AUTO_RESTART_TIME`
is set, open Configure → Settings, navigate
tree via `JTREE_SELECT_PATH`, apply values via `SETTEXT_BY_LABEL`
and `JCHECK`, commit via `CLICK_IN_WIN Configuration|OK`. Gateway
shows *either* Auto Log Off Time *or* Auto Restart Time in Lock
Expand All @@ -287,7 +288,10 @@ Why each was added:
15 s means `ALERT_CONFIG_NOT_APPLIED`, the open dialogs' text in the
log, and no read-back. If the agent never returns a window list, nothing
is read back either (a WARNING says so). Once the dialog has closed, it re-opens it and reads
back what it wrote: the Lock and Exit time, and Read-Only API (`JSTATE`).
back what it wrote: the Lock and Exit time, and Read-Only API and the
API → Precautions bypass box (`JSTATE`). Gateway labels that box one
of two ways depending on the account; the handler asks `JSTATE` for
each and sets the one that answers.
10. **Command server** (v0.2): `start_command_server()` — if
`CONTROLLER_COMMAND_SERVER_PORT` is set, start a daemon thread
listening on that TCP port for IBC-compat commands (`STOP`,
Expand Down
1 change: 1 addition & 0 deletions docs/FROM_IBC.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ review). The tool's `--help` output lists every key it knows about.
|---|---|---|
| `ExistingSessionDetectedAction` | `EXISTING_SESSION_DETECTED_ACTION` | `primary` / `primaryoverride` / `secondary` / `manual`. |
| `ReadOnlyApi` | `READ_ONLY_API` | yes/no. |
| `BypassOrderPrecautions` | `BYPASS_ORDER_PRECAUTIONS` | yes/no: Configure → Settings → API → Precautions → Bypass Order Precautions for API Orders. Separate from `BypassWarning`, which is about dialog buttons. |
| `AutoRestartTime` | `AUTO_RESTART_TIME` | `HH:MM AM/PM`. |
| `IbAutoClosedown` | — | Set `AUTO_LOGOFF_TIME=HH:MM` directly; the controller drives the Gateway field with that value. |
| `AllowBlindTrading` | `ALLOW_BLIND_TRADING` | yes/no. |
Expand Down
2 changes: 2 additions & 0 deletions docs/MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ after login completes. These IBC env vars now take effect:

- **`TWS_MASTER_CLIENT_ID`** — integer, sets the Master API client ID
- **`READ_ONLY_API`** — `yes`/`no`, toggles the Read-Only API checkbox
- **`BYPASS_ORDER_PRECAUTIONS`** — `yes`/`no`, toggles API →
Precautions → Bypass Order Precautions for API Orders
- **`AUTO_LOGOFF_TIME`** — `HH:MM`, sets Lock and Exit → Set Auto
Log Off Time
- **`AUTO_RESTART_TIME`** — `HH:MM AM/PM`, sets Lock and Exit → Set
Expand Down
16 changes: 15 additions & 1 deletion docs/OBSERVABILITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ one of the two times is set and the controller selects its mode:
line with `reason="discarded with a Lock and Exit change that could not
be undone"`. Check Read-Only API over VNC before trading.

`READ_ONLY_API` is read back the same way (#69):
`READ_ONLY_API` is read back the same way (#69), and so is
`BYPASS_ORDER_PRECAUTIONS` (#68), whose `setting` is the box's label as
Gateway shows it:

```
ALERT_CONFIG_NOT_APPLIED mode=live setting="Read-Only API" env_var=READ_ONLY_API requested="no" reason="Gateway did not retain the value after OK; API clients cannot place or change orders"
Expand All @@ -294,6 +296,18 @@ and read, but trading requests get error 321 ("The API interface is
currently in Read-Only mode"). With `requested="yes"` the reason ends
`API clients can place orders`.

For `BYPASS_ORDER_PRECAUTIONS` the read-back reason ends `API orders
still go through order precautions` (requested `yes`) or `API orders
still bypass order precautions` (requested `no`). Other reasons come
before OK, when the box couldn't be set at all: `could not select API →
Precautions`, `the bypass box is not showing, or is disabled, on API →
Precautions` (Gateway can show it greyed out), `more than one box on API
→ Precautions has that label`, and `the bypass box could not be set`.
Either way the precautions apply as Gateway had them. Both settings take
`yes`/`true`/`on`/`1` or `no`/`false`/`off`/`0`, in any case; anything
else (a typo such as `BYPASS_ORDER_PRECAUTIONS=y`) gets a WARNING and
leaves the box alone, as it does for `READ_ONLY_API`.

`reason="the settings dialog did not close after OK; see the dialog
Gateway is showing"` (v0.16.1): Gateway held the dialog open behind a
prompt the controller doesn't answer, so nothing in it is confirmed
Expand Down
Loading
Loading