Skip to main content

Python wrapper for Interactive Brokers Client Portal Web API

Project description

https://img.shields.io/pypi/v/easyib https://img.shields.io/pypi/pyversions/easyib https://img.shields.io/pypi/l/easyib Documentation Status

EasyIB is an unofficial python wrapper for Interactive Brokers Client Portal Web API.

Features

Notable functionality includes:

  • Pull account info, portfolio, cash balance, net value

  • Pull market historical data

  • Submit, modify, cancel orders

  • Get order status, list of live orders

  • Ping (tickle) server, get authentication status, re-authenticate

How to install

pip install easyib

EasyIB assumes a gateway session is active and authenticated. Follow instructions at https://interactivebrokers.github.io/cpwebapi/ for authentication. A custom package such as Voyz/IBeam can be also used for setting up an active session.

Quick start

Historical data

import easyib

api = easyib.REST()
# By default, easyib assumes the gateway session is at local port 5000 without a ssl certificate
# A custom port may be set by `api = easyib.REST(url="https://localhost:5000", ssl=False)`

bars = api.get_bars("AAPL", period="1w", bar="1d")
print(bars)

Submitting an order

list_of_orders = [
    {
        "conid": api.get_conid("AAPL"),
        "orderType": "MKT",
        "side": "BUY",
        "quantity": 7,
        "tif": "GTC",
    }
]
# For order parameters, see 'order request info' at https://www.interactivebrokers.com/api/doc.html#tag/Order/paths/~1iserver~1account~1{accountId}~1orders/post

api.submit_orders(list_of_orders)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easyib-0.0.5.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

easyib-0.0.5-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page