bcwik9 / robinhood-on-rails

A web dashboard for the free trading platform Robinhood using Ruby on Rails and a private API
MIT License
151 stars 53 forks source link

Buying power remains $0.00 #31

Closed kyleboddy closed 7 years ago

kyleboddy commented 7 years ago

Buying power seems to constantly read $0.00 regardless of cash available or deposits. This happens with an account with no Robinhood gold.

image

kyleboddy commented 7 years ago

(The official iOS app has the correct buying power, BTW)

bcwik9 commented 7 years ago

@kyleboddy do you have pending orders that haven't been executed yet?

kyleboddy commented 7 years ago

No pending orders:

image

I do have pending deposits, however, but they are and were available for purchasing equities right away.

kyleboddy commented 7 years ago

@bcwik9

I used the Robinhood API to pull the responses and this is the content of results['margin_balances']:

"margin_balances":{"day_trade_buying_power":"1304.0125","start_of_day_overnight_buying_power":"-396.0900","overnight_buying_power_held_for_orders":"0.0000","cash_held_for_orders":"0.0000","created_at":"2017-04-19T07:02:31.027035Z","unsettled_debit":"1295.6400","start_of_day_dtbp":"603.9000","day_trade_buying_power_held_for_orders":"0.0000","overnight_buying_power":"4.3600","marked_pattern_day_trader_date":null,"cash":"-795.6400","unallocated_margin_cash":"4.3600","updated_at":"2017-08-14T19:52:49.151954Z","cash_available_for_withdrawal":"0.0000","margin_limit":"0.0000","outstanding_interest":"0.0000","uncleared_deposits":"800.0000","unsettled_funds":"0.0000","day_trade_ratio":"0.25","overnight_ratio":"1.00"}

The iOS app reports the overnight_buying_power variable as the Buying Power in the app, I believe, regardless of unsettled funds (that are available instantly; if the markets were open, I could definitely use that $4.36 to purchase equities."

Not sure if there should be two fields in the Robinhood on Rails app to adjust for this, or to switch entirely, or what the best route going forward is, but that seems to be the reason for the discrepancy in Buying Power between the app and Robinhood on Rails.

EDIT: Ah, checking the Robinhood API, it appears this means I have an "instant" account despite not having gold or anything like that.

https://github.com/sanko/Robinhood/blob/master/Account.md

Difference in the responses may be causing the discrepancy.

bcwik9 commented 7 years ago

Thanks for the help @kyleboddy . I just patched master and instant accounts should have the correct buying power displayed. Feel free to reopen if the bug persists.