How are long term capital gains taxes calculated?
You pay taxes on capital gains when you realize your gains by selling the investment property.  Also, in the US, taxes on capital gains are computed at special rates depending on your current income level, and so when you realize your gains two years from now, you will pay taxes on the gains at the special rate then applicable to your income level for the year of sale. Remember also that the US Congress  can change the tax laws at any time between now and the time you sell your stocks, and so the rates you are looking at now may have changed too. Capital gains taxes for a year are calculated on sales of assets that take place during that year.  So if you sell some stock in 2016, you will report those gains/losses on your 2016 tax return.
E.g. I buy 1 stock unit for $100.00 and sell it later for $150.00 => income taxes arise. Correct. You pay tax on your gains, i.e.: the different between net proceeds and gross costs (proceeds sans fees, acquisition costs including fees). I buy 1 stock unit for $150.00 and sell it later for $100.00 => no income taxes here. Not correct. The loss is deductible from other capital gains, and if no other capital gains - from your income (up to $3000 a year, until exhausted). Also, there are two different tax rate sets for capital gains: short term (holding up to 1 year) and long term (more than that). Short term capital gains tax matches ordinary income brackets, whereas long term capital gains tax brackets are much lower. "Generally if you are using FIFO (first in, first out) accounting, you will need to match the transactions based on the number of shares. In your example, at the beginning of day 6, you had two lots of shares, 100 @ 50 and 10 @ 52.  On that day you sold 50 shares, and using FIFO, you sold 50 shares of the first lot.  This leaves you with 50 @ 50 and 10 @ 52, and a taxable capital gain on the 50 shares you sold. Note that commissions incurred buying the shares increase your basis, and commissions incurred selling the shares decrease your proceeds.  So if you spent $10 per trade, your basis on the 100 @ 50 lot was $5010, and the proceeds on your 50 @ 60 sale were $2990.  In this example you sold half of the lot, so your basis for the sale was half of $5010 or $2505, so your capital gain is $2990 - 2505 = $485. The sales you describe are also ""wash sales"", in that you sold stock and bought back an equivalent stock within 30 days.  Generally this is only relevant if one of the sales was at a loss but you will need to account for this in your code.  You can look up the definition of wash sale, it starts to get complex. If you are writing code to handle this in any generic situation you will also have to handle stock splits, spin-offs, mergers, etc. which change the number of shares you own and their cost basis.  I have implemented this myself and I have written about 25-30 custom routines, one for each kind of transaction that I've encountered.  The structure of these deals is limited only by the imagination of investment bankers so I think it is impossible to write a single generic algorithm that handles them all, instead I have a framework that I update each quarter as new transactions occur." For the record, now that 2011 is here we know that the capital gains tax rate didn't change. Congress extended it for two more years. This shows the uncertainty in trying to maximize earnings based on future changes to the tax code. "You should check with your broker for details, but you can generally specify which ""lot"" you are selling.  where I've seen it, that's done by concurrently sending a ""letter of instruction"" documenting your choice of lot concurrent with the sale, but different brokers may handle this differently.  I would think this should work for the case that you describe. (In addition, the default rule used by your broker is ""probably"" first-in-first-out, which will do what you want here.) Note that this may come into play even in a margin account to the extent that you might want to specify a lot in order to obtain (or set yourself up for later benefit of) favorable tax treatment under the long-term capital gains rules" "Appreciation of a Capital Asset is a Capital Gain.   In the United States, Capital Gains get favorable tax treatment after being held for 12 months. From the IRS newsroom: Capital gains and losses are   classified as long-term or short-term,   depending on how long you hold the   property before you sell it. If you   hold it more than one year, your   capital gain or loss is long-term. If   you hold it one year or less, your   capital gain or loss is short-term. The tax rates that apply to net   capital gain are generally lower than   the tax rates that apply to other   income. For 2009, the maximum capital   gains rate for most people is15%. For   lower-income individuals, the rate may   be 0% on some or all of the net   capital gain. Special types of net   capital gain can be taxed at 25% or   28%. The IRS defines a Capital Asset as ""most property you own"" with a list of exclusions found in Schedule D Instructions.  None of the exclusions listed relate to Bond ETFs." The first method is the correct one. You bought an asset worth of $1000 and you put it on your depreciation schedule. What it means is that you get to write off the $1000 over a certain period of time (and not at once, as you do with expenses). But the value you're writing off is the $1000 regardless of how much you've written off already. Assume you depreciate in straight line over 5 years (that's how you depreciate computers for Federal tax purposes, most states follow). For the simplicity of the calculation, assume you depreciate each year as a whole year (no mid-year/mid-quarter conventions). The calculation is like this: If you sell the computer - the proceeds above the adjusted basis amount are taxed as depreciation recapture up to the accumulated depreciation amount, and as capital gains above that. So in your case - book value is the adjusted basis at the end of the year (EOY), depreciation this year is the amount you depreciate in the year in question out of the total of the original cost, and the accumulated depreciation is the total depreciation including the current year. In Maryland they do not allow depreciating to $0, but rather down to 25% of the original cost, so if you bought a $1000 computer - you depreciate until your adjusted basis is $250. Depreciation rates are described here (page 5). For computers (except for large mainframes) you get 30% depreciation, with the last year probably a bit less due to the $250 adjusted basis limitation. How you are taxed will depend on what kind of stock awards they are. The value will be determined by the company that issues it, and appropriate tax forms will be sent to you to include with your taxes. The way the value is determined is an accounting question that is off-topic here, but the value will be stated on your stock award paperwork. If you are awarded the stock directly then that value will be taxed as ordinary income. If you are awarded options, then you can purchase the stock to start the clock on long-term capital gains, but you will not incur any tax liability through the initial purchase.  If the company is sold privately and you have held the stock for over 1 year, then yes, it will be taxed as a long-term capital gain. If you receive/exercise the stock less than 1 year before such an acquisition, then it will be considered a short-term capital gain and will be taxed as ordinary income. I'm not sure where you are, but in the United States capital gains are taxed at a lower rate than other types of income. On the 1040, captial gains income is separated from earned income, and income tax is calculated just on earned income. Then capital gains tax is calculated on capital gains income, and then added to income tax afterward. If the gift was stock that they have owned for years there can be one hitch: The basis of the stock doesn't reset when it is gifted. For example if grandparents have owned stock that is currently worth $10,000 today, but they bought it decades ago when it only cost them $1,000; then if the new owner sells it today they will have a gain of $9,000. The clock to determine short term/long term also doesn't reset; which is good. The basis needs to be determined now so that the gain  can be accurately calculated in the future. This information should be stored in a safe place. Gains for dividends are investment income and the rules regarding the kiddie tax need to be followed. As mentioned by Dilip, you need to provide more details. In general for transacting on stocks; Long Term: If you hold the stock for more than one year then its long term and not taxable. There is a STT [Securities Transaction Tax] that is already deducted/paid during buying and selling of a stock. Short Term: If you hold the stock for less than one year, it's short term gain. This can be adjusted against the short term loss for the financial year. The tax rate is 10%. Day Trading: Is same as short term from tax point of view. Unless you are doing it as a full time business. If you have purchased multiple quantities of same stock in different quantities and time, then when you selling you have to arrive at profit or loss on FIFO basis, ie First in First Out In the United States Short-term capital gains are taxed at rates similar to regular income which is 25% if you make less than $91,000 and 28% if you make more than that but less than $190,000. If you make more than $190,000 then the rate is 33%. If you hold the stock for a year or more than the tax rate is 15%, unless your income is less than $33,000 in which case there is no tax on long-term gains. As a general rule, the way to make money is to stay out of debt, so I cannot advise you to assume a mortgage. Financially you are better off investing your money. Much like you I bought a house with a mortgage using about $30,000 in a down payment about 20 years ago and I paid it off a few years ago. If I had to do it over again, I would have bought a shack (a steel building) for $30,000 and lived in that and invested my income. If I had done that, I would be about $500,000 richer today than I am now. You normally only pay taxes on the difference between the sale price and the cost basis of the asset. In your example, you would probably pay taxes on the $10 difference, not the full sale price of $110. If you paid a commission, however, you would be taxed on your gain minus the commission you paid. Since you held the asset for less than a year, you wouldn't pay the long-term capital gains rate of 20%; you'd be taxed on the capital gain as if it were ordinary income, which depends on your federal income tax bracket. Also, littleadv makes a good point about the implications of buying the asset with after-tax funds too, so that's another part of the equation to consider as well. Consult a professional CA. For shares sold outside the Indian Stock Exchanges, these will be treated as normal Long Term Capital Gains if held more than one year. The rate would be 10% without Indexation and 20% with Indexation. If the stocks are held for less than 1 years, it will be short term gains and taxed according you to tax bracket. You should get a 1099-MISC for the $5000 you got.  And your broker should send you a 1099-B for the $5500 sale of Google stock. These are two totally separate things as far as the US IRS is concerned. 1) You made $5000 in wages. You will pay income tax on this as well as FICA and other state and local taxes. 2) You will report that you paid $5000 for stock, and sold it for $5500 without holding it for one year. Since this was short term, you will pay tax on the $500 in income you made. These numbers will go on different parts of your tax form.  Essentially in your case, you'll have to pay regular income tax rates on the whole $5500, but that's only because short term capital gains are treated as income.  There's always the possibility that could change (unlikely).  It also helps to think of them separately because if you held the stock for a year, you would pay different tax on that $500.  Regardless, you report them in different ways on your taxes. "I'll try to answer using your original example.  First, let me restate your assumptions, slightly modified: The mutual fund has: Note that I say the ""mutual fund has"" those gains and losses. That's because they occur inside the mutual fund and not directly to you as a shareholder. I use ""realized"" gains and losses because the only gains and losses handled this way are those causes by actual asset (stock) sales within the fund (as directed by fund management).  Changes in the value of fund holdings that are not sold are not included in this. As a holder of the fund, you learn the values of X, Y, and Z after the end of the year when the fund management reports the values.  For gains, you will also typically see the values reported on your 1099-DIV under ""capital gains distributions"".  For example, your 1099-DIV for year 3 will have the value Z for capital gains (besides reporting any ordinary dividends in another box).   Your year 1 1099 will have $0 ""capital gains distributions"" shown because of the rule you highlighted in bold: net realized losses are not distributed.  This capital loss however can later be used to the mutual fund holder's tax advantage.  The fund's internal accounting carries forward the loss, and uses it to offset later realized gains.  Thus your year 2 1099 will have a capital gain distribution of (Y-X), not Y, thus recognizing the loss which occurred. Thus the loss is taken into account.  Note that for capital gains you, the holder, pay no tax in year 1, pay tax in year 2 on Y-X, and pay tax in year 3 on Z. All the above is the way it works whether or not you sell the shares immediately after the end of year 3 or you hold the shares for many more years.  Whenever you do sell the shares, you will have a gain or loss, but that is different from the fund's realized losses we have been talking about (X, Y, and Z)."