jmfernandes / robin_stocks

This is a library to use with Robinhood Financial App. It currently supports trading crypto-currencies, options, and stocks. In addition, it can be used to get real time ticker information, assess the performance of your portfolio, and can also get tax documents, total dividends paid, and more. More info at
http://www.robin-stocks.com
MIT License
1.71k stars 463 forks source link

timeInForce issue for crypto limit order #289

Open KodaSong opened 3 years ago

KodaSong commented 3 years ago

I have an issue for the function

r.order_buy_crypto_limit(symbol=symbol, quantity=quantity,
                         limitPrice=buy_price, timeInForce='gfd')

It seems like the argument "timeInForce" for crypto order can only be gtc, or good until cancel, but cannot set as gfd, or good for day.

Also, if I set as gtc, the order will be cancelled in 10 minutes if not filled and will stop my program. I'd like to let the program run in the whole night, how do I fix this issue?

nbr23 commented 3 years ago

@KodaSong yes, cryptocurrencies only supports gtc, similarly to what we get on the web UI (which makes sense as there is not really a "trading hours" or "trading day" concept for cryptocurrencies).

Can you give more information on the gtc being cancelled after 10min? Maybe some info about the order? Do you see any information in the web UI about why the order was cancelled?

KodaSong commented 3 years ago

@KodaSong yes, cryptocurrencies only supports gtc, similarly to what we get on the web UI (which makes sense as there is not really a "trading hours" or "trading day" concept for cryptocurrencies).

Can you give more information on the gtc being cancelled after 10min? Maybe some info about the order? Do you see any information in the web UI about why the order was cancelled?

Not pretty sure about why this happens. At first I planned to place some limit orders during night so that I could get some good price. But after some time, the order is not filled and the program just throws an error and stops. Then I tested twice, which I place an impossible sell price. After 10 minutes, errors happens again. Then I just gave up.

nbr23 commented 3 years ago

Then I tested twice, which I place an impossible sell price.

I believe Robinhood will cancel the order if you try to place a limit buy/sell with a limit too far from the current price. That might be what happened to you here.

KodaSong commented 3 years ago

Then I tested twice, which I place an impossible sell price.

I believe Robinhood will cancel the order if you try to place a limit buy/sell with a limit too far from the current price. That might be what happened to you here.

Nonono, not this. Actually at first I just placed a sell limit order with the price at best ask. Same result.

nbr23 commented 3 years ago

The following worked for me for example. The order was placed and shows as confirmed. It was not executed (yet) as DOGE is far from 0.2USD. I placed it several hours ago and it has not cancelled.

rh.order_buy_crypto_limit(symbol='DOGE', quantity=1,
                         limitPrice='0.2', timeInForce='gtc')

Maybe share the ticker, and limitprice you are using?