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.74k stars 468 forks source link

Getting account balance? #318

Open Chaneriel opened 3 years ago

Chaneriel commented 3 years ago

Sorry to have to drop this here but how do I check the balance of a given stock. Like for example, I am buying $10 worth of ETC right now to test. If I want to sell all of that, I was going to run a command to get my balance of ETC, and then sell that amount. Because selling $10 worth wont work because it wont stay $10. So that would cause it to either fail because that's more than I own, or not sell all of it. So is there a command to see what my balance of a given stock is

lglista commented 3 years ago

Instead of selling by price, you want to sell by quantity using orders.order_sell_crypto_by_quantity()
you can use account.build_holdings() to get your owned stocks and cryptos.

Take a look at the docs at https://robin-stocks.readthedocs.io/en/latest/robinhood.html