Hi, So in starting to work on some code, I've quickly discovered the need to record and playback a trading day. Since I often code when the market is closed, I need to be able to playback a stream of trading data. I do see how twsConnect() will take a filename, but I don't understand to how properly record the data. I did try to save things to a file following an example in the docs, but then am unable read them back: tws <- twsConnect(clientId = 1) f <- file.choose() fh <- file(f, open='a') reqMktData(tws, contract, file=fh) # At this point, I do see a file with a bunch of transaction data on my hard drive Then, attempting to playback the data: twsPlay <- twsConnect(clientId=2, filename=f) reqMktData(twsPlay, contract, playback=1) This gives me the following error: Error in socketSelect(list(con), FALSE, 0.25) : not a socket connection My goal is to have a short cron script call R in the morning with a script so that I can record the day's transactions to a file. Doing this for a few days will give me a nice working set of data to use doing development. What am I doing wrong? -- Noah Silverman UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095
IBrokers - record and playback
1 message · Noah Silverman