-
When setting a value like
I think this will have impact on how the ratios like the Sharpe are being calculated. TIA and cheers, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The position size depends on whether the size function is used in self.buy() or self.sell(). For example, if you use self.buy(size=0.63), it means you are trading 0.63 times the available cash in your account. |
Beta Was this translation helpful? Give feedback.
Setting
cash=10000
simply initializes the account with $10,000 at the start. As the account balance changes, the amount of capital/size used for each trade is controlled byself.buy(size=...)
.If you want to trade with $10,000 each time, I haven't tried that (since using a percentage of the account balance for trading seems more reasonable than a fixed amount as the account balance increases).
However, I guess we can use the closing price of the previous bar to calculate the number of shares that can be bought with 10,000, and then put that into self.buy(size=...). Although there may be some discrepancies, it should be close to trading with 10,000.
Day 0: Cash = 10000
Day 1: self.buy() Ca…