Filters

class pyfolio_performance.Filters[source]

Class that provides usefull filtering functions for the cluster analysis.

static fAnd(f1, f2)[source]
Parameters:
  • f1 – First function.

  • f2 – Second function.

Type:

function entry -> bool

Type:

function entry -> bool

Returns:

Returns a function that first evaluates both functions and returns the and.

Type:

Entry -> bool

static fBefore(date)[source]
Parameters:

year (DateObject) – The date to filter for.

Returns:

A filter function that ensures the entry was made before or on the date (<=).

Type:

Entry -> bool

static fDay(day)[source]
Parameters:

day (int) – The day to filter for.

Returns:

A filter function that ensures the entry was made in the specified day.

Type:

Entry -> bool

static fDepotTransaction()[source]
Returns:

A filter function that ensures the entry is a Depot Transaction.

Type:

Entry -> bool

static fEnsureTypeList(typelist)[source]
Parameters:

typelist (list(str)) – List of types that are required by the filter.

Returns:

A filter function that ensures the entry has a type contained in the typelist.

Type:

Entry -> bool

static fExcludeTypeList(typelist)[source]
Parameters:

typelist (list(str)) – List of types that are not allowed by the filter.

Returns:

A filter function that ensures the entry has not a type contained in the typelist.

Type:

Entry -> bool

static fMonth(month)[source]
Parameters:

month (int) – The month to filter for.

Returns:

A filter function that ensures the entry was made in the specified month.

Type:

Entry -> bool

static fOr(f1, f2)[source]
Parameters:
  • f1 – First function.

  • f2 – Second function.

Type:

function entry -> bool

Type:

function entry -> bool

Returns:

Returns a function that first evaluates both functions and returns the or.

Type:

Entry -> bool

static fSecurityTransaction(sec)[source]
Parameters:

sec (Security) – A security to filter for.

Returns:

A filter function that ensures the entry is a transaction about the given security.

Type:

Entry -> bool

static fYear(year)[source]
Parameters:

year (int) – The year to filter for.

Returns:

A filter function that ensures the entry was made in the specified year.

Type:

Entry -> bool