openseries package
The openseries package provides two main classes for financial time series analysis:
OpenTimeSeries: For single financial time series analysis
OpenFrame: For multi-asset portfolio analysis and comparison
Both classes inherit from the private _CommonModel class, which in turn inherits from Pydantic’s BaseModel. This inheritance structure provides:
Data validation through Pydantic’s validation system
Common functionality shared between both classes (risk metrics, plotting, data handling)
Type safety and consistent API design
The _CommonModel class contains all the shared methods and properties that both OpenTimeSeries and OpenFrame use, including risk calculations, plotting capabilities, and data manipulation functions.
Main Classes
|
OpenTimeSeries objects are at the core of the openseries package. |
|
OpenFrame objects hold OpenTimeSeries in the list constituents. |
Utility Functions
|
Chain two timeseries together. |
|
Generate a responsive HTML report page with line and bar plots and a table. |
Portfolio Tools
|
Identify an efficient frontier. |
|
Generate random weights for simulated portfolios. |
|
Constrain optimized portfolios to those that improve on the current one. |
|
Prepare data to be used as point_frame in the sharpeplot function. |
|
Create scatter plot coloured by Sharpe Ratio. |
Date Utilities
|
Parse different date formats into datetime.date. |
|
Offset dates according to a given calendar. |
|
Generate a list of business day calendar dates. |
|
Bump date backwards to find the previous business day. |
|
Generate a business calendar. |
|
Bump date by business days. |
Simulation
|
The class ReturnSimulation allows for simulating financial timeseries. |
Types and Enums
|
Enum types of OpenTimeSeries to identify the output. |
Other Utilities
|
Load Plotly defaults. |
|
Export a Plotly figure to a mobile-responsive HTML file or inline div. |