The cash, or None if none is recorded; it includes short sale proceeds.
position
Context.position(symbol)
The net quantity held of a symbol.
Parameters
Name
Type
Description
Default
symbol
str
One of the replay’s symbols.
required
Returns
Name
Type
Description
float
Shares held, 0 when none, negative for a short.
target
Context.target(symbol, quantity)
Hold a number of shares of a symbol.
The runner sends the orders the difference from the current position and working orders needs; a target set at a bar’s close fills at the next bar’s open (with fill="decision-close", at the symbol’s last observed close when the target was set; with fill="next-close", at the next bar’s close).
Parameters
Name
Type
Description
Default
symbol
str
One of the replay’s symbols.
required
quantity
int
The shares to hold; 0 closes the position. Below zero is a short position, refused (quantity_not_sellable) unless the replay was made with shorts=True; the whole sale is refused, so a long position is not closed either.