-
Notifications
You must be signed in to change notification settings - Fork 20
IBind Configuration
IBind can be configured through two manners:
-
Constructor parameters for
IbkrClient
andIbkrWsClient
- Environment variables
IbkrClient
and IbkrWsClient
have three common settings that can be configured through their constructor parameters:
- Account ID
- URL
- CAcerts
Many of the IBKR API endpoints require an account ID to be specified.
In most cases this value will be the constant for a particular user, hence both the IbkrClient
and IbkrWsClient
allow to store the account ID by specifying the account_id
parameter upon construction.
IbkrClient(account_id='DU12345678')
Note:
- This value can be set as an environment variable
IBIND_ACCOUNT_ID
, which will be read automatically upon construction. - All API methods that require the account ID to be specified provide an optional
account_id
parameter allowing you to override this class field on case-by-case basis.
The client classes require a URL to the Client Portal Gateway. There are two ways of specifying it:
IbkrClient(url='https://mydomain:6060/v1/api/')
IbkrWsClient(url='wss://mydomain:6060/v1/api/ws')
Note:
- This value can be set as an environment variable
IBIND_REST_URL
, which will be read automatically upon construction.
These then get combined as follows:
-
https://{host}:{port}{base_route}
forIbkrClient
-
wss://{host}:{port}{base_route}
forIbkrWsClient
Eg.:
IbkrClient(port=6060)
The default values are:
host = 'localhost'
port = '5000'
base_route = '/v1/api/' # for IbkrClient
base_route = '/v1/api/ws' # for IbkrWsClient
Note:
- The
host
,port
andbase_route
parameters are ignored if theurl
parameter is provided.
The Client Portal Gateway can be set up to use custom CAcerts. To communicate with it, the API client will need to use the same certificates.
The cacert
parameter allows you to specify a path to the cacert.pem
certificate, eg.:
IbkrClient(cacert='/some/path/to/my/cacert.pem')
Note:
- This value can be set as an environment variable
IBIND_CACERT
, which will be read automatically upon construction. - You can set this value to
False
which will avoid using certificates and verified HTTPS.
See any error on this page? Create an Issue and let us know.