mhallsmoore / qstrader

QuantStart.com - QSTrader backtesting simulation engine.
https://www.quantstart.com/qstrader/
MIT License
2.88k stars 856 forks source link

Transaction costs calculation results in leveraging #259

Closed proskurin closed 7 months ago

proskurin commented 6 years ago

Due to the fact that cash levels can be negative in QsTrader, we have leveraging effect when transaction costs are included. For example, we have 100 000 USD in initial equity and I want to buy 1000 of shares with price of 100 and transaction costs of 1$ per share. QsTrader will let you buy shares for 100 000 USD = 1000 100 and with transaction costs of 1000 = 1000 1$. As a result, cash level will be: 100000(initial equity) - 100000(shares) - 1000 (transaction costs) = - 1000 USD

JamesKBowler commented 6 years ago

213