DheerajAgarwal / rgdax

Wrapper for Coinbase pro (erstwhile GDAX) Cryptocurrency exchange
Other
33 stars 16 forks source link

add_order not working #3

Closed Simon99975 closed 6 years ago

Simon99975 commented 6 years ago

This package is great, thank you for sharing it! Please can you help? I keep getting "Error: Bad Request" when trying to do a market trade with the 'add_order' function. I think the authentication is working ok, because cancel_order works. Please could you give me an example that works for you to check I am using it right? Cheers Simon

DheerajAgarwal commented 6 years ago

@Simon99975 Thanks for pointing out the bug. I did not realize that enhancing add_order() to include stop orders broke everything else. I will be pushing a fix soon to a branch and you should be able to install it directly from there. Unfortunately, I am out of turns to push an update to CRAN so a package update will have to wait. I will post the details on how to get the fix from github once the fix is ready.

DheerajAgarwal commented 6 years ago

@Simon99975 The fix is now available on both github and bitbucket.

library(devtools)
install_github("DheerajAgarwal/rgdax", ref="dev")

or

library(devtools)
install_bitbucket("DheerajdrjAgarwal/rgdax", ref="dev")

Let me know if you still see any issues.

jcole75 commented 6 years ago

It seems to be working now. There is an issue with having a floating point number in the parameters with too many decimal places (for example in the size parameter). I get "Error: Bad Request" when this happens.

bradlindblad commented 6 years ago

I cannot get “add_order” to work now. When I manually type in a float like 100.23 in “size,” it works. But when I try to pass a variable with that value like x <- 100.23, it will not work

jcole75 commented 6 years ago

beavertrapper07 - it will work if you do round(x, digits=2). But this is not ideal.

DheerajAgarwal commented 6 years ago

I do not believe that is a defect per se. If you run df <- public_info() and look at the base_min_size, you will realize that the api expects a minimum precision for orders that varies with currency. If you are trading in USD, then only BTC goes to 3 decimals. LTC is just 1.

I also suggest looking at min_market_funds

jcole75 commented 6 years ago

Makes sense. It would probably be good to make note of this in the documentation or return a more informative error.

Thanks for this great library!

DheerajAgarwal commented 6 years ago

That is a great suggestion @jcole75. I will try and add this to documentation at least. My initial thought is that if try to provide a better user message, it will require me to override the api response and that may not be a good way to manage future exceptions. None the less, point noted and I will try and figure out a way.

Also, thanks to you and @beavertrapper07 I know that the function is working, so closing this original issue.