Hi,

When I saw Gary's gif (really got me to laugh, in a good way), I've been waiting to for a bit of quiet time to reply. First, I'd like to clarify the behavior that Gary is depicting in the gif. In both cases, there is leverage. I thought it would be useful to explain that point a bit, and define some common terms.

**Leverage** is just a way of explaining how much market exposure you have relative to the value of your portfolio. Leverage is always defined for a portfolio as a ratio between the total value of your stock positions (excluding cash) and the net liquidating value of your portfolio (stock + cash).

**Net Liquidating Value** of a portfolio is the cash you would have if you sold all your positions. Net Liquidating Value is the denominator for the leverage ratio. Say you have a $100 in cash, and a single share of ACME worth $100. The net liquidation value of your portfolio is $200. The leverage of that same portfolio is $100 / $200 = 0.5.

**Margin** is the name for credit extended to you to invest. Leverage doesn't mean to borrow, but there is a colloquialism in finance to say "you are using leverage". That actually means that you are buying and selling on **margin** -- borrowing in order to invest. For stocks, you can borrow cash to buy stock, and you can borrow stock to sell it (short selling, which adds a wrinkle to leverage calculations that I'm ignoring here). Margin is the real missing piece for Quantopian's simulation -- we don't limit borrowing at all.

Leverage is always an informative value, regardless of whether you are using margin. One way to think about it is how much will changes in your stock position be magnified in your portfolio. Let's go through three examples: one where you have exactly enough cash to buy 1 share of stock, a second where you have much more cash, and a third where you need to borrow cash to buy the stock.

**Case 1: Just the right amount of cash**

If you start with $100 in cash, and buy 1 share of ACME for $100, your total stock value will be $100. Your net liquidating value will also be $100. And your leverage would be 1.0. You would have borrowed no cash or stock. If ACME goes to $110, you would have a 10% return. That's a tidy example that satisfies everyone's intuition about returns.

**Case 2: Much more cash to start**

Now, imagine you start with $1,000,000. You then buy 1 share of ACME for $100. Your total stock value would be $100. Your net liquidating value would be $100 in stock plus $999,900 in cash, or $1,000,000. Your leverage = $100 / $1,000,000 = 0.0001. If ACME goes to $110, you would have a 0.001% return. If you ignore your leverage, this example is frustrating. In this case, the leverage figure is minuscule -- it means you have a tiny amount of exposure.

**Case 3: Very little cash to start**

Finally, imagine you start with $1. You borrow $99 and buy 1 share of ACME for $100. Your total stock value is $100, like before. But your net liquidating value will have to account for the $99 loan you received -- $100 in stock - $99 loan = $1 net liquidating value. Your leverage is 100x. When ACME goes to $110, you will have 10 times your original money, for returns of 1,000%.

While all three cases have very different returns, they also have very different leverage, and you can make sense of the portfolio returns versus the returns of ACME based on the leverage.

Here are a few other facts that can help build your intuition for leverage:

- Changes in the value of your stock positions will change your leverage. Above I calculated the leverage after the share of ACME is purchased.

- Changes in the amount of cash will change your leverage. Borrowing cash, receiving dividends, shorting stocks -- all change your leverage.

- A portfolio with leverage > 1 will tend to increase in leverage as the portfolio value falls, and decrease in leverage as the portfolio value rises.

- A portfolio with leverage < 1 will tend to decrease in leverage as the portfolio value falls, and increase in leverage as the portfolio value rises.

Lastly, I wanted to comment on Gary's request for the calculation of returns on the capital actually deployed in your positions. I think of the returns figure that Gary is describing as being per position. In a portfolio, you look at the returns for the portfolio as a whole, but you'll also want to see the returns for each individual position. If we had per position returns, all three examples above would show a 10% return on the position in ACME. That's very useful information, and I think it is a complement to the existing returns calculation.

thanks,

fawce