Skip to main content

Python Wrapper for Interactive Brokers API

Project description

https://img.shields.io/pypi/v/ibcp https://img.shields.io/pypi/pyversions/ibcp https://img.shields.io/pypi/l/ibcp https://readthedocs.org/projects/ibcp/badge/?version=latest
Logo for 'IBCP'

“Logo for ‘IBCP’”

Overview

IBCP is an unofficial python wrapper for Interactive Brokers Client Portal Web API. The motivation for the project was to build a Python wrapper
that is easy to use and understand.

Please see https://ibcp.readthedocs.io for the full documentation.

Features

  • Simple REST API wrapper

  • Easy to use and understand

  • Supports all Interactive Brokers Client Portal Web API endpoints

  • Handles authentication and session management

  • Supports both SSL and non-SSL connections

Requirements

IBCP assumes a gateway session is active and authenticated.

Installation

IBCP was developed under the Voyz/IBeam docker image environment.

Once a gateway session is running, pip command can be used to install IBCP:

pip install ibcp

Usage

import ibcp

ib = ibcp.REST() # default parameters: url="https://localhost:5000", ssl=False

# Get account information
account = ib.get_account()

# Get portfolio
portfolio = ib.get_portfolio()

# Get positions
positions = ib.get_positions()

# Get orders
orders = ib.get_orders()

# Get trades
trades = ib.get_trades()

# Get market data
market_data = ib.get_market_data("AAPL")

# Place order
order = ib.place_order({
    "symbol": "AAPL",
    "secType": "STK",
    "currency": "USD",
    "exchange": "SMART",
    "tif": "DAY",
    "side": "BUY",
    "totalQuantity": 100,
    "orderType": "MKT"
})

For the complete reference, please visit https://ibcp.readthedocs.io/en/latest/reference.html.

Configuration

By default, IBCP assumes the gateway session is open at https://localhost:5000 without an SSL certificate. A custom URL and SSL certificate can be set by:

ib = ibcp.REST(url="https://localhost:5000", ssl=False)

Documentation of available functions is at https://ibcp.readthedocs.io/en/latest/reference.html.

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

ibcp-0.0.3.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ibcp-0.0.3-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file ibcp-0.0.3.tar.gz.

File metadata

  • Download URL: ibcp-0.0.3.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ibcp-0.0.3.tar.gz
Algorithm Hash digest
SHA256 8b23291976f253aff9cffb065befbcad4c9b8909f9283b07bdf807a5e049d847
MD5 48d8145c8128d87d96dc8bf80aaec3ce
BLAKE2b-256 8f5afaf0e40e170f2cc1eff2c54157916f6da6356f80119ad555e8224a7c721f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ibcp-0.0.3.tar.gz:

Publisher: python-publish.yml on matthewmoorcroft/ibcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ibcp-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: ibcp-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ibcp-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0916127cd9f0edf1b9b32702272982aabc35280fd7a9423d509446a69d4a3f46
MD5 5ac1075b45546d6b60fd89b5a591fbf2
BLAKE2b-256 914ba87dfc98958263be4fdd4c7aa4924da46b4ad91d83bfb30660dc9de9b33e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ibcp-0.0.3-py3-none-any.whl:

Publisher: python-publish.yml on matthewmoorcroft/ibcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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