pmorissette / bt

bt - flexible backtesting for Python
http://pmorissette.github.io/bt
MIT License
2.1k stars 408 forks source link

Modelling rent from real estate #364

Open TAndronicus opened 2 years ago

TAndronicus commented 2 years ago

How do you model a real estate that you rent? I'd like to have it as a separate strategy and not CashFlow, because the frequency of payments should be independent from the rest of the strategy, so I'd like to use it as a child to update the capital. I don't want to buy more units of it or invest in it anyhow. It's value also does not matter. If I make it a FixedIncomeStrategy, I'm getting the following excpetion when trying to use it as a child strategy:

ValueError: Cannot have fixed income strategy child (inflow) of non-fixed income strategy (umb)

Here's my attempt:

inflow = bt.FixedIncomeStrategy(
    "inflow",
    [bt.algos.SelectAll(),
     bt.algos.WeighEqually(),
     bt.algos.RunMonthly(),
     bt.algos.CapitalFlow(2000),
     bt.algos.Rebalance()],
    [bt.core.FixedIncomeSecurity("Inflow source")]
)

This could also be considered a model of the salary inflows.

TAndronicus commented 1 year ago

Does anyone maintain this lib?

timkpaine commented 1 year ago

Yes

TAndronicus commented 1 year ago

image_2022-08-21_112732662