ibrokers

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

£可爱£侵袭症+ 提交于 2019-12-20 16:23:14
问题 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"), eventWrapper=eWrapper.data.Last(1),CALLBACK=snapShot) The problem arises when trying to retrieve very illiquid stocks or options. I would therefore need to add a timeout to the snapShot function. How and where could the timeout be added? The code with the snapShot function: library

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

半腔热情 提交于 2019-12-20 16:23:05
问题 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"), eventWrapper=eWrapper.data.Last(1),CALLBACK=snapShot) The problem arises when trying to retrieve very illiquid stocks or options. I would therefore need to add a timeout to the snapShot function. How and where could the timeout be added? The code with the snapShot function: library

IBrokers request Historical Futures Contract Data?

被刻印的时光 ゝ 提交于 2019-12-19 03:41:24
问题 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 NYSELIFFE: goldminy<-twsFuture("YG","NYSELIFFE","201112",multiplier="33.2") reqHistoricalData(conn, Contract= "goldminy", endDateTime"", barSize = "1 S", duration = "1 D", useRTH = "0", whatToShow = "TRADES","BID", "ASK", "BID_ASK", timeFormat = "1", tzone = "", verbose = TRUE, tickerId = "1", eventHistoricalData, file) I also don't know how

R IBrokers reqOpenOrders hangs

旧街凉风 提交于 2019-12-13 18:57:49
问题 Would anyone be able to advise how to use R IBrokers reqOpenOrders properly? > tws=twsConnect(clientId=66,host='localhost',port='7497') > reqOpenOrders(twsconn=tws) TWS Message: 2 -1 2104 Market data farm connection is OK:usopt TWS Message: 2 -1 2104 Market data farm connection is OK:usfarm TWS Message: 2 -1 2106 HMDS data farm connection is OK:ushmds TWS OrderStatus: orderId=565 status=PreSubmitted filled=0 remaining=1 averageFillPrice=0 TWS OrderStatus: orderId=566 status=PreSubmitted

IBrokers twsFOP call in R

别来无恙 提交于 2019-12-13 15:32:08
问题 I'm trying to get the following to pull some data from IB (Nasdaq 100 e-mini futures options data). I am using the snapShot callback (included below). Could someone tell me what is wrong with my code? require(IBrokers) tws <- twsConnect() test3<- twsFOP("NQ","GLOBEX",expiry="20141121",strike="4000",right="C") test4 <- reqMktData(tws, test3, eventWrapper=eWrapper.data(length(1)),CALLBACK=snapShot) Thanks a bunch. I've searched high and low online and found little documentation on twsFOP,

R IBrokers (Interactive Brokers API)

删除回忆录丶 提交于 2019-12-08 10:58:07
问题 Anyone has any idea how to use algoStrategy and algoParams in IBrokers package? I tried creating a list for algoParams but in vain. For example: library(IBrokers) twsOrder(reqIds(twsconn), "BUY", "10", "MKT", transmit = TRUE, algoStrategy = "VWAP", algoParams = list(maxPctVol = "0.2", startTime = "13:00:00 HKT", endTime = "13:30:00 HKT", allowPastEndTime = 0, noTakeLiq = 0, speedUp = 0, monetaryValue = "")) My orders turn out to be Market Orders. Thus, I assume my input into algoStrategy and

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

别来无恙 提交于 2019-12-06 04:24:47
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 = twsCurrency("AUD",currency="USD",exch="IDEALPRO",primary="",strike="0.0",right="",local="",multiplier="",include_expired="0",conId=myconid) Sys.sleep(2) myorderid = as.integer(reqIds(twsobj)) print(myorderid) Sys.sleep(2) myorderid = as.integer(difftime(Sys.time(), "2014-10-30", units = "secs")) Sys.sleep(2) IBrokers:::.placeOrder(twsobj, myaud, twsOrder(myorderid,"SELL", 90000,

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

Deadly 提交于 2019-12-03 04:37:52
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"), eventWrapper=eWrapper.data.Last(1),CALLBACK=snapShot) The problem arises when trying to retrieve very illiquid stocks or options. I would therefore need to add a timeout to the snapShot function. How and where could the timeout be added? The code with the snapShot function: library(IBrokers) tws <- twsConnect() eWrapper.data.Last <- function(n) { eW <- eWrapper(NULL) # use basic