Portfolio Performance Object

class pyfolio_performance.PortfolioPerformanceObject[source]

Base class for most objects in the library. Offers basic functionality needed, such as: - cache of already parsed objects, - resolution of objects that are defined by references, - general parsing methods.

classmethod getObjectByAttribute(attr, value)[source]

Note it only works if there is a single object for the attribute and the value. For example, we can ask for the attribute isin of a security with the value DE0005190003 leading to BMW.

Parameters:
  • attr (str) – the attribute we are looknig for

  • value (str) – the value the attribute should have

Returns:

the store object for the value

Type:

object

classmethod parse(root, xml)[source]

This methods parses portfolio performance objects. It returns the parsed result of the referenced xml.

Parameters:
  • root (xml) – Root of the parsing, in case it is needed to resolve references.

  • xml (xml) – Object to be parsed.

Returns:

Parsed object.

Type:

Subclass of PortfolioPerformanceObject

classmethod parseByReference(root, reference)[source]

This methods resolves the attribute referenced. It returns the parsed result of the referenced xml.

Parameters:
  • root (xml) – Root from where the reference is searched in the XML.

  • reference (str) – Encoding of the reference

Returns:

Parsed object.

Type:

Subclass of PortfolioPerformanceObject