Questions tagged [interactive-brokers]

A popular electronic trading platform, supporting API through Java, C++, C#, VB, Python 3, and Excel.

A popular electronic trading platform, supporting API through Java, C++, C#, VB, Python 3, and Excel. Unofficial implementations include ibrokers for R and ibpy for Python 2.

Useful links

426 questions
4
votes
1 answer

How do I change the time zone in interactive brokers?

I am using the Interactive Brokers API, TWS release 974, with IBC and the ib_insync library. I would like to change the time zone inside one of these, in order to get market data and history according to the America/New_York time zone. I have…
Yuval F
  • 20,565
  • 5
  • 44
  • 69
4
votes
2 answers

Getting Error in Interactive Broker while connectiong through API 'error id=-1, errorCode=2104, errorMsg=Market data farm connection is OK:hfarm

I keep getting the below errors while testing the below code. I've a paper trading account with IB. Not sure what exactly these errors are. Tried searching online but could not get any hint. from ib.opt import Connection, message from…
Joe
  • 61
  • 2
  • 7
4
votes
3 answers

Python Interactive brokers IB API very very slow

I am trying out the new Python Interactive Broker API, but I am experiencing some serious speed issues at the very first step... The following code (see below) times 0:00:08.832813 until the data is done being received 0:00:36.000785 until the app…
jim jarnac
  • 4,804
  • 11
  • 51
  • 88
4
votes
2 answers

Interactive Brokers - Obtain Historical Data of OPT (MIDPOINT and TRADES)

I am trying to obtain both the underlying and options written on SPY via the Interactive Brokers API, and while obtaining current options (with strike, right etc.) is not a problem, I am stuck with obtaining historical data say from 5 months back to…
Chester
  • 43
  • 1
  • 3
3
votes
0 answers

Interactive Brokers - I keep getting invalid consumer while requesting OAuth token

I have a valid consumer key and I'm unable to get Interactive Brokers Web API OAuth to work. {"error":"id: 3931, error: invalid consumer","statusCode":401} The endpoint I'm trying to get to work:…
Hulkstance
  • 1,323
  • 9
  • 15
3
votes
2 answers

Interactive Brokers: Unable to fetch Forex Historical data

I am trying IB very the first time. I am trying to fetch historical data of $EUR but I am getting an error: Error 162, reqId 3: Historical Market Data Service error message:No historical market data for EUR/CASH@FXSUBPIP Last 1800,…
Volatil3
  • 14,253
  • 38
  • 134
  • 263
3
votes
1 answer

What does += mean in the context of event handling?

In Scanner data (streaming) I can find the following statement (you can find below the full code): scanData.updateEvent += onScanData What does the += mean? So, I understand that onScanData() is the event handler function that should be called when…
user312087
  • 45
  • 3
3
votes
2 answers

interactive brokers api python - fire order during "pre market"

I'm using the IB API in order to automatically fire orders during pre-market time. I am unable to figure out why the order is waiting for the market opening time instead of buying during the pre-market period. After looking at the API documentation…
3
votes
1 answer

How can I detect when an order fills using the Interactive Brokers Java API?

Problem The IBKR TWS (Trader Workstation) is a tool for managing stock orders in the stock market, by Interactive Brokers. They provide an API to automate orders, like placing orders, cancelling orders, and more. I'm creating a program to handle…
Joseph Balnt
  • 130
  • 9
3
votes
0 answers

IB TWS API has a SocketException when calling eDisconnect() on the EClientSocket which occurs at java.io.DataInputStream.readInt(EClientSocket)

To use the Interactive Brokers (IB) TWS API, I need to write a class that implements EWrapper. I am having trouble properly disconnecting my socket in that class, even when using the built-in eDisconnect() method provided by IB. Whenever I write a…
3
votes
1 answer

Unable to connect python with TWS using ibapi

This is my code: from threading import Timer from ibapi.client import EClient from ibapi.wrapper import EWrapper from ibapi.contract import Contract from ibapi.order import * class TestApp(EWrapper, EClient): def __init__(self): …
ComputerBoi
  • 37
  • 1
  • 1
  • 7
3
votes
2 answers

Interactive Brokers is this error? 10197 "No market data during competing live session"

I'm trying to get the price for stock option for the Japan "6503" stock, and I get the error: Error code 10197 No market data during competing live session I don't have subscription for Japan Market, but I still can see the "last price" for the…
Alex Craft
  • 13,598
  • 11
  • 69
  • 133
3
votes
2 answers

Why the same classes are inherited with different __init__ code? Interactive Brokers API

I am trying to learn about this API and there is a detail that is confusing me a lot. I am not used to work with classes and interfaces and I don't understand one detail. In this API there are two classes that are very important: EClient and…
3
votes
1 answer

Interactive Brokers API (IBAPI) - Using threading.Timer object to auto exit when the data connection is broken

I have been trying to implement a mechanism that request live data (such as reqRealTimeBars) and automatically make the script to exit in case the data connection is broken. I have been making test with the threading.Timer object…
jim jarnac
  • 4,804
  • 11
  • 51
  • 88
3
votes
2 answers

Storing API Data Into A DataFrame

I am running a Python Script to collect financial market data from Interactive Brokers API. After connecting to the API the terminal prints out requested historical data. How do I have the data saved into a dataframe rather than streamed in…
1 2
3
28 29