How does the U.S. wash sale replacement stock rule work?
"From Pub 550: More or less stock bought than sold.   If the number of shares of   substantially identical stock or securities you buy within 30 days   before or after the sale is either more or less than the number of   shares you sold, you must determine the particular shares to which the   wash sale rules apply. You do this by matching the shares bought with   an equal number of the shares sold. Match the shares bought in the   same order that you bought them, beginning with the first shares   bought. The shares or securities so matched are subject to the wash   sale rules. You must match ""beginning with the first shares bought."" If only activity 1 & 4 happened, you'd have bought and sold stock with no wash sale. If you remove activity 1 & 4 from consideration because they are a ""normal"" or non-wash sale transaction, then the Activity 2 or Activity 3 trigger a wash sale. The shares in lot 1 are sold for disallowed loss, so the disallowed basis would be added to shares in lot 2 because lot 2 was purchased before lot 3. (hat tip to user662852 who had much better wording) Second example: Activity 5, 7, and 8 all together would not be a wash sale.   The addition of activity 6 creates a wash sale. The shares in Activity 5 are sold for a disallowed loss in Activity 7 & 8 because of the wash sale triggering purchase in Activity 6.   Activity 6 is where you add the disallowed basis because they are the ""first shares bought"" that cause the wash sale rule to be triggered." "Edited: Pub 550 says 30 days before or after so the example is ok - but still a gain by average share basis.  On sale your basis is likely defaulted to ""average price"" (in the example 9.67 so there was a gain selling at 10), but can be named shares at your election to your brokerage,  and supported by record keeping. A Pub 550 wash might be buy 2000 @ 10 with basis 20000, sell 1000 @9 (nominally a loss of 1000 for now and remaining basis 10000), buy 1000 @ 8 within 30 days.   Because of the wash sale rule the basis is 10000+8000 paid + 1000 disallowed loss from wash sale with a final position of 2000 shares at 19000 basis.  I think I have the link at the example:  http://www.irs.gov/publications/p550/ch04.html#en_US_2014_publink100010601"
If the share is listed on a stock exchange that creates liquidity and orderly sales with specialist market makers, such as the NYSE, there will always be a counterparty to trade with, though they will let the price rise or fall to meet other open interest.  On other exchanges, or in closely held or private equity scenarios, this is not necessarily the case (NASDAQ has market maker firms that maintain the bid-ask spread and can do the same thing with their own inventory as the specialists, but are not required to by the brokerage rules as the NYSE brokers are).  The NYSE has listing requirements of at least 1.1 million shares, so there will not be a case with only 100 shares on this exchange. Graphs are nothing but a representation of data. Every time a trade is made, a point is plotted on the graph. After points are plotted, they are joined in order to represent the data in a graphical format.  Think about it this way.  1.) Walmart shuts at 12 AM. 2.)Walmart is selling almonds at $10 a pound.  3.) Walmart says that the price is going to reduce to $9 effective tomorrow. 4.) You are inside the store buying almonds at 11:59 PM.  5.) Till you make your way up to the counter, it is already 12:01 AM, so the store is technically shut. 6.) However, they allow you to purchase the almonds since you were already in there.  7.) You purchase the almonds at $9 since the day has changed. 8.) So you have made a trade and it will reflect as a point on the graph. 9.) When those points are joined, the curves on the graph will be created. 10.) The data source is Walmart's system as it reflects the sale to you. ( In your case the NYSE exchange records this trade made). Buying a stock is just like buying almonds. There has to be a buyer. There has to be a seller. There has to be a price to which both agree. As soon as all these conditions are met, and the trade is made, it is reflected on the graph. The only difference between the graphs from 9 AM-4 PM, and 4 PM-9 AM is the time. The trade has happened regardless and NYSE(Or any other stock exchange) has recorded it! The graph is just made from that data. Cheers. In addition to the adjustment type in NL7's answer, there are a host of others.  If there are any adjustments, form 8949 is required, if not, the gains can be separated into short and long-term and added together to be entered on Schedule D.  Anything requiring an adjustment code in column F of the 8949 requires an entry in column G.   Some other example entries for column F include: (see the 8949 instructions for a complete list) **A wash sale occurs when you sell or trade stock or securities at a loss and within 30 days before or after the sale you: Buy substantially identical stock or securities, Acquire substantially identical stock or securities in a fully taxable trade, Acquire a contract or option to buy substantially identical stock or securities, or Acquire substantially identical stock for your individual retirement account (IRA) or Roth IRA. (from Pub17) During a stock split the only thing that changes is the number of shares outstanding.  Typically a stock splits to lower its price per share.  Sometimes if a company's value is falling it will do a reverse split where X shares will be exchanged for Y shares.  This is typically done to avoid being de-listed from an exchange if the price per share falls below a certain threshold, usually $1.  Again the only thing changing is the number of shares outstanding.  A 20 for 1 reverse split means for every 20 shares outstanding the shareholder will be granted one new share. Example X Co. has 1,000,000 shares outstanding for a price of $100 per share.  It does a 1 for 10 split.  Now there are 10,000,000 shares outstanding for a price of $10 per share. Example Y Co has 1,000,000 shares outstanding for a price of $1 per share.  It does a 10 for 1 reverse split.  Now there are 100,000 shares outstanding for a price of $10. Quickly looking at the news for ASTI it looks like it underwent a 20 for 1 reverse split.  You should probably look at your statements and ask your broker how the arithmetic worked in your case. Investopedia links for Reverse Stock Split and Stock Split There isn't a formula like that, there is only the greed of other market participants, and you can try to predict how greedy those participants will be. If someone decided to place a sell order of 100,000 shares at $5, then you can buy an additional 100,000 shares at $5. In reality, people can infer that they might be the only ones trying to sell 100,000 shares right then, and raise the price so that they make more money. They will raise their sell order to $5.01, $5.02 or as high as they want, until people stop trying to buy their shares. It is just a non-stop auction, just like on ebay. On expiry, with the underlying share price at $46, we have : You ask :  How come they substract 600-100. Why ? Because you have sold the $45 call to open you position, you must now buy it back to close your position.  This will cost you $100, so you are debited for $100 and this debit is being represented as a negative (subtracted); i.e., -$100 Because you have purchased the $40 call to open your position, you must now sell it to close your position.  Upon selling this option you will receive $600, so you are credited with $600 and this credit is represented as a positive (added) ; i.e., +$600. Therefore, upon settlement, closing your position will get you $600-$100 = $500.  This is the first point you are questioning.   (However, you should also note that this is the value of the spread at settlement and it does not include the costs of opening the spread position, which are given as $200, so you net profit is $500-$200 = $300.) You then comment :  I know I am selling 45 Call that means : As a writer: I want stock price to go down or stay at strike. As a buyer: I want stock price to go up. Here, note that for every penny that the underlying share price rises above $45, the money you will pay to buy back your short $45 call option will be offset by the money you will receive by selling the long $40 call option.  Your $40 call option is covering the losses on your short $45 call option. No matter how high the underlying price settles above $45, you will receive the same $500 net credit on settlement.  For example, if the underlying price settles at $50, then you will receive a credit of $1000 for selling your $40 call, but you will incur a debit of $500 against for buying back your short $45 call.  The net being $500 = $1000-$500.  This point is made in response to your comments posted under Dr. Jones answer. "According to page 56 of the 2015 IRS Publication 550 on Investment Income and Expenses: Wash sales. Your holding period for substantially identical stock or securities you acquire in a wash sale includes the period you held the old stock or securities. It looks like the rule applies to stocks and other securities, including options. It seems like the key is ""substantially identical"". For your brokerage / trading platform to handle these periods correctly for reporting to IRS, it seems best to trade the same security instead of trying to use something substantially identical." "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." I think the simple answer to your question is: Yes, when you sell, that drives down the price. But it's not like you sell, and THEN the price goes down. The price goes down when you sell. You get the lower price.  Others have discussed the mechanics of this, but I think the relevant point for your question is that when you offer shares for sale, buyers now have more choices of where to buy from. If without you, there were 10 people willing to sell for $100 and 10 people willing to buy for $100, then there will be 10 sales at $100. But if you now offer to sell, there are 11 people selling for $100 and 10 people buying for $100. The buyers have a choice, and for a seller to get them to pick him, he has to drop his price a little. In real life, the market is stable when one of those sellers drops his price enough that an 11th buyer decides that he now wants to buy at the lower price, or until one of the other 10 buyers decides that the price has gone too low and he's no longer interested in selling. If the next day you bought the stock back, you are now returning the market to where it was before you sold. Assuming that everything else in the market was unchanged, you would have to pay the same price to buy the stock back that you got when you sold it. Your net profit would be zero. Actually you'd have a loss because you'd have to pay the broker's commission on both transactions. Of course in real life the chances that everything else in the market is unchanged are very small. So if you're a typical small-fry kind of person like me, someone who might be buying and selling a few hundred or a few thousand dollars worth of a company that is worth hundreds of millions, other factors in the market will totally swamp the effect of your little transaction. So when you went to buy back the next day, you might find that the price had gone down, you can buy your shares back for less than you sold them, and pocket the difference. Or the price might have gone up and you take a loss. Yes. Wash rules are only for losses. The 'normal' series of events when trading a stock is to buy it, time passes, then you sell it. If you believe the stock will drop in price, you can reverse the order, selling shares, waiting for the price drop, then buying them back. During that time you own say, -100 shares, and are 'short' those shares. You have to wait for three (business) days. That's the time it takes for the settlement to complete and for the money to get to your account. If you don't wait - brokers will still allow you to buy a new stock, but may limit your ability to sell it until the previous sale is settled. Here's a FAQ from Schwab on the issue. 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. Is wash rule applicable for this? No - because you made a gain on the sale.  You paid $13,500 for the stock and sold it for $14,250.   The wash rule prevents you from claiming a loss if you buy the same stock again within 30 days.  You have no loss to claim, so the rule does not apply. "No, there are no issues.  When you form the corp in DE, you pick a business there to serve as your ""agent"" (essentially someone who knows to get in contact with you).  The ""agent"" will notify you about taxes and any mail you get, but besides the fee they charge you for being the agent, you should file all the taxes directly with DE (franchise tax is easy to file on the web) instead of going through the agent and paying a surcharge. When your LLC files taxes, you'll do so in DE and then the LLC will issue you a federal and state K1.  You'll file taxes where you reside and use the federal K1, but I think you might have to file DE state taxes (unsure about this part, feel free to edit or comment and I'll correct)."