Skip to content
All library documents

Python Interfaces for Automated Stock Trading

Article Quant Q&A · Author: Victor

Summary

The document collects responses to a trader seeking a Python interface for automating non-high-frequency stock strategies. The trader already has an Interactive Brokers account and asks whether another broker offers a better supported API than unofficial wrappers around the broker’s Java interface. The answers point to several different routes: using Interactive Brokers’ FIX gateway through a Python library, using TradeStation’s WebAPI, or running Python algorithms on Quantopian and connecting live trading to Interactive Brokers.

These replies illustrate that Python access may come through a broker API, a protocol gateway, or a hosted research and trading platform. They do not provide implementation details, feature comparisons, or evidence about reliability, costs beyond noting that the FIX gateway has additional cost, or current availability. The recommendations reflect the period and context of the original discussion, so platform and API status should be checked before relying on them. The main practical lesson is to distinguish official broker support from third-party libraries and platform-mediated workflows.

Key ideas

  • The question concerns automating strategies written in Python through a stock broker.
  • One response suggests accessing Interactive Brokers through FIX with a Python-capable library, while noting extra cost.
  • Other answers cite a broker WebAPI and a hosted Python platform linked to Interactive Brokers for live trading.
  • The responses do not compare capabilities or establish whether the named services remain available or supported today.

Tags

Full text
# Which brokers offer a Python stock trading API?


# Which brokers offer a Python stock trading API?












I would like to automate my trading strategies.

My strategies are not high-frequency and are written in Python.

I have a trading account in Interactive Brokers, and I know some non-official Python libraries (such as ibPy and swigPy) that are an interface to the Java API and are not officially supported.

Is there another broker that has a better stock trading API for Python?

Inspired by Which brokers offer a .NET stock trading API?.

## Answer by Louis Marascio (score 2, accepted)

https://quant.stackexchange.com/a/7241

I know of no broker that provides an official, supported Python API. If you are at Interactive Brokers you can consider using their FIX gateway, but that comes with additional cost. QuickFix provides a Python API.

## Answer by John Jelinek (score 3)

https://quant.stackexchange.com/a/8009

TradeStation offers python support via their WebAPI. Check it out here: http://tradestation.github.io/webapi-docs/

## Answer by Dan Dunn (score 1)

https://quant.stackexchange.com/a/8033

Check out Quantopian. It's all in Python. You can backtest and paper trade your algo for free. We do live trading by hooking your algorithm to your Interactive Brokers account.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.