For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Portfolio/Inventory Management

  • Hi,

    Many thanks for this great tool. I would like to create multiple strategies that operate concurrently on one or multiple asset by e.g. looking at triggers in different timeframes. Ideally, an independent entity should authorize/modify the incoming orders to net orders and enforce some risk management constraints (e.g. margins, Portfolio VaR, ...). If I understand it correctly, a strategy's sizer does not take into consideration open positions in the same or different assets.
    Do you have plans to add portfolio management functionality to backtrader? Would someone else find this useful?

  • administrators


    • Using multiple strategies is posible
    • Multiple assets and multiple timeframes too

    A sizer can be used as a portfolio manager in the sense that it can:

    • Modify and even invalidate (not authorize) an order by returning the size, which can be 0.
    • The sizer has access to the strategy in which is running and the associated broker and with it to the universe of assets and for example net liquidation value

    This means complex logic can be implemented to support the mentioned criteria: Margins, Var.

    What a sizer cannot do:

    • Order issuing. This logic is supposed to take place before the sizer is consulted
    • Re-balancing of portfolios for example

    A fully fledged portfolio manager would require development (not light for sure) and popular support (or other art of) for such a feature would be needed.

  • Portfolio manager would be cool. This is one area that I find zipline is ahead. Not sure what features a full fledged portfolio manager would have, but even simple features like initial multiple assets portfolio-optimization-based sizer would be quite useful.

  • It would be really cool. For me to move to backtrader, I would really like this kind of functionality so I can implement some of my portfolio strategies (portfolio allocation).