laresbernardo / lares

Analytics & Machine Learning R Sidekick
https://laresbernardo.github.io/lares/
233 stars 49 forks source link

Tax on capital gains and input of buy/sales #11

Closed SantiagoRojasCarbonell closed 4 years ago

SantiagoRojasCarbonell commented 5 years ago

Great package! Could you please include the capital gain taxes in the calculations? Also, how should be the buys and sales distinguished in the input spreadsheet? the tickers in the plots get on top of each other and it is hard to distinguish one from the other. Including color coding might make it easier to distinguish.

Thanks

Santiago

laresbernardo commented 5 years ago

Hey @SantiagoRojasCarbonell You managed to create an issue correctly! (And you have the same second last name as my wife haha) Is there a way you could share a reproducible example so I can check each of these points? About the capital gain taxes, I have a doubt: if I bought 3 stocks at 40$, later I bought 2 more of the same at 45$, and finally I sell 4 stocks: with which value should the tax be calculated with? Is it a weighted average? Is it the last? And yes, buy and sell go in the Transacciones tab, where positive is bought and negative sold, using the Quant column. About the colour coding, I supressed those when I added the tickers at the end of each historical line. I am colour-blind so bare with me if I don't like to match legends with plots by just looking 👍

SantiagoRojasCarbonell commented 5 years ago

jajajaja, I am from Colombia, so it might even be the same branch of Carbonells

I attached an example spreadsheet that I analyzed. I tried to upload the report but this platform does not support HTML.

For the capital gain taxes it depends on the way you set your taxes to be calculated. Most of the times First-in, first-out (FIFO) is set as default. It means that for tax purposes, the first stock to be sold is the first one that was acquired, and the capital gains are calculated as the difference.

I understand the color, is there any way that you think it would be easy to distinguish which one corresponds to? Maybe making the graphs larger in the Y direction would help prevent overlapping.

Gracias Bernardo

example for Github.xlsx

SantiagoRojasCarbonell commented 5 years ago

The tax methodology could be another option for the function, a more complete description of the different methods is the following: https://www.tdameritrade.com/education/taxes/what-is-a-tax-lot.page The most common being FIFO and LIFO