Trouble with pulling Option Data IBrokers





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have been pulling option data from Interactive brokers for the past 2 months. Since the new year when I go to pull option data, I get this message "Error in tmp[[id]] : subscript out of bounds"



Here is the code.



 tws = twsConnect(port = 7498)
isConnected(tws)

snapShot <- function (twsCon, eWrapper, timestamp, file, playback = 1, ...)
{
if (missing(eWrapper))
eWrapper <- eWrapper()
names(eWrapper$.Data$data) <- eWrapper$.Data$symbols
con <- twsCon[[1]]
if (inherits(twsCon, "twsPlayback")) {
sys.time <- NULL
while (TRUE) {
if (!is.null(timestamp)) {
last.time <- sys.time
sys.time <- as.POSIXct(strptime(paste(readBin(con,
character(), 2),
collapse = " "), timestamp))
if (!is.null(last.time)) {
Sys.sleep((sys.time - last.time) * playback)
}
curMsg <- .Internal(readBin(con, "character",
1L, NA_integer_, TRUE, FALSE))
if (length(curMsg) < 1)
next
processMsg(curMsg, con, eWrapper, format(sys.time,
timestamp), file, ...)
}
else {
curMsg <- readBin(con, character(), 1)
if (length(curMsg) < 1)
next
processMsg(curMsg, con, eWrapper, timestamp,
file, ...)
if (curMsg == .twsIncomingMSG$REAL_TIME_BARS)
Sys.sleep(5 * playback)
}
}
}
else {
while (TRUE) {
socketSelect(list(con), FALSE, NULL)
curMsg <- .Internal(readBin(con, "character", 1L,
NA_integer_, TRUE, FALSE))
if (!is.null(timestamp)) {
processMsg(curMsg, con, eWrapper, format(Sys.time(),
timestamp), file, ...)
}
else {
processMsg(curMsg, con, eWrapper, timestamp,
file, ...)
}
if (!any(sapply(eWrapper$.Data$data, is.na)))
return(do.call(rbind, lapply(eWrapper$.Data$data,
as.data.frame)))
}
}
}

opt_put = twsOption("", expiry ="20190125", symbol = "AAPL", right = 'P',
strike = "148")

reqMktData(tws, Contract = opt_put, eventWrapper = eWrapper.data(1),
CALLBACK = snapShot)
# Error in `*tmp*`[[id]] : subscript out of bounds


The API team at interactive brokers could not help and had no experience with R. Thanks in advance guys. I would also like to mention, I have no problem pulling equity data










share|improve this question





























    1















    I have been pulling option data from Interactive brokers for the past 2 months. Since the new year when I go to pull option data, I get this message "Error in tmp[[id]] : subscript out of bounds"



    Here is the code.



     tws = twsConnect(port = 7498)
    isConnected(tws)

    snapShot <- function (twsCon, eWrapper, timestamp, file, playback = 1, ...)
    {
    if (missing(eWrapper))
    eWrapper <- eWrapper()
    names(eWrapper$.Data$data) <- eWrapper$.Data$symbols
    con <- twsCon[[1]]
    if (inherits(twsCon, "twsPlayback")) {
    sys.time <- NULL
    while (TRUE) {
    if (!is.null(timestamp)) {
    last.time <- sys.time
    sys.time <- as.POSIXct(strptime(paste(readBin(con,
    character(), 2),
    collapse = " "), timestamp))
    if (!is.null(last.time)) {
    Sys.sleep((sys.time - last.time) * playback)
    }
    curMsg <- .Internal(readBin(con, "character",
    1L, NA_integer_, TRUE, FALSE))
    if (length(curMsg) < 1)
    next
    processMsg(curMsg, con, eWrapper, format(sys.time,
    timestamp), file, ...)
    }
    else {
    curMsg <- readBin(con, character(), 1)
    if (length(curMsg) < 1)
    next
    processMsg(curMsg, con, eWrapper, timestamp,
    file, ...)
    if (curMsg == .twsIncomingMSG$REAL_TIME_BARS)
    Sys.sleep(5 * playback)
    }
    }
    }
    else {
    while (TRUE) {
    socketSelect(list(con), FALSE, NULL)
    curMsg <- .Internal(readBin(con, "character", 1L,
    NA_integer_, TRUE, FALSE))
    if (!is.null(timestamp)) {
    processMsg(curMsg, con, eWrapper, format(Sys.time(),
    timestamp), file, ...)
    }
    else {
    processMsg(curMsg, con, eWrapper, timestamp,
    file, ...)
    }
    if (!any(sapply(eWrapper$.Data$data, is.na)))
    return(do.call(rbind, lapply(eWrapper$.Data$data,
    as.data.frame)))
    }
    }
    }

    opt_put = twsOption("", expiry ="20190125", symbol = "AAPL", right = 'P',
    strike = "148")

    reqMktData(tws, Contract = opt_put, eventWrapper = eWrapper.data(1),
    CALLBACK = snapShot)
    # Error in `*tmp*`[[id]] : subscript out of bounds


    The API team at interactive brokers could not help and had no experience with R. Thanks in advance guys. I would also like to mention, I have no problem pulling equity data










    share|improve this question

























      1












      1








      1








      I have been pulling option data from Interactive brokers for the past 2 months. Since the new year when I go to pull option data, I get this message "Error in tmp[[id]] : subscript out of bounds"



      Here is the code.



       tws = twsConnect(port = 7498)
      isConnected(tws)

      snapShot <- function (twsCon, eWrapper, timestamp, file, playback = 1, ...)
      {
      if (missing(eWrapper))
      eWrapper <- eWrapper()
      names(eWrapper$.Data$data) <- eWrapper$.Data$symbols
      con <- twsCon[[1]]
      if (inherits(twsCon, "twsPlayback")) {
      sys.time <- NULL
      while (TRUE) {
      if (!is.null(timestamp)) {
      last.time <- sys.time
      sys.time <- as.POSIXct(strptime(paste(readBin(con,
      character(), 2),
      collapse = " "), timestamp))
      if (!is.null(last.time)) {
      Sys.sleep((sys.time - last.time) * playback)
      }
      curMsg <- .Internal(readBin(con, "character",
      1L, NA_integer_, TRUE, FALSE))
      if (length(curMsg) < 1)
      next
      processMsg(curMsg, con, eWrapper, format(sys.time,
      timestamp), file, ...)
      }
      else {
      curMsg <- readBin(con, character(), 1)
      if (length(curMsg) < 1)
      next
      processMsg(curMsg, con, eWrapper, timestamp,
      file, ...)
      if (curMsg == .twsIncomingMSG$REAL_TIME_BARS)
      Sys.sleep(5 * playback)
      }
      }
      }
      else {
      while (TRUE) {
      socketSelect(list(con), FALSE, NULL)
      curMsg <- .Internal(readBin(con, "character", 1L,
      NA_integer_, TRUE, FALSE))
      if (!is.null(timestamp)) {
      processMsg(curMsg, con, eWrapper, format(Sys.time(),
      timestamp), file, ...)
      }
      else {
      processMsg(curMsg, con, eWrapper, timestamp,
      file, ...)
      }
      if (!any(sapply(eWrapper$.Data$data, is.na)))
      return(do.call(rbind, lapply(eWrapper$.Data$data,
      as.data.frame)))
      }
      }
      }

      opt_put = twsOption("", expiry ="20190125", symbol = "AAPL", right = 'P',
      strike = "148")

      reqMktData(tws, Contract = opt_put, eventWrapper = eWrapper.data(1),
      CALLBACK = snapShot)
      # Error in `*tmp*`[[id]] : subscript out of bounds


      The API team at interactive brokers could not help and had no experience with R. Thanks in advance guys. I would also like to mention, I have no problem pulling equity data










      share|improve this question














      I have been pulling option data from Interactive brokers for the past 2 months. Since the new year when I go to pull option data, I get this message "Error in tmp[[id]] : subscript out of bounds"



      Here is the code.



       tws = twsConnect(port = 7498)
      isConnected(tws)

      snapShot <- function (twsCon, eWrapper, timestamp, file, playback = 1, ...)
      {
      if (missing(eWrapper))
      eWrapper <- eWrapper()
      names(eWrapper$.Data$data) <- eWrapper$.Data$symbols
      con <- twsCon[[1]]
      if (inherits(twsCon, "twsPlayback")) {
      sys.time <- NULL
      while (TRUE) {
      if (!is.null(timestamp)) {
      last.time <- sys.time
      sys.time <- as.POSIXct(strptime(paste(readBin(con,
      character(), 2),
      collapse = " "), timestamp))
      if (!is.null(last.time)) {
      Sys.sleep((sys.time - last.time) * playback)
      }
      curMsg <- .Internal(readBin(con, "character",
      1L, NA_integer_, TRUE, FALSE))
      if (length(curMsg) < 1)
      next
      processMsg(curMsg, con, eWrapper, format(sys.time,
      timestamp), file, ...)
      }
      else {
      curMsg <- readBin(con, character(), 1)
      if (length(curMsg) < 1)
      next
      processMsg(curMsg, con, eWrapper, timestamp,
      file, ...)
      if (curMsg == .twsIncomingMSG$REAL_TIME_BARS)
      Sys.sleep(5 * playback)
      }
      }
      }
      else {
      while (TRUE) {
      socketSelect(list(con), FALSE, NULL)
      curMsg <- .Internal(readBin(con, "character", 1L,
      NA_integer_, TRUE, FALSE))
      if (!is.null(timestamp)) {
      processMsg(curMsg, con, eWrapper, format(Sys.time(),
      timestamp), file, ...)
      }
      else {
      processMsg(curMsg, con, eWrapper, timestamp,
      file, ...)
      }
      if (!any(sapply(eWrapper$.Data$data, is.na)))
      return(do.call(rbind, lapply(eWrapper$.Data$data,
      as.data.frame)))
      }
      }
      }

      opt_put = twsOption("", expiry ="20190125", symbol = "AAPL", right = 'P',
      strike = "148")

      reqMktData(tws, Contract = opt_put, eventWrapper = eWrapper.data(1),
      CALLBACK = snapShot)
      # Error in `*tmp*`[[id]] : subscript out of bounds


      The API team at interactive brokers could not help and had no experience with R. Thanks in advance guys. I would also like to mention, I have no problem pulling equity data







      r quantmod ibrokers






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 4 at 18:53









      Jordan WrongJordan Wrong

      1778




      1778
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54044527%2ftrouble-with-pulling-option-data-ibrokers%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54044527%2ftrouble-with-pulling-option-data-ibrokers%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          generate and download xml file after input submit (php and mysql) - JPK

          Angular Downloading a file using contenturl with Basic Authentication

          Can't read property showImagePicker of undefined in react native iOS