In some markets, nothing happens until a buyer and a seller both want to transact at the same time at the same price. Real estate is like this; you can't sell your house to the market; you have to wait until a specific person wants to buy your specific house.

Equities are not like this; there are "market makers" who will buy whatever shares people want to sell, and sell whatever shares people want to buy. For a given stock, like AAPL, maybe market makers are willing to buy shares for $218.38, and sell them for $218.79. The difference ($0.41) is called the spread. On a good day, they'll buy your shares for $218.38, and resell them a few seconds later for $218.79, pocketing the $0.41. Repeat over and over, and you'll make some decent money.

Those quotes are updated rapidly in response to events and changing supply and demand. When prices changes, a market maker can lose (potentially a lot) of money. If Apple announces terrible quarterly results, the "true" price of their shares might suddenly be $150; if you sell all your shares to a market maker for $218.38 before they realise, they'll be facing not a gain of $0.41 per share, but a loss of $68.38 per share.

Market makers work around this by 1) charging a big enough spread that they can eat the occasional loss and 2) by trying to react as fast as they can. Still though, it happens - you never know if the guy who just hit your quote is some guy day trading a few thousand dollars during his lunch break, or if this is just the first part of a hedge fund unloading a few hundred million dollars, so you have to be pretty twitchy, offering wide spreads, and updating prices quickly.

It also follows that if you could somehow be sure that your orders were coming from retail investors, then you wouldn't have to worry about any of that! The orders would be safe to execute, and could be profitable even at very narrow spreads.

US law says that everyone must get execution at least as good as the best posted price (the NBBO), but the NBBO has to take into account that the person on the other side might be a hedge fund; it'll never be THAT good a price. So if you found a source of guaranteed retail orders, you could offer them a private "better than the best" price; that's called "price improvement". Or alternatively, you could offer them the normal public best price (the NBBO) and pay the broker a rebate for sending you the orders (that's called "payment for order flow"). And then your broker might pass the payment for order flow on to you in the form of free or cheaper services, or they might just pocket the money.

So when your sell 20 shares at $10, what's happening is you're selling shares at $10.00 each to a market maker, who is confident that someone else is going to buy them back off them for $10.05 (or whatever). And in fact, although the best publicly available offer is $10.00 (which is what you got; you'll never get worse), if the market maker is sufficiently convinced you aren't secretly about to sell another 9,999,980 shares in the next millisecond because you're actually an algorithmic hedge fund scraping twitter feeds to find out financial news before anyone else, then they might be willing to pay $10.02 for your shares instead, because they don't have to worry about the price changing before they can flip it. Or they might pay $10.00, and kick $0.02 back to your broker, who will use that to offer you free trades, which may or may not be a better deal for you.