Skip to content
Discussion options

You must be logged in to vote

My reading of that docs sentence is:

size=0.02 means "use 2% of current available liquidity for this order", not "risk 2% of account equity" and not necessarily "buy 2% of starting cash".

Available liquidity is roughly:

cash + current unrealized P/L - margin already used

So open positions can affect it in two ways:

  • their unrealized P/L changes the liquidity/equity available for new fractional-size orders;
  • their used margin reduces what is available for additional orders.

But the market value of an existing open position is not simply treated as free cash that can be reused. If you already have a position open and submit another self.buy(size=0.02), Backtesting.py will size that new orde…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kernc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants