detquantlib 2.0.6__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: detquantlib
3
- Version: 2.0.6
3
+ Version: 2.1.0
4
4
  Summary: An internal library containing functions and classes that can be used across Quant models.
5
5
  Author: DET
6
6
  Requires-Python: >=3.10,<4.0
@@ -62,6 +62,35 @@ def save_plotly_fig_to_json(
62
62
  f.write(fig_json)
63
63
 
64
64
 
65
+ def save_plotly_fig_to_html(
66
+ fig: go.Figure,
67
+ filename: str,
68
+ folder_dir: Path = get_default_plotly_folder_dir(),
69
+ standard_layout: bool = True,
70
+ ):
71
+ """
72
+ Saves a plotly figure object to an html file.
73
+
74
+ Args:
75
+ fig: Plotly figure
76
+ filename: Name of html file in which plotly figure will be saved
77
+ folder_dir: Folder directory where the html file will be saved
78
+ standard_layout: If true, enforces a standard plotly layout
79
+ """
80
+ # Create plotly folder if it doesn't exist yet
81
+ folder_dir.mkdir(parents=True, exist_ok=True)
82
+
83
+ # Define html file directory
84
+ file_dir = folder_dir.joinpath(f"{filename}.html")
85
+
86
+ # Adjust figure layout
87
+ if standard_layout:
88
+ fig = set_standard_layout(fig)
89
+
90
+ # Save figure to html
91
+ fig.write_html(file_dir)
92
+
93
+
65
94
  def show_plotly_fig_json(filename: str, folder_dir: Path = get_default_plotly_folder_dir()):
66
95
  """
67
96
  Short helper function to display a plotly figure stored in a json file.
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "detquantlib"
3
- version = "2.0.6"
3
+ version = "2.1.0"
4
4
  description = "An internal library containing functions and classes that can be used across Quant models."
5
5
  authors = ["DET"]
6
6
  readme = "README.md"
File without changes
File without changes