Skip to content
All library documents

Accounting for Short Sales in a Backtesting Ledger

Article Quant Q&A · Author: nijshar28

Summary

The document raises an accounting question about representing a short stock position in a backtesting system. It proposes tracking a credit balance, cash, and short market value when opening the position, under an assumed initial margin requirement, and asks how those balances should change when shares are bought back to close it.

The author suspects the closing entries are incomplete, especially because the cash balance does not change in the proposed treatment. No answer or corrected journal entries are included, so the document does not establish a general short-sale accounting method. Its value is as a modeling prompt: a simulator must consistently represent collateral, sale proceeds, the current market value of the liability, and the cash paid to cover, while keeping net account value coherent as prices move. Real brokerage rules and margin treatment may differ from the simplified account assumptions presented.

Key ideas

  • A short sale can be represented using separate cash, collateral or credit balance, and short market value accounts.
  • The proposed opening entries assume a specified initial margin requirement.
  • Closing the short requires accounting for the cash spent to repurchase the shares.
  • The document poses the ledger problem but does not provide a verified correction.
  • Backtests need consistent treatment of collateral, short liability value, and account equity.

Tags

Full text
# Modeling short-selling accounts


# Modeling short-selling accounts












I am having trouble modeling short selling mechanics in my backtesting system.

When I sell stock short, I make the following changed to account variables:

- Credit Balance += 200% of the stock value sold short (assuming a 100% initial margin requirement)

- Cash -= 100% of the stock value (the cash is transferred to the Credit Balance account to collaterize the short sale)

- Short Market Value (SMV) -= 100% of stock value (this is the market value of the shorted stock)

- Net Account Value += (Credit Balance + Short Market Value + Cash)

When I close out the short position later on, I change the accounts as follows:

- Credit Balance -= 100% of the stock value bought back

- Short Market Value (SMV) += 100% of stock value bought back

- Net Account Value += (Credit Balance + Short Market Value + Cash)

I am pretty sure this second part (closing out the short position) is wrong. At the very least, my cash position should also be affected. Any suggestions on how to fix it? Thank you.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.