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
1
vote
1 answer

Execution History in IBrokers

I would like to get historical execution data for the past n days (up to 60 days) through IBrokers package in R. Is this even possible via reqExecutions()? I have seen some examples, such as that posted at RMetrics. Sorry to cross-list in a…
jd8585
  • 187
  • 1
  • 8
1
vote
0 answers

How to get the last 60 seconds bar values of realtime data with IBrokers?

I am trying to use R package IBrokers to get data on different symbols. When I initially did my tests the following line worked as expected reqHistoricalData(tws, Contract=contract, barSize='1 min', duration='60 S') But I found out it only works…
JordanBelf
  • 3,208
  • 9
  • 47
  • 80
1
vote
1 answer

Saving timestamp on IBrokers package

I am having some issues accessing the timestamp data in the IBrokers package. Here is an example of the data I get: AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.WAP AAPL.hasGaps AAPL.Count 2015-01-09 17:59:00 …
JordanBelf
  • 3,208
  • 9
  • 47
  • 80
1
vote
1 answer

IBrokers - Download all position information

I am using the IBrokers API in R to try to download my current positions in my portfolio on Interactive Brokers. However, I'm having trouble downloading the information by following the API documentation. I can get this far with the following. …
Trexion Kameha
  • 3,362
  • 10
  • 34
  • 60
1
vote
1 answer

Current Account Value using the IBrokers API for Interactive Brokers

I'm trying to get my account's total net liquidation amount. This is essentially the total amount in my portfolio of all positions, plus cash. However, the enclosed code is as close as I can get. I can then manually obtain it from the data…
Trexion Kameha
  • 3,362
  • 10
  • 34
  • 60
1
vote
0 answers

IBrokers: reqMktData specific field

Here's the very simple code, but you need Interactive Brokers' TWS to run it: opt <- twsOption(local = '', expiry = '20121019', strike = '146', right = 'C', symbol = 'SPY') reqMktData(tws, opt, verbose = FALSE) Running it, you'll…
Lisa Ann
  • 3,345
  • 6
  • 31
  • 42
1
vote
1 answer

How do i assign the reqOpenorder (from IBrokers package) results to a matrix?

The results from the reqOpenOrders are given below **reqOpenOrders(tws)** TWS Message: 2 3 399 Order Message: Warning: Your order size is below the EUR 20000 IdealPro minimum and will be routed as an…
0
votes
0 answers

Can no longer retrieve snapshot data from Ibrokers

This code used to work for many years but stopped working in early 2023: library(IBrokers) tws <- twsConnect() AUDUSD <- twsCurrency("AUD","USD") data <- reqMktData(tws,AUDUSD,snapshot=TRUE) Output: Error in reqMktData(tws, AUDUSD, snapshot = TRUE)…
Pwb83.
  • 1
0
votes
0 answers

Problem retrieving data from Interactive Brokers using R IBrokers package

I have trouble retrieving EURUSD and GBPUSD currency pairs historical data from IB. The code I use works fine with CHFUSD and USDJPY but with EURUSD and GBPUSD I get a pending execution "waiting for TWS reply on EUR ...." which never ends. I have…
0
votes
1 answer

Using IBrokers and R, what is the appropriate way to retrieve last traded price during live trading session?

So current I do it like this: contract <- lapply(sym, function(x) twsEquity(x, 'SMART','ISLAND')) lapply(contract, function(x) reqHistoricalData(tws, Contract=x, barSize = "1 day", duration = "1 D", verbose = FALSE)) sym is merely a vector of…
0
votes
2 answers

Cannot connect to TWS using IBrokers with R

The output of my code: library(IBrokers) tws <- twsConnect(port=7496) Error in socketConnection(host = host, port = port, open = "ab", blocking = blocking) : cannot open the connection In addition: Warning message: In socketConnection(host =…
0
votes
1 answer

How to trade multiple equities at once using Ibrokers in R

Using the Ibrokers account I know how to place a trade with one ticker which , in the example below I place a trade with "DAL" library(IBrokers) tws=twsConnect(clientId = 1,host = "localhost", port = 7497 ) contract=twsEquity(symbol = "DAL", exch =…
0
votes
1 answer

How do I get implied volatility from TWS into R using IBrokers?

Currently I have modified some code I found here to read in bid/ask prices for options in R. Then I feed those back to TWS using calculateImpliedVolatility to get implied volatility. It seems I should be able to get them without the second step…
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
1 answer

How to get the latest option prices on SPX using IBrokers in R

I'm trying to get SPX option put prices for a given strike (2700) and expiration (15/11/2018) using the following code: require("IBrokers") tws <- twsConnect() opt=twsOPT("",symbol="SPX",right="P", strike="2700",…