Questions tagged [ibrokers]

`IBrokers` is an R package that provides a native `R` interface to Interactive Brokers Trader Workstation trading platform.

IBrokers is an R package that provides a native R interface to Interactive Brokers Trader Workstation trading platform.

75 questions
6
votes
1 answer

Multiple Quantities in Bracket Orders Using IBrokers in R

I am working with the ibrokers package in R and am trying to set multiple closing prices for a trade. For example, buy 100 shares of AAPL at $106, sell 50 at $107 and 50 at $108, with a stop price of $105. When I send the multiple profit taking…
mks212
  • 901
  • 1
  • 18
  • 40
6
votes
1 answer

reqExecutions IBrokers package

Will it be possible for someone to provide me a working example of reqExecutions? I am having a hard time with the ewrapper and callback mechanism. After searching google for working examples, I could not get my hands on anything that would simply…
aajkaltak
  • 1,437
  • 4
  • 20
  • 28
6
votes
1 answer

Version number of the specific request, IBrokers package for Interactive Brokers

I am trying to understand the IBrokers package, and when reading its Real Time vignettes, at the end of section 2.4.1, the author of the package, Jeffrey A. Ryan, wrote: [...] to request the current time from the TWS, one needs to send the code for…
user2329215
5
votes
1 answer

IBrokers request Historical Futures Contract Data?

I tried to request historical futures data but for a beginner the ibrokers.pdf document is not well enough documented. example Gold Miny Contract Dec11…
Joe Joeansjen
  • 75
  • 1
  • 2
  • 6
5
votes
2 answers

R Ibrokers twsOPT usage

reqMktData(tws,twsOPT("AAPL 110820C00390000")) or reqMktData(tws,twsOPT("AAPL110820C00390000")) result in: TWS Message: 2 1 200 No security definition has been found for the request Why? reqMktData(tws,twsSTK("AAPL")) works fine. The manpage…
Pauly
  • 101
  • 7
5
votes
1 answer

IBrokers enabling Delayed market data?

I'm trying to download data from IBrokers but currently getting an error. I'm not sure how to solve it. Note: I don't have a subscription to live quotes but I do get delayed market data. My steps are: security =…
user2946746
  • 1,740
  • 3
  • 21
  • 36
5
votes
1 answer

IBrokers Historical Index Data

How do I get historical data of an INDEX into R from Interactive Brokers? If it were futures, I would use this command (as suggested here IBrokers request Historical Futures Contract Data?): library(twsInstrument) a <- reqHistoricalData(tws,…
mchangun
  • 9,814
  • 18
  • 71
  • 101
5
votes
1 answer

IBrokers reqMktData, how to add timeout to the callback function?

I have been using a modified snapShot function from the great IBrokers package to get "Last" prices from IB and it has been working great for liquid stocks. The call I make is eg. reqMktData(tws, twsSTK("AAPL"),…
nikke
  • 111
  • 8
5
votes
2 answers

Error Getting the EUR.USD Historical data using R on Ibrokers

I am using the IBrokers package and twsInstrument and for some reason it gives me an error using the simplest of methods. require("IBrokers") require("twsInstrument") tws <- ConnectIB() past.data<-reqHistoricalData(tws,getContract("EUR.USD")) gives…
Kyle Balkissoon
  • 348
  • 1
  • 3
  • 13
4
votes
1 answer

Querying trades from IB using reqExecutions

Im trying to query trades from IB by using function reqExecutions: library(IBrokers) con <- twsConnect(clientId=1) id <- reqIds(con) Order <- twsOrder(orderId=id, action="BUY", totalQuantity = 1, orderType="LMT", lmtPrice = 600, tif="GTC")…
SilverSpoon
  • 655
  • 4
  • 8
  • 17
4
votes
1 answer

How to download historical data with twsInstrument using getContract?

When downloading data from interactive brokers some future contracts can be downloaded properly others not. R console command: icegasoil_feb <- getContract("GOILG2") Connected with clientId 100. Error in buildIBcontract(symbol = instrument, tws =…
4
votes
1 answer

Problems using IBrokers package

I was trying to use IBrokers package with the simplest code like below: library(IBrokers) tws <- twsConnect() aapl.csv <- file("AAPL.csv", open="wa") # run an infinite-loop ( to break ) reqMktData(tws, twsSTK("AAPL"), …
user947967
  • 99
  • 5
4
votes
0 answers

IBrokers - reqMktData extremely slow when adding more tickers

I am trying to snap prices in R using the interactive brokers API for the latest price for a list of stocks (around 150). When I snap them for 2 stocks, it's almost instantaneous: tickers<- c("YHOO","AAPL") library("IBrokers") …
Trexion Kameha
  • 3,362
  • 10
  • 34
  • 60
3
votes
1 answer

IBrokers - How I send 100000 to IBrokers:::.placeOrder?

I'm using IBrokers to open orders for AUD-USD on IDEALPRO Here is syntax which works well for me to SELL 90,000: # myscript.r .libPaths("rpackages") library(IBrokers) myconid = 3 twsobj = twsConnect(myconid) myaud =…
user3676943
  • 913
  • 1
  • 13
  • 27
3
votes
3 answers

IBrokers - reqMktData results in error saying ticker is "ambiguous"

I'm trying to snap real time market data using IBrokers API on R. For an odd reason, Microsoft (MSFT) doesn't work. For example, this works: library("IBrokers") tws <- twsConnect() nms <- c("AAPL","YHOO") reqMktData(tws, lapply(nms, twsSTK),…
Trexion Kameha
  • 3,362
  • 10
  • 34
  • 60
1
2 3 4 5