Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Python wrapper for Interactive Brokers Client Portal Web API

License

matthewmoorcroft/ibcp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IBCP: Python Wrapper for Interactive Brokers API

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'

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.

About

Python wrapper for Interactive Brokers Client Portal Web API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%