Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

"cash_available_from_instant_deposits" can increase 'stock' value unintentionally. #50

Open
chris14991 opened this issue Feb 14, 2021 · 1 comment

Comments

@chris14991
Copy link

chris14991 commented Feb 14, 2021

'cash_available_from_instant_deposits' appears to always return from Robinhood as the entire initial deposit and does not subtract any usage of that deposit ('instant_allocated' appears to be the amount used) This can result in 'cash' ending up as a negative number creating the addition of ''cash_available_from_instant_deposits' to 'stock'

Removing the subtraction of 'cash' from 'stock' and 'request.cash_available_from_instant_deposits' from 'uninvested_cash` resolves this issue for me locally, but i assume there is a case unknown to me where this subtraction is necessary.

For example what is happening with my current account.
cash = 1 - 1000 // -999
stock = 1000 - ( -999 ) // 1999

      if (request.uninvested_cash) {
        cash = parseFloat(request.uninvested_cash) - parseFloat(request.cash_available_from_instant_deposits);
      }
      if (request.equities) {
        stocks = parseFloat(request.equities) - cash;
      }
@billvsd
Copy link

billvsd commented Apr 7, 2021

@chris14991 this subtraction was a change as a result of the Robinhood Cash balance being set as the cash balance + buying power that I reported in issue #44.

Currently, my Robinhood Cash Balance is not being correctly recorded with the extension because of the calculation cash = parseFloat(request.uninvested_cash) - parseFloat(request.cash_available_from_instant_deposits); results in a negative number.

@pkmnct I believe the following changes will fix this issue.

content/robinhood/main.ts : add instant_allocated to returnValue
if (json.instant_allocated && json.instant_allocated.amount) { returnValue.instant_allocated = json.instant_allocated.amount; }

content/mint/properties/update.js: subtract cash_available_from_instant_deposits from instant_allocated
if (request.uninvested_cash) { cash = parseFloat(request.uninvested_cash) - (parseFloat(request.cash_available_from_instant_deposits) - parseFloat(request.instant_allocated) ); }

This screenshot from Robinhood shows the "Instant Available"
image

In my case, the current values are:

  • uninvested_cash = 0
  • cash_available_from_instant_deposits = 10
  • insant_allocated = 10

The current calculation was 0 - 10, resulting in -10.

By subtracting the instant_allocated, the calculation becomes 0 - (10 - 10) which is the correct result. The Mint UI does not allow negative numbers which is why my cash balance was stuck at an incorrect value.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants