JestonBlu / RobinHood

An R interface for the RobinHood.com no commision investing site
https://jestonblu.github.io/RobinHood/
GNU Lesser General Public License v3.0
45 stars 12 forks source link

What is the fix to the fractional shares function? #118

Closed willywonka0 closed 3 years ago

willywonka0 commented 3 years ago

Hey, I'm new to coding in R. I am interested in learning how to turn on the fractional shares function. You might already have a link to a new functioning template!

Thank you :)

JestonBlu commented 3 years ago

Fractional shares should be available for most stocks according to the RobinHood site. I recently made a change to allow fractional shares in the place_order function but i have not pushed to CRAN yet. Im hoping to do so in the next couple of days. You can download and install the developmental version oft this package using the README on the front page. That will enable fractional share trading for you in the meantime.

Let me know if you have any other questions.

willywonka0 commented 3 years ago

After the patch, I am receiving an error: check_rn. I am looking forward to seeing how you fix the problem in the code. Thank you, I cant wait to use the fractional shares function.

JestonBlu commented 3 years ago

@willywonka0 if you provide the output you are getting i can look at it, but im guessing you are referring to check_rh() which is an internal check to make sure you have an appropriate connection object to RH already established. Have you checked out the getting started guide?

willywonka0 commented 3 years ago

I am able to place a whole number share order with the place_order function. If I place a fractional share order in the place_order function it outputs "Error in place_order(RH = RH, symbol = "FB", type = "market", time_in_force = "gfd", : quantity must be > 0". If I place the fractional order under stock_order function it outputs "Error in check_rh(RH) : could not find function "check_rh"".

JestonBlu commented 3 years ago

what are you referring to about stock_order? That is not a function in my package. The check_rh function is not exported by default. In order to enable fractional sharing you need to install the developmental version of the package, not the CRAN version (at least for the next week till the new versions gets pushed to CRAN).

Also do you know how to use code blocks on here so i can better understand what you are trying to run? That will make it easier to investigate. You can just paste the complete function and output from the R console in the block.

I was able to play an order for a fractional share of GE today.

# Development version
install.packages("devtools")
devtools::install_github("jestonblu/RobinHood")

place_order(RH, type = "market", time_in_force = "gdf")

stock_order(...)
willywonka0 commented 3 years ago

I have the program running, thank you!

willywonka0 commented 3 years ago

Is there a way to have the program automatically run every 3 seconds or so?

JestonBlu commented 3 years ago

@willywonka0 this is outside of the scope of this package. Im really enabling you to do that on your own. Im playing with the idea of writing a companion package to this one that would assist with some automation rules execution, but its just on the drawing board right now. If you are brand new to R then I suggest learning the tidyverse way of coding. Its a very popular and modern set of packages for data science.