Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect amount of shares held #12

Closed
kfchou opened this issue Nov 21, 2019 · 7 comments
Closed

Incorrect amount of shares held #12

kfchou opened this issue Nov 21, 2019 · 7 comments

Comments

@kfchou
Copy link

kfchou commented Nov 21, 2019

In the P/L calculation, number of shares held does not correctly reflect the number of shares I hold in my RH account.

@anthonyk1225
Copy link
Owner

Hey, try pulling your latest history and then generating the xlsx file for orders again. Is it still inaccurate?

If it is, can you tell me if these were shares you straight up bought/sold or if they came from an event like getting assigned from a call, etc.

@kfchou
Copy link
Author

kfchou commented Nov 25, 2019

Hey @anthonyk1225, the shares held are still inaccurate. All shares are bought/sold (I haven't traded any call/puts/options/etc).

If I performe the calculation =IF([@side]="buy",[@quantity],-[@quantity]) on the orders table, and calculated the sum of that result for a particular stock, that summation should give me the shares owned. This is the case for some stocks and not the case for some others. That same summation should be consistent with the number of shares owned on the P/L table, but it isn't. Hopefully this information helps with debugging...

@anthonyk1225
Copy link
Owner

Hmm, the only thing I can think of is there are buy/sell orders missing from your history. This happened for me in my options history where I had a SPY leg missing which caused it to show that I had 1 leg open when I actually had 0.

If you could, check your history on the first tab for a ticker that is incorrect. See if you tally up the buys and sells, it reflects correctly in your RH account. If it does then I'll keep looking, otherwise the wrong tally has to do with RH omitting a trade from your history.

@kfchou
Copy link
Author

kfchou commented Dec 2, 2019

Well, I think there are two issues.

First, tallying the history in the first tab for each stock produces a total number of shares held that is inconsistent with what is shown in the P/L table.

Second, the tallying the history in the first tab still produces incorrect number of shares held of some stocks (but fewer incorrect numbers than the P/L table). In this case, something might be missing from the RH history.

@anthonyk1225
Copy link
Owner

Alright, thanks for that information. It's really annoying that this is happening. I actually messaged RH about the missing leg in my options history and they are content with it being omitted, so now I have to create an avenue to add rows that are missing from a user's history to make up for this.

If you want to email me your rows of just one company where they add up on the first tab, but don't tally up correctly for the P/L tab, I can write some tests and try to see what the bug or error is. Unfortunately, my order history all adds up. I would just need the price and quantity for them, nothing else. All good if that's too much to ask for.

@kfchou
Copy link
Author

kfchou commented Jan 2, 2020

Nice, a new update to ring in 2020! Hope you enjoyed the holidays @anthonyk1225.

In the latest update, I got this error after selecting the xlsx option when running app.py:

Had trouble writing an item to the cell object of type 'NoneType' has no len()
Traceback (most recent call last):
File "app.py", line 48, in <module>
run()
File "app.py", line 41, in run
json_to_xlsx.run(answer)
File "robinhood-to-xlsx\controllers\json_to_xlsx.py", line 81, in run
formula_pipelines[entity](formula_worksheet, workbook, sorted_data)
File "robinhood-to-xlsx\formulas\orders.py", line 112, in handle_formulas
write_aggregates(worksheet, workbook, data)
File "robinhood-to-xlsx\formulas\orders.py", line 104, in write_aggregates
totals = get_company_totals(v)
File "robinhood-to-xlsx\formulas\orders.py", line 39, in get_company_totals
average_sell_price = sell_equity / sell_quantity
ZeroDivisionError: division by zero

Thanks!

@anthonyk1225
Copy link
Owner

What a legend. Fixed this. If there are any other issues, lets start a fresh one.

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

No branches or pull requests

2 participants