Using cost models is simple!
You simply pass instantiated cost model instances into your desired investment strategy:
from investos.portfolio.strategy import YourDesiredStrategy strategy = YourDesiredStrategy( actual_returns = actual_returns, ..., costs=[ CostModelA(*args, **kwargs), CostModelB(*args, **kwargs) ], )
and that's it!
All cost models take the following optional arguments:
InvestOS provides the following cost models:
ShortHoldingCost calculates per period cost for holding short positions, given customizable short_rate.
To instantiate ShortHoldingCost you will need to set the following arguments:
TradingCost calculates per period cost for trades based on forecast spreads, standard deviations, volumes, and actual prices.
To instantiate TradingCost you will need to set the following arguments:
Want to explore creating your own custom cost model? Check out Custom Cost Models.
Want to learn more about using constraint models? Check out Constraint Models.