investos.portfolio.cost_model package

Submodules

investos.portfolio.cost_model.base_cost module

class investos.portfolio.cost_model.base_cost.BaseCost(**kwargs)

Bases: object

Base cost model for InvestOS. Other cost models should subclass BaseCost. The only requirement of custom cost models is that they (re)implement value_expr().

actual_cost(t: datetime, h_plus: Series, u: Series) Series
metadata_dict()
weight_expr(t, w_plus, z, value, asset_idx)

investos.portfolio.cost_model.short_holding_cost module

class investos.portfolio.cost_model.short_holding_cost.ShortHoldingCost(short_rates, **kwargs)

Bases: BaseCost

Calculates cost for holding short positions, given customizable short_rate.

get_actual_cost(t: datetime, h_plus: Series, u: Series) Series

Method that calculates per-period (short position) holding costs given period t holdings and trades.

Parameters:
  • t (datetime.datetime) – The datetime for associated trades u and holdings plus trades h_plus.

  • h_plus (pandas.Series) – Holdings at beginning of period t, plus trades for period t (u). Same as u + h for t.

  • u (pandas.Series) – Trades (as values) for period t.

investos.portfolio.cost_model.trading_cost module

class investos.portfolio.cost_model.trading_cost.TradingCost(forecast_volume, actual_prices, **kwargs)

Bases: BaseCost

Calculates per period cost for trades u, based on spread, standard deviation, volume, and price.

Actual t-cost calculation based on AQR’s research on market impact for live trades from their execution database between 1998 and 2016 (Figure 5):

Frazzini, Andrea and Israel, Ronen and Moskowitz, Tobias J. and Moskowitz, Tobias J., Trading Costs (April 7, 2018). Available at SSRN: https://ssrn.com/abstract=3229719

sensitivity_coeff

For scaling volume-based transaction cost component. Does not impact spread related costs.

Type:

float

get_actual_cost(t: datetime, h_plus: Series, u: Series) Series