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
0
votes
0 answers

Trailing stop order of IBrokers in R

Here is a condition that I want place a TRAIL order with stop price is 43.41 and trailing Percent is 2%. I use IBrokers.zip of joshuaulrich from github. However, when I place TRAIL order with trailing Percent, the order is not contained with…
0
votes
0 answers

Interactive Brokers API - Javascript Option Price

Can anyone help me out with a simple Java script to call the last price of an option given the underlying stock symbol, expiration, strike price and exchange? I'm looking to ultimately create a custom Google Sheets function to do this if possible.
jbt777
  • 1
  • 2
0
votes
1 answer

How to request entry cost of a single position?

I want to receive the average cost of a single position. I am using the IB-insync API and using reqPositions(). The ouput is: [Position(account='DU1675421', contract=Stock(conId=29622888, symbol='HEIA', exchange='AEB', currency='EUR',…
0
votes
0 answers

Historical daily data for VIX futures using IB API

I am able to get historical data for just about any symbol, but for some reason, getting historical data for VIX futures doesn't work for me. This is the way I call the IB API. The symbol I use is VXU9: System.DateTime today =…
Ivan
  • 7,448
  • 14
  • 69
  • 134
0
votes
1 answer

Error : -1 2108 Market data connection inactive

Every evening I get error 2103 Market data connection is broken I then receive 2108 market data farm connection is inactive but should be available upon demand.cashfarm -followed by 2104 Market data connection OK problem is that it hangs my python…
0
votes
1 answer

realtime plot using PyQt5

I want to build a program where we get updated data from interactive brokers (a popular online broker) and I want to update a plot in a simple pyqt5 interface. The program sequence is the following: We start the Ui_MainWindow interface. If we click…
nunodsousa
  • 2,635
  • 4
  • 27
  • 49
0
votes
1 answer

I am unable to connect with two APIs for python

I would like to connect with the TWS API for python however when I tried there was an error saying unable to connect with TWS and that I need to make sure that the TWS port is open. I am unsure what they mean by this. This is some of my code: from…
user11344107
0
votes
1 answer

Place order with API IB

After deciding to walk away from Ibpy and learn the API IB I am having trouble even placing an order. What am I doing wrong? from ibapi.client import EClient from ibapi.wrapper import EWrapper from ibapi.contract import Contract from ibapi.order…
0
votes
2 answers

Interactive brokers API Client /Python setting LMT price as current price

Using Python and IB API how do you set lmt price to current market price. Below is an example where when you call make_order and you pass price with action and quantity. How to define price as MarketPrice? def make_order(action, quantity,price): …
0
votes
1 answer

How do I get the elements from list of tuples generated by ib.reqHistoricalData from API Interactive Brokers

Interactive Brokers API delivers for this request: spzValue = ib.reqHistoricalData(spx, endDateTime='', durationStr='7200 S', barSizeSetting='1 hour', whatToShow='TRADES', useRTH =False) the following output for the variable…
0
votes
1 answer

How to get my shares amount in ib_insync?

I have an Interactive Broker account and use ib_insync python package to work with IB API. I've bought some shares of one company via multiple transactions. How to get the total amount of shares of that company which I have? I need it to know how…
gunterdo
  • 1
  • 1
  • 1
0
votes
0 answers

Interactive Brokers API Data stream returns only NaN values

I have a class that establishes several market data streams and stores them in an array. Then another function within the same class accesses the array and requests data from the streams, but all the values are coming out as NaN. Here is an…
Artem Korol
  • 191
  • 1
  • 2
  • 11
0
votes
1 answer

couldn't get interactive broker historical data

I am working on IB Gateway and want to get the historical data. As i have completed the steps on IB Gateway software to enable the API. I am using python notebook for this. For now i am running this code and i am able to import the given library but…
0
votes
2 answers

Python run function, wait, terminate function,run next function

I am trying to download historical data from the IBAPI, and since I am not that savvy in coding I came up with the plan to write seperate files for each stock that I want data of, and let 1 main file run all those files. The problem is that I can…
Hoogoo
  • 15
  • 1
  • 8
0
votes
1 answer

Python multiple requests with single code

I am using the IB API to retrieve historical stock data, and I would like my code to run multiple times with different variables (different stocks and timeframes). Currently I am using the following code: from ibapi.client import EClient from…