What's the difference between a Bitcoin Wallet and a Bitcoin Exchange? I was thinking about investing a small amount of money in Bitcoin: actually I'm having second thoughts about this, after all the fraud stories I've been told about on the Personal Finance site. However, that doesn't affect this question.

Reading this Investopedia article, I discovered that one should create a Bitcoin Wallet before buying Bitcoins on a Bitcoin Exchange such as Coinbase or Kraken. I don't understand why I should do that, isn't enough to download the Coinbase app, for example? Also, the link says that


  While exchanges offer wallet capabilities to users, it’s not their primary business. Since wallets need to be kept safe and secure, exchanges do not encourage storing of Bitcoins for higher amounts or long periods of time. Hence, it is best to transfer your Bitcoins to a secure wallet.


What's the reason for that? If I buy stock options, no one would object to me keeping them invested for years. Then why can't I leave my investment on a Bitcoin Exchange for a long period?


Do I risk that the Exchange goes bankrupt?
Do I risk that someone hacks my account on the Exchange? If so, is that common?
Something else?


Basically, I want to understand if, for the sake of investing a small amount of money in Bitcoins, it makes sense to put my "pocket  money" in a Bitcoin Exchange and leave it there for a few years, or if the risk  of fraud/hacking is so high that I should not do that. Note that this has nothing to do with the volatility of the Bitcoin investment - I'm ok with making a risky investment (a gamble) since it's just very little money. But I'm not ok at all with having my money stolen, even if it's a small amount.
A bitcoin (or any crypto) wallet is simply a set of public/private keys. If you own the keys, you own any coins that those keys can access.

An exchange is very similar to a stock exchange. You exchange one asset for another. Exchanges come in many forms, such as decentralized (etherdelta), wallet-less (Shapeshift, Changelly), and the more traditional ones such as Bitfinex and Binance.

The first two kinds don't offer a wallet service. Coins are sent directly from a wallet you control to the exchange, and whatever you bought is sent directly to your wallet. These exchanges effectively offer no custodial service. It's like going shopping at a store. You take out cash from your wallet, give it to the store, and collect your goods and leave.

These exchanges, while around, are harder to use for the average user, and considerably slower due to the transactions needed to move crypto in and out. This results in less than ideal pricing and liquidity.

The regular exchanges solve this by offering both a wallet service and an exchange service. You can deposit coins and leave them in the exchange's custody, and then trade the amount you deposited instantly, without needing to make a transaction. Coins you buy are similarly credited to you on the exchange's platform, but are not truly in your control until you withdraw them to your own wallet. This is more akin to shopping at Amazon - You pay them, and you're told "Hey, you've paid me, and this item now belongs to you". But until the item is actually shipped to your own house (and thus put under your control), there is still a possibility that Amazon could default on that promise.

By using exchanges that act as wallets, you definitely run the risk that the exchange is fraudulent or can get hacked, or your account can be compromised. The general advice is that one only keeps funds they are actively trading on an exchange. If you plan on just buying a coin and keeping it for weeks/months/years, it is recommended you buy it and withdraw to a paper or hardware wallet.

For smaller amounts of money, you can also use programs such as Electrum to create a wallet that you control, and withdraw your coins to that.