BasketConfig

BasketConfig#

class sigtech.framework.strategies.basket_config.BasketConfig

Baseclasses: FrameworkObject

Wrapper for discretionary strategy inputs.

This class is supposed to be a general class for strategy configuration, but at the moment it’s only being used for strategies.flexible_basket.FlexibleBasket.

Once another Config use-case comes along, you’ll want to factor out all methods (except _invent_sector and _invent_ticker) into a subclass, something like

input_dict: dict
static allocation_eq(left_alloc, right_alloc)

Compare two (allocation_type, allocation_list) pairs.

Allocation lists with the same values but different ordering are considered equal.

Parameters:
  • left_alloc – First allocation pair.

  • right_alloc – Second allocation pair.

Returns:

bool.

as_timeseries()

Return a time-series version of the full allocation.

full_allocation()

Calculate the fully-specified allocation from _selective (diff-style) allocation types.

get()

Currently, the input_dict is stored in ‘row-orientation’. Convert it to column-orientation.

replace_ticker(old_ticker, new_ticker)

Update a copy of the input_dict, replacing ticker, validate, then replace if passes.

Parameters:
  • old_ticker – Old ticker to replace.

  • new_ticker – Replacement ticker.

save_csv(output_filepath=None)

Create a CSV suitable for processing by sigtech.framework.tasks.static_changes.static_changes_handler.process_single_file().

update_allocation_for_date(date, allocation_type, allocation_list)

Update a copy of the input_dict, validate, then replace if passes.

Parameters:
  • allocation_type – One of 'weight', 'weight_selective', 'variance_allocation' or 'variance_allocation_selective'.

  • allocation_list – e.g. [(0.1,  'STRAT1 STRATEGY'), (0.05, 'STRAT2 STRATEGY')].