ib_insync-guide-interactive-brokers icon indicating copy to clipboard operation
ib_insync-guide-interactive-brokers copied to clipboard

A guide to using the Interactive Brokers API with the Python ib_insync library

=============================================================== ib_insync Guide - Interactive Brokers API - AlgoTrading101 Blog

This is the code used in ib_insync Guide <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/>_ published on the Algotrading101 Blog


Table of Contents

  • What is ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#what-is-ib-insync>_
  • Why should I use ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#why-should-i-use-ib-insync>_
  • Why shouldn’t I use ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#why-shouldn't-i-use-ib-insync>_
  • What is the Interactive Brokers API? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#what-is-the-interactive-brokers-api>_
  • How to sign up for a demo account for Interactive Brokers and set up the trading platform? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#sign-up-for-a-demo-with-interactive-brokers>_
  • How do I get started with ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#how-do-i-get-started-with-ib-insync>_
  • How to retrieve the current price of a stock using ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#how-to-retrieve-the-current-price-of-a-stock>_
  • How to retrieve market data for currencies, cryptos, and precious metals using ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#market-data-for-currencies-crypto-metals>_
  • How can I retrieve historical data from ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#how-to-get-historical-data-ib-insync>_
  • How can I fire an order through ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#how-to-fire-an-order-ib-insync>_
  • How to attach a take profit and stop loss to orders using ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#how-to-add-take-profit-and-stop-loss>_
  • How to fire an order for Mastercard when Visa hits a certain price using ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#how-to-fire-order-visa-mastercard>_
  • How to fire an order for Mastercard when Visa moves more than 5% in the last 5 minutes using ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#fire-order-percent-change-visa-mastercard>_
  • How can I buy call and put options using ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#how-to-buy-call-and-put-options>_
  • How to deploy a full trading strategy using ib_insync? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#how-to-deploy-a-full-trading-strategy-ib-insync>_
  • What is asynchronous programming and how does it differ from other programming methods? <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#what-is-asynchronous-programming>_
  • Download the full codebase <https://algotrading101.com/learn/ib_insync-interactive-brokers-api-guide/#download-full-codebase>_

Requirements

  • python <https://www.python.org>_ >= 2.7, 3.4+
  • pandas <https://github.com/pandas-dev/pandas>_ (tested to work with >= 1.0.3 )
  • ib_insync <https://github.com/erdewit/ib_insync>_ (tested to work with >= 0.9.59 )

Author Info

:author: Jignesh Davda :author page: https://algotrading101.com/learn/author/jdavda/ :published: 2021-01-01