Closed emoro closed 3 years ago
@emoro are you on the most recent package version?
Yes. 1.6. Here is my session info
R version 3.5.2 (2018-12-20)
Platform: arm-unknown-linux-gnueabihf (32-bit)
Running under: Raspbian GNU/Linux 10 (buster)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RobinHood_1.6
loaded via a namespace (and not attached):
[1] httr_1.4.2 compiler_3.5.2 magrittr_2.0.1 R6_2.5.0
[5] generics_0.1.0 tools_3.5.2 Rcpp_1.0.6 lubridate_1.7.10
[9] jsonlite_1.7.2
Here is the call to get my crypto without options(stringsAsFactors=FALSE)
> get_positions_crypto(RH)
symbol name quantity market_value mark_price cost_bases gain_loss
1 BTC Bitcoin 1 54946.99 54946.99 10 54936.99
and here is it with options(stringsAsFactors=FALSE)
> get_positions_crypto(RH)
symbol name quantity market_value mark_price cost_bases gain_loss
1 BTC Bitcoin 0.00020641 11.34 54931.71 10 1.34
Thanks, ill incorporate this
Thanks for this amazing library!!!
I run into an issue when calling the function
get_positions_crypto
. For old versions of R (3.5), the function gives back values of crypto currencies in units of 1. Yes, I wish I had a unit of Bitcoin :)Anyway, I traced back the error to this part of the code in the
api_positions_crypto.R
quantity
is a string from the API and indta_qty
is transformed into a factor. After that it is transformed into numeric and there you have the "1".The problem is obviously the "stringsAsFactors=FALSE". In the newer versions of R (>4.0) this is by default, but in older versions, this might be an issue.
I solve it by calling
options(stringsAsFactors=FALSE)
before my code, but maybe there is a way to implement this in the library by default.Thanks for your work