-
Notifications
You must be signed in to change notification settings - Fork 113
Runtime environment
Whether running using an image or as standalone, IBeam expects IBKR credentials to be provided as environment variables. We recommend you start using IBeam with your paper account credentials, and only switch to production account once you're ready to trade.
-
IBEAM_ACCOUNT
- IBKR account name -
IBEAM_PASSWORD
- IBKR account password
IBeam expects an optional third credential IBEAM_KEY
. If provided, it will be used to decrypt the password given in the IBEAM_PASSWORD
variable. cryptography.fernet decryption is used, therefore to encrypt your password use:
from cryptography.fernet import Fernet
key = Fernet.generate_key()
f = Fernet(key)
password = f.encrypt(b"your_ibkr_password123")
print(f'IBEAM_PASSWORD={password}, IBEAM_KEY={key}')
If any of the required credentials environment variables is not found, user will be prompted to enter them directly in the terminal.
When running standalone, IBeam requires the following to be present:
Additionally, the following environment variables:
-
IBEAM_CHROME_DRIVER_PATH
- path to the Chome Driver executable -
IBEAM_GATEWAY_DIR
- path to the root of the Gateway
Note that you can chose to not use the ibeam_starter.py
script and instantiate and use the ibeam.gateway_client.GatewayClient
directly in your script instead. This way you will be able to provide any of the credentials, as well as the Chrome Driver and Gateway paths directly upon construction of the GatewayClient
.
To facilitate custom usage and become more future-proof, IBeam expects the following environment variables altering its behaviour:
Variable name | Default value | Description |
---|---|---|
IBEAM_GATEWAY_STARTUP |
3 | How many seconds to wait before attempting to communicate with the gateway after its startup. |
IBEAM_GATEWAY_BASE_URL |
https://localhost:5000 |
Base URL of the gateway. |
IBEAM_GATEWAY_PROCESS_MATCH |
ibgroup.web.core.clientportal.gw.GatewayStart | The gateway process' name to match against |
IBEAM_ROUTE_AUTH |
/sso/Login?forwardTo=22&RL=1&ip2loc=on | Gateway route with authentication page. |
IBEAM_ROUTE_USER |
/v1/api/one/user | Gateway route |
IBEAM_ROUTE_VALIDATE |
/v1/portal/sso/validate | Gateway route with validation call. |
IBEAM_ROUTE_TICKLE |
/v1/api/tickle | Gateway route with tickle call. |
IBEAM_USER_NAME_EL_ID |
user_name | HTML element id containing the username input field. |
IBEAM_PASSWORD_EL_ID |
password | HTML element id containing the password input field. |
IBEAM_SUBMIT_EL_ID |
submitForm | HTML element id containing the submit button. |
IBEAM_SUCCESS_EL_TEXT |
Client login succeeds | HTML element text indicating successful authentication. |
IBEAM_MAINTENANCE_INTERVAL |
60 | How many seconds between each maintenance. |
IBEAM_LOG_LEVEL |
INFO | Verbosity level of the logger used. |
IBEAM_REQUEST_RETRIES |
1 | How many times to reattempt a request to the gateway. |
IBEAM_REQUEST_TIMEOUT |
15 | How many seconds to wait for a request to complete. |
IBEAM_OAUTH_TIMEOUT |
15 | How many seconds to wait for the OAuth login request to complete. |
Variable name | Default value | Description |
---|---|---|
IBEAM_INPUTS_DIR |
/srv/inputs/ | Directory path of Inputs Directory. |
IBEAM_OUTPUTS_DIR |
../outputs | Directory path of Outputs Directory. |
IBEAM_GATEWAY_DIR |
None | Path to the root of the IBKR Gateway. |
IBEAM_CHROME_DRIVER_PATH |
None | Path to the Chrome Driver executable file. |
IBEAM_GATEWAY_STARTUP |
20 | How many seconds to wait for the Gateway to respond after its startup. |
IBEAM_GATEWAY_PROCESS_MATCH |
ibgroup.web.core.clientportal.gw.GatewayStart | The gateway process' name to match against. |
IBEAM_MAINTENANCE_INTERVAL |
60 | How many seconds between each maintenance. |
IBEAM_SPAWN_NEW_PROCESSES |
False | Whether new processes should be spawned for each maintenance. |
IBEAM_LOG_LEVEL |
INFO | Verbosity level of the logger used. |
IBEAM_LOG_TO_FILE |
True | Whether logs should also be saved to a file. |
IBEAM_REQUEST_RETRIES |
1 | How many times to reattempt a request to the gateway. |
IBEAM_REQUEST_TIMEOUT |
15 | How many seconds to wait for a request to complete. |
Variable name | Default value | Description |
---|---|---|
IBEAM_GATEWAY_BASE_URL |
https://localhost:5000 | Base URL of the gateway. |
IBEAM_ROUTE_AUTH |
/sso/Login?forwardTo=22&RL=1&ip2loc=on | Gateway route with authentication page. |
IBEAM_ROUTE_USER |
/v1/api/one/user | Gateway route with user information. |
IBEAM_ROUTE_VALIDATE |
/v1/portal/sso/validate | Gateway route with validation call. |
IBEAM_ROUTE_REAUTHENTICATE |
/v1/portal/iserver/reauthenticate?force=true | Gateway route with reauthentication call. |
IBEAM_ROUTE_AUTH_STATUS |
/v1/api/iserver/auth/status | Gateway route with authentication status call. |
IBEAM_ROUTE_TICKLE |
/v1/api/tickle | Gateway route with tickle call. |
Variable name | Default value | Description |
---|---|---|
IBEAM_USER_NAME_EL_ID |
user_name | HTML element id containing the username input field. |
IBEAM_PASSWORD_EL_ID |
password | HTML element id containing the password input field. |
IBEAM_SUBMIT_EL_ID |
submitForm | HTML element id containing the submit button. |
IBEAM_ERROR_EL_ID |
ERRORMSG | HTML element id containing the submit button. |
IBEAM_SUCCESS_EL_TEXT |
Client login succeeds | HTML element text indicating successful authentication. |
IBEAM_OAUTH_TIMEOUT |
15 | How many seconds to wait for the OAuth login request to complete. |
IBEAM_PAGE_LOAD_TIMEOUT |
15 | How many seconds to wait for the login page to load. |
IBEAM_ERROR_SCREENSHOTS |
False | Whether to save login page screenshots on error. |
IBEAM_MAX_FAILED_AUTH |
5 | Maximum number of failed authentication attempts. |
Variable name | Default value | Description |
---|---|---|
IBEAM_TWO_FA_EL_ID |
twofactbase | HTML element check for if Gateway will require 2FA authentication. |
IBEAM_TWO_FA_INPUT_EL_ID |
chlginput | HTML element to input 2FA code into |
IBEAM_TWO_FA_HANDLER |
None | Which 2FA handler should be used to acquire the code. |
IBEAM_STRICT_TWO_FA_CODE |
True | Whether to ensure only 2FA code made of 6 digits can be used. |
Learn about Inputs Directory and Gateway Configuration
See any error on this page? Create an Issue and let us know.