joshuaulrich / IBrokers

R API to Interactive Brokers Trader Workstation
65 stars 54 forks source link

reqAccountUpdate #31

Closed PJAntico closed 2 years ago

PJAntico commented 2 years ago

Description

reqAccountUpdates throwing error message and / or warnings. Warning is "In eWrapper$updatePortfolio(curMsg, msg, timestamp, file, ... : NAs introduced by coercion"

Expected behavior

No warnings / errors - clean runs for years

Minimal, reproducible example

reqAccountUpdates(tws,acct="u***")

For some reason, Account[[2]][[1]]$portfolioValue$position (for example, or any index) is NA, and the values in the other six fields (marketPrice, marketValue, averageCost,unrealizedPNL, realizedPNL, accountName) are all "shifted down" by one, so for example, the "Position" field shows NA, but the next field ("marketPrice") shows the Position. The same goes for the third field ("marketValue"), which actually shows the number that should be next to "marketPrice" above it.

Session Info

Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C                           LC_TIME=English_United States.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] dplyr_1.0.8      DBI_1.1.2        odbc_1.3.3       readr_2.1.2      aws.s3_0.3.21    RQuantLib_0.4.15 lubridate_1.8.0  jsonlite_1.8.0  
 [9] quantmod_0.4.18  TTR_0.24.3       openxlsx_4.2.5   IBrokers_0.10-1  xts_0.12.1       zoo_1.8-10      

loaded via a namespace (and not attached):
 [1] zip_2.2.0           Rcpp_1.0.8.3        pillar_1.7.0        compiler_4.2.0      base64enc_0.1-3     iterators_1.0.14    tools_4.2.0        
 [8] digest_0.6.29       bit_4.0.4           lifecycle_1.0.1     tibble_3.1.6        lattice_0.20-45     pkgconfig_2.0.3     rlang_1.0.2        
[15] foreach_1.5.2       cli_3.3.0           curl_4.3.2          xml2_1.3.3          httr_1.4.2          generics_0.1.2      vctrs_0.4.1        
[22] hms_1.1.1           bit64_4.0.5         grid_4.2.0          tidyselect_1.1.2    glue_1.6.2          R6_2.5.1            fansi_1.0.3        
[29] tzdb_0.3.0          purrr_0.3.4         blob_1.2.3          magrittr_2.0.3      codetools_0.2-18    ellipsis_0.3.2      assertthat_0.2.1   
[36] aws.signature_0.6.0 utf8_1.2.2          stringi_1.7.6       crayon_1.5.1       

Apologies in advance if this is not the correct format. This is the first GitHub issue I've submitted, but I've been using this excellent package for years and rely on it heavily so wanted to see if there was a new release possibly on the TWS side, or even the iBrokers package side, that might be causing this sudden behavior.

If this is an inappropriate forum to bring up this issue, please let me know and I will remove / repost / re-ask elsewhere.

fmair commented 2 years ago

see https://github.com/joshuaulrich/IBrokers/issues/30

joshuaulrich commented 2 years ago

Thanks for this report @PJAntico! I'm going to close it as a duplicate of 30, since it was reported first.