API documentation for tradeexecutor.strategy.qstrader.order_sizer.CashBufferedOrderSizer Python class in Trading Strategy framework.

class CashBufferedOrderSizer[source]#

Bases: OrderSizer

Creates a target portfolio of quantities for each Asset using its provided weight and total equity available in the Broker portfolio.

Includes an optional cash buffer due to the non-fractional amount of share/unit sizes. The cash buffer defaults to 5% of the total equity, but can be modified.

cash_buffer_percentagefloat, optional

The percentage of the portfolio equity to retain in cash to avoid generating Orders that exceed account equity (assuming no margin available).

__init__(state, pricing_model, cash_buffer_percentage=0.05)[source]#


__init__(state, pricing_model[, ...])

__init__(state, pricing_model, cash_buffer_percentage=0.05)[source]#
__call__(dt, weights, debug_details)[source]#

Creates a dollar-weighted cash-buffered target portfolio from the provided target weights at a particular timestamp.


The current date-time timestamp.

weightsdict{Asset: float}

The (potentially unnormalised) target weights.

Return type:

Tuple[Dict, Dict]