Position Sizers
Positon sizers are crucial for managing risk and optimising your returns in trading. They determine how much capital to allocate to each trade based on various factors such as risk tolerance, account size, and market conditions.
Of course, the naive way to size a position in Dejavu is to use the buy() and sell() methods without any arguments,
which will default to buying or selling one unit of the asset. However, this approach does not take into account
the size of your account or the risk associated with the trade.
Here are some common types of position sizers:
dejavu.strategy.sizers.fixed.FixedUnits
¶
dejavu.strategy.sizers.fixed.FixedDollar
¶
Bases: PositionSizer
Similar to FixedUnits, this is a basic position sizer, and it simply allocates how much capital (money) to
allocate to a single trade.
dejavu.strategy.sizers.risk.PercentRisk
¶
Bases: PositionSizer
Risk a fixed % of equity per trade. Requires a stop_distance kwarg (e.g. 1 ATR or a fixed $ stop).
qty = (equity * risk_pct) / stop_distance