US Equity

Shorting

Introduction

In a regular long position, you buy shares and then sell them later to close the trade. In a short position, you borrow shares, sell them, and then buy the shares back later to close the trade. Short positions let you profit when a security's price decreases while you have the position open, but there are risks involved. For example, you can get a margin call and you may incur borrowing costs.

Holdings Accounting

If you have an open long position, your portfolio has a positive quantity of shares for that security. In contrast, if you have an open short position, your portfolio has a negative quantity of shares for that security.

Short Availability

To short sell, you need to borrow the shares from another investor or your brokerage. The short availability is the number of shares available for you to borrow. If you don't model the short availability in backtests, you could have a strategy that performs well in backtesting but doesn't trade in live mode because the shares aren't available to borrow. If you assume your short orders are successful in backtests, your backtesting results likely won't represent the true performance of actually trading the strategy during the backtest period. To get the short availability in your algorithms, use the US Equities Short Availability dataset. For more information about this topic, see Short Availability.

Borrowing Costs

In live trading, you usually pay a fee to borrow shares that you use to open a short position. Part of the fee goes to the investor that provided you with the opportunity to short with their shares. The borrowing rate is set by your live brokerage. In backtests, LEAN doesn't currently model borrowing costs, but we have an open GitHub Issue to add the functionality. Subscribe to GitHub Issue #4563 to track the feature progress.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: