Total gain of portfolio including sold stocks?
You could create your own spreadsheet of Cash Flows and use the XIRR function in Excel: The formula is:
15-19% gains also includes 15-19% and greater losses. They may not be required to disclose that to you in Hong Kong. If it isn't a leveraged account then that isn't too bad. Hong Kong is a nice jurisdiction, The US Federal Government is the only person you don't hide your assets from - but they dont want anything - so just report the accounts as commanded and you'll be A-Okay. You have only sold 200 shares for $4.75 from those bought for $3.15. So your profit on those 200 shares is $1.60 per share or $320 or 51%. From that you have 110 shares left that cost you $3.15 and 277 shares that cost you $3.54. So the total cost of your remaining shares is $1,327.08 (110 x $3.15 + 277 x $3.54). So your remaining shares have a average cost of $3.429 per share ($1,327.08/387). We don't know what the current share price is as you haven't provided it, nor do we know what the company is, so lets say that the current price is $5 (or that you sell the remaining 387 shares for $5 per share). Then the profit on these 387 shares would be $1.571 per share or $607.92 or 46%. Your total profit would then be $320 + $ 607.92 = $927.92 or 47% (note that this profit neglects any brokerage or other fees, as you have not provided any). Edit due to new info. provided in question With the current share price at $6.06 then the profit on these 387 shares would be $2.631 per share or $1018.20 or 77%. Your total profit would then be $320 + $1018.20 = $1338.20 or 75% (note that this profit neglects any brokerage or other fees, as you have not provided any). The biggest benefit to having a larger portfolio is relatively reduced transaction costs. If you buy a $830 share of Google at a broker with a $10 commission, the commission is 1.2% of your buy price.  If you then sell it for $860, that's another 1.1% gone to commission.  Another way to look at it is, of your $30 ($860 - $830) gain you've given up $20 to transaction costs, or 66.67% of the proceeds of your trade went to transaction costs. Now assume you traded 10 shares of Google. Your buy was $8,300 and you sold for $8,600.  Your gain is $300 and you spent the same $20 to transact the buy and sell.  Now you've only given up 6% of your proceeds ($20 divided by your $300 gain). You could also scale this up to 100 shares or even 1,000 shares. Generally, dividend reinvestment are done with no transaction cost.  So you periodically get to bolster your position without losing more to transaction costs.  For retail investors transaction costs can be meaningful.  When you're wielding a $5,000,000 pot of money you can make your trades on a larger scale giving up relatively less to transaction costs. Firstly 795 is not even. Secondly - generally you would pay tax on the sale of the 122 shares, whether you buy them back or not, even one minute later, has nothing to do with it. The only reason this would not create a capital gains event is if your country (which you haven't specified) has some odd rules or laws about this that I, and most others, have never heard of before. No. There is no asset associated with your short position, so there's nothing to gift. The short position in the stock is purely a liability. When you note that you have a profit in the position, what you mean is that the cash you made when you shorted the stock is more than enough to cover the short position. The only asset in this picture, then, is the cash you made when you entered the short position. "Stocks, as an asset, represent the sum of the current market value of all of your holdings. If your portfolio is showing unrealized gains and losses, then that net amount is inherently reflected in the current market value of your holdings.  That's not to say cost basis is not important. Any closed trades, realized gains or losses, will of course have an impact on your taxable income. So, it couldn't hurt to keep track of your cost basis from a tax standpoint, but understand that the term ""asset"" refers to the current market values and does not consider base amounts. Taxes do. Perhaps consider making separate cells for cost basis, but also bear in mind that most if not all of the major online discount brokers will provide transferring of cost basis information electronically to the major online tax service providers." "There are some good answers about the benefits of diversification, but I'm going to go into what is going on mathematically with what you are attempting. I was always under the assumption that as long as two securities are less than perfectly correlated (i.e. 1), that the standard deviation/risk would be less than if I had put 100% into either of the securities. While there does exist a minimum variance portfolio that is a combination of the two with lower vol than 100% of either individually, this portfolio is not necessarily the portfolio with highest utility under your metric.  Your metric includes returns not just volatility/variance so the different returns bias the result away from the min-vol portfolio. Using the utility function: E[x] - .5*A*sig^2 results in the highest utility of 100% VTSAX. So here the Sharpe ratio (risk adjusted return) of the U.S. portfolio is so much higher than the international portfolio over the period tracked that the loss of returns from adding more international stocks outweigh the lower risk that you would get from both just adding the lower vol international stocks and the diversification effects from having a correlation less than one. The key point in the above is ""over the period tracked"".  When you do this type of analysis you implicitly assume that the returns/risk observed in the past will be similar to the returns/risk in the future.   Certainly, if you had invested 100% in the U.S. recently you would have done better than investing in a mix of US/Intl.  However, while the risk and correlations of assets can be (somewhat) stable over time relative returns can vary wildly! This uncertainty of future returns is why most people use a diversified portfolio of assets.  What is the exact right amount is a very hard question though." Sale of a stock creates a capital gain. It can be offset with losses, up to $3000 more than the gains. It can be deferred when held within a retirement account.  When you gift appreciated stock, the basis follows. So when I gifted my daughter's trust shares, there was still tax due upon sale. The kiddy tax helped reduce but not eliminate it. And there was no quotes around ownership. The money is gone, her account is for college.  No 1031 exchange exists for stock. There's really not a simple yes/no answer.  It depends on whether you're doing short term trading or long term investing.  In the short term, it's not much different from sports betting (and would be almost an exact match if the bettors also got a percentage of the team's ticket sales), In the long term, though, your profit mostly comes from the growth of the company.  As a company - Apple, say, or Tesla - increases sales of iPhones or electric cars, it either pays out some of the income as dividends, or invests them in growing the company, so it becomes more valuable.  If you bought shares cheaply way back when, you profit from this increase when you sell them.  The person buying it doesn't lose, as s/he buys at today's market value in anticipation of continued growth.  Of course there's a risk that the value will go down in the future instead of up. Of course, there are also psychological factors, say when people buy Apple or Tesla because they're popular, instead of at a rational valuation.  Or when people start panic-selling, as in the '08 crash.  So then their loss is your gain - assuming you didn't panic, of course :-) Unless your investments are held within a special tax-free account, then every sale transaction is a taxable event, meaning a gain or loss (capital gain/loss or income gain/loss, depending on various circumstances) is calculated at that moment in time. Gains may also accrue on unrealized amounts at year-end, for specific items [in general in the US, gains do not accrue at year-end for most things]. Moving cash that you have received from selling investments, from your brokerage account to your checking account, has no impact from a tax perspective. "This page from simplestockinvesting.com gives details of total returns for the S&P500 for each decade over the last 60 years, including total returns for the entire 60 year period. It is important to understand that, from an investors point of view, the total return includes both the change in index value (capital gain) plus dividends received.  This total then needs to be adjusted for inflation to give the ""total real return"". As noted in the analysis provided, 44% of the total return from the S&P500 over the last 80 years comes from dividends.  For the DowJones30, this site provides a calculator for total returns and inflation adjusted total returns for user selected periods. Finding comparable analysis for the NASDAQ market is more difficult.  The NASDAQ market site provides gross values for total returns over fixed periods, but you will then need to do the arithmetic to calculate the equivalent average annual total returns.  No inflation adjusted values for ""real"" returns are provided, so again you will need to combine inflation data from elsewhere and do the arithmetic." "This is actually a very complicated question. The key reading in this area is a seminal paper by Almgren & Chriss, ""Optimal Execution of Portfolio Transactions"" (2000). They show that there's a tradeoff between liquidating your portfolio faster and knowing the value with more certainty, versus liquidating more slowly (and likely for a higher price) but with less certainty. So for example, if you sold your entire position right now, you would know almost certainly how much you would get for the position. Or, you could sell off your position more slowly, and likely get more money, but you would have less certainty about how much you would get. The paper is available online at http://www.courant.nyu.edu/~almgren/papers/optliq.pdf" "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." "The calculation and theory are explained in the other answers, but it should be pointed out that the video is the equivalent of watching a magic trick.  The secret is: ""Stock A and B are perfectly negatively correlated.""  The video glasses over that fact that without that fact the risk doesn't drop to zero. The rule is that true diversification does decrease risk. That is why you are advised to spread year investments across small-cap, large-cap, bonds, international, commodities, real estate. Getting two S&P 500 indexes isn't diversification.  Your mix of investments will still have risk, because return and risk are backward calculations, not a guarantee of future performance. Changes that were not anticipated will change future performance. What kind of changes: technology, outsourcing, currency, political, scandal." "If it's fully expensed, it has zero basis. Any sale is taxable, 100%. To the ordinary income / cap gain issue raised in comment - It's a cap gain, but I believe, as with real estate, special rates apply. This is where I am out of my area of expertise, and as they say - ""Consult a professional."""