Skip to content

Ibkr Client

voyz edited this page Apr 25, 2024 · 14 revisions

IbkrClient

The IbkrClient class provides an interface to the IBKR REST API.

It shares some basic configuration with the IbkrWsClient. See IBind Configuration - Construction Parameters section for more.

Basic usage of IbkrClient:

from ibind import IbkrClient

c = IbkrClient()
c.tickle()

The IbkrClient class is a concrete implementation of the abstract RestClient class.

The RestClient provides a boilerplate support for common REST methods: GET, POST and DELETE, and handles the request/response processing of all API methods declared in the IbkrClient.

Mapped endpoints

Almost all endpoints defined in the IBKR REST API are mapped to IbkrClient methods. Currently, the endpoint sections that are still NOT mapped are:

  • Alerts
  • FA Allocation Management
  • FYIs and Notifications

Note:

  • IBKR endpoints are not documented in this documentation. Please refer to the official IBKR REST API reference for full documentation.
  • Endpoints' API implementation is categorised into Python class mixins. See ibkr_client_mixins directory for implementation details.

Advanced API

Majority of the IBKR endpoints' mapping is implemented by performing a simple REST request. For example:

class SessionMixin():
    def authentication_status(self: 'IbkrClient') -> Result:
        return self.post('iserver/auth/status')

    ...

In several cases, IbkrClient implements additional logic to allow more sophisticated interaction with the IBKR endpoints.

The advanced API methods are:

  • security_stocks_by_symbol (contract mixin)
  • get_conids (contract mixin)
  • marketdata_history_by_symbol (marketdata mixin)
  • marketdata_unsubscribe (marketdata mixin)
  • marketdata_history_by_symbols (marketdata mixin)
  • place_order (order mixin)
  • modify_order (order mixin)