-
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][paper-account], 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][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:
- [IBKR Client Portal API Gateway][gateway]
- [Java JRE capable of running the Gateway][jre]
- [Google Chrome][chrome]
- [Chrome Driver][chrome-driver]
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. |
See any error on this page? Create an Issue and let us know.