tesorotools-python 0.0.8__tar.gz → 0.0.10__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.
- {tesorotools_python-0.0.8 → tesorotools_python-0.0.10}/PKG-INFO +1 -1
- {tesorotools_python-0.0.8 → tesorotools_python-0.0.10}/pyproject.toml +6 -3
- tesorotools_python-0.0.10/tesorotools/__init__.py +6 -0
- tesorotools_python-0.0.10/tesorotools/artists/line_plot.py +243 -0
- tesorotools_python-0.0.10/tesorotools/assets/fonts/CabinetGrotesk-Black.otf +0 -0
- tesorotools_python-0.0.10/tesorotools/assets/fonts/CabinetGrotesk-Bold.otf +0 -0
- tesorotools_python-0.0.10/tesorotools/assets/fonts/CabinetGrotesk-Extrabold.otf +0 -0
- tesorotools_python-0.0.10/tesorotools/assets/fonts/CabinetGrotesk-Extralight.otf +0 -0
- tesorotools_python-0.0.10/tesorotools/assets/fonts/CabinetGrotesk-Light.otf +0 -0
- tesorotools_python-0.0.10/tesorotools/assets/fonts/CabinetGrotesk-Medium.otf +0 -0
- tesorotools_python-0.0.10/tesorotools/assets/fonts/CabinetGrotesk-Regular.otf +0 -0
- tesorotools_python-0.0.10/tesorotools/assets/fonts/CabinetGrotesk-Thin.otf +0 -0
- tesorotools_python-0.0.8/README.md +0 -55
- tesorotools_python-0.0.8/examples/README.md +0 -24
- tesorotools_python-0.0.8/examples/barh_plots.yaml +0 -202
- tesorotools_python-0.0.8/examples/data.yaml +0 -4
- tesorotools_python-0.0.8/examples/dependencies.yaml +0 -162
- tesorotools_python-0.0.8/examples/line_plots.yaml +0 -57
- tesorotools_python-0.0.8/examples/offsets.yaml +0 -17
- tesorotools_python-0.0.8/examples/tables.yaml +0 -457
- tesorotools_python-0.0.8/examples/template.yaml +0 -34
- tesorotools_python-0.0.8/examples/type_curves.yaml +0 -88
- tesorotools_python-0.0.8/src/tesorotools/artists/line_plot.py +0 -114
- tesorotools_python-0.0.8/src/tesorotools/utils/__init__.py +0 -0
- tesorotools_python-0.0.8/src/tesorotools_python.egg-info/PKG-INFO +0 -9
- tesorotools_python-0.0.8/src/tesorotools_python.egg-info/SOURCES.txt +0 -31
- tesorotools_python-0.0.8/src/tesorotools_python.egg-info/dependency_links.txt +0 -1
- tesorotools_python-0.0.8/src/tesorotools_python.egg-info/requires.txt +0 -6
- tesorotools_python-0.0.8/src/tesorotools_python.egg-info/top_level.txt +0 -1
- {tesorotools_python-0.0.8 → tesorotools_python-0.0.10}/.gitignore +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/artists/__init__.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/artists/barh_plot.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/artists/table.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/artists/type_curve.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/assets/README.md +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/assets/fonts/README.md +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/assets/plots.yaml +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/assets/tesoro.mplstyle +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/convert.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/data_sources/README.md +0 -0
- {tesorotools_python-0.0.8/src/tesorotools → tesorotools_python-0.0.10/tesorotools/data_sources}/__init__.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/data_sources/debug.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/data_sources/lseg.py +0 -0
- {tesorotools_python-0.0.8/src/tesorotools/data_sources → tesorotools_python-0.0.10/tesorotools/database}/__init__.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/database/push.py +0 -0
- {tesorotools_python-0.0.8/src/tesorotools/database → tesorotools_python-0.0.10/tesorotools/dependencies}/__init__.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/dependencies/functions.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/dependencies/node.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/dependencies/resolution.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/main.py +0 -0
- {tesorotools_python-0.0.8/src/tesorotools/dependencies → tesorotools_python-0.0.10/tesorotools/offsets}/__init__.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/offsets/offsets.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/offsets/outliers.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/render/__init__.py +0 -0
- {tesorotools_python-0.0.8/src/tesorotools/offsets → tesorotools_python-0.0.10/tesorotools/render/content}/__init__.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/render/content/content.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/render/content/images.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/render/content/section.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/render/content/table.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/render/headline.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/render/introduction.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/render/report.py +0 -0
- {tesorotools_python-0.0.8/src/tesorotools/render/content → tesorotools_python-0.0.10/tesorotools/utils}/__init__.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/utils/config.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/utils/globals.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/utils/matplotlib.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/utils/series.py +0 -0
- {tesorotools_python-0.0.8/src → tesorotools_python-0.0.10}/tesorotools/utils/template.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "tesorotools-python"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.10"
|
|
4
4
|
dependencies = ["psycopg2", "SQLAlchemy", "pandas", "matplotlib", "pyarrow", "python-docx", "openpyxl", "PyYAML", "babel", "eikon", "lseg-data"]
|
|
5
5
|
|
|
6
6
|
[build-system]
|
|
@@ -9,5 +9,8 @@ build-backend = "hatchling.build"
|
|
|
9
9
|
|
|
10
10
|
[tool.hatch.build.targets.wheel]
|
|
11
11
|
packages = ["src/tesorotools"]
|
|
12
|
-
artifacts = ["
|
|
13
|
-
|
|
12
|
+
artifacts = ["src/tesorotools/assets/fonts/*.otf"]
|
|
13
|
+
|
|
14
|
+
[tool.hatch.build.targets.sdist]
|
|
15
|
+
packages = ["src/tesorotools"]
|
|
16
|
+
artifacts = ["src/tesorotools/assets/fonts/*.otf"]
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
from tesorotools.artists.line_plot import Format, Legend, LinePlot
|
|
2
|
+
from tesorotools.utils.config import TemplateLoader
|
|
3
|
+
|
|
4
|
+
TemplateLoader.add_constructor("!line_plot", LinePlot.from_yaml)
|
|
5
|
+
TemplateLoader.add_constructor("!format", Format.from_yaml)
|
|
6
|
+
TemplateLoader.add_constructor("!legend", Legend.from_yaml)
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import locale
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, Self
|
|
5
|
+
|
|
6
|
+
import matplotlib.pyplot as plt
|
|
7
|
+
import pandas as pd
|
|
8
|
+
from matplotlib.ticker import FuncFormatter
|
|
9
|
+
from yaml.nodes import MappingNode
|
|
10
|
+
|
|
11
|
+
from tesorotools.utils.config import TemplateLoader
|
|
12
|
+
|
|
13
|
+
locale.setlocale(locale.LC_ALL, "")
|
|
14
|
+
|
|
15
|
+
from tesorotools.utils.globals import DEBUG
|
|
16
|
+
from tesorotools.utils.matplotlib import (
|
|
17
|
+
PLOT_CONFIG,
|
|
18
|
+
format_annotation,
|
|
19
|
+
load_fonts,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
load_fonts()
|
|
23
|
+
|
|
24
|
+
LINE_PLOT_CONFIG: dict[str, Any] = PLOT_CONFIG["line"]
|
|
25
|
+
AX_CONFIG: dict[str, Any] = PLOT_CONFIG["ax"]
|
|
26
|
+
FIG_CONFIG: dict[str, Any] = PLOT_CONFIG["figure"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _style_spines(
|
|
30
|
+
ax: plt.Axes,
|
|
31
|
+
decimals: int,
|
|
32
|
+
units: str,
|
|
33
|
+
*,
|
|
34
|
+
color: str,
|
|
35
|
+
linewidth: str,
|
|
36
|
+
):
|
|
37
|
+
ax.grid(visible=True, axis="y")
|
|
38
|
+
for spine in ax.spines.values():
|
|
39
|
+
spine.set_color(color)
|
|
40
|
+
spine.set_linewidth(linewidth)
|
|
41
|
+
ax.yaxis.tick_right()
|
|
42
|
+
ax.yaxis.set_major_formatter(
|
|
43
|
+
FuncFormatter(lambda y, _: format_annotation(y, decimals, units))
|
|
44
|
+
)
|
|
45
|
+
ax.set_xlabel("")
|
|
46
|
+
|
|
47
|
+
ax.tick_params(which="minor", size=0, width=0)
|
|
48
|
+
ax.tick_params(axis="both", which="major")
|
|
49
|
+
for tick in ax.get_xticklines():
|
|
50
|
+
tick.set_markeredgecolor(color)
|
|
51
|
+
for tick in ax.get_yticklines():
|
|
52
|
+
tick.set_markeredgecolor(color)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _style_baseline(ax: plt.Axes, reference: float = 0, **baseline_config):
|
|
56
|
+
color: str = baseline_config["color"]
|
|
57
|
+
bottom_lim, top_lim = ax.get_ylim()
|
|
58
|
+
ax.set_ylim(bottom=min(reference, bottom_lim), top=max(reference, top_lim))
|
|
59
|
+
bottom_lim, top_lim = ax.get_ylim()
|
|
60
|
+
if bottom_lim == reference:
|
|
61
|
+
ax.spines["bottom"].set_edgecolor(color)
|
|
62
|
+
elif top_lim == reference:
|
|
63
|
+
ax.spines["top"].set_edgecolor(color)
|
|
64
|
+
else:
|
|
65
|
+
ax.axhline(y=reference, **baseline_config)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def plot_line_chart(
|
|
69
|
+
out_name: Path,
|
|
70
|
+
data: pd.DataFrame,
|
|
71
|
+
*,
|
|
72
|
+
base_100: bool,
|
|
73
|
+
annotate: bool,
|
|
74
|
+
format: dict[str, Any],
|
|
75
|
+
**kwargs,
|
|
76
|
+
):
|
|
77
|
+
if base_100:
|
|
78
|
+
data = data / data.iloc[0, :] * 100
|
|
79
|
+
if format["units"] == "p.b.":
|
|
80
|
+
data = data * 100
|
|
81
|
+
fig = plt.figure(**FIG_CONFIG)
|
|
82
|
+
ax = fig.add_subplot()
|
|
83
|
+
data.plot(ax=ax)
|
|
84
|
+
if annotate:
|
|
85
|
+
pass
|
|
86
|
+
|
|
87
|
+
reference = 100 if base_100 else 0
|
|
88
|
+
_style_spines(ax, **format, **AX_CONFIG["spines"])
|
|
89
|
+
_style_baseline(ax, reference, **AX_CONFIG["baseline"])
|
|
90
|
+
ax.legend(
|
|
91
|
+
loc="upper center",
|
|
92
|
+
bbox_to_anchor=(0.5, LINE_PLOT_CONFIG["legend_sep"]),
|
|
93
|
+
ncol=(
|
|
94
|
+
kwargs["legend"]["ncol"]
|
|
95
|
+
if kwargs is not None and kwargs.get("legend", None) is not None
|
|
96
|
+
else LINE_PLOT_CONFIG["ncol"]
|
|
97
|
+
),
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
fig.savefig(out_name)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def plot_line_charts(data: pd.DataFrame, config_dicts: dict[str, Any]):
|
|
104
|
+
for name, config in config_dicts.items():
|
|
105
|
+
start_date: pd.Timestamp = pd.to_datetime(config["start_date"])
|
|
106
|
+
end_date_str: str | None = config["end_date"]
|
|
107
|
+
end_date: pd.Timestamp = (
|
|
108
|
+
data.index.max()
|
|
109
|
+
if end_date_str is None
|
|
110
|
+
else pd.to_datetime(end_date_str)
|
|
111
|
+
)
|
|
112
|
+
series: dict[str, str] = config["series"]
|
|
113
|
+
trimmed_data: pd.DataFrame = data.loc[
|
|
114
|
+
slice(start_date, end_date), series.keys()
|
|
115
|
+
]
|
|
116
|
+
trimmed_data = trimmed_data.rename(columns=series)
|
|
117
|
+
out_name: Path = DEBUG / "line" / f"{name}.png"
|
|
118
|
+
plot_line_chart(out_name, trimmed_data, **config)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class Format:
|
|
122
|
+
def __init__(self, units: str = "", decimals: int = 0):
|
|
123
|
+
self.units = units
|
|
124
|
+
self.decimals = decimals
|
|
125
|
+
|
|
126
|
+
@classmethod
|
|
127
|
+
def from_yaml(cls, loader: TemplateLoader, node: MappingNode) -> Self:
|
|
128
|
+
loader.flatten_mapping(node)
|
|
129
|
+
format_cfg: dict[str, Any] = loader.construct_mapping(node, deep=True)
|
|
130
|
+
format_cfg.pop("id")
|
|
131
|
+
return cls(**format_cfg)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class Legend:
|
|
135
|
+
def __init__(self, ncol: int = 5, sep: float = -0.125):
|
|
136
|
+
self.ncol = ncol
|
|
137
|
+
self.sep = sep
|
|
138
|
+
|
|
139
|
+
@classmethod
|
|
140
|
+
def from_yaml(cls, loader: TemplateLoader, node: MappingNode) -> Self:
|
|
141
|
+
legend_cfg: dict[str, Any] = loader.construct_mapping(node, deep=True)
|
|
142
|
+
legend_cfg.pop("id")
|
|
143
|
+
return cls(**legend_cfg)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
# as more stuff is needed, seems wise to make a class
|
|
147
|
+
class LinePlot:
|
|
148
|
+
def __init__(
|
|
149
|
+
self,
|
|
150
|
+
out_path: Path,
|
|
151
|
+
data_path: Path,
|
|
152
|
+
series: dict[str, str],
|
|
153
|
+
scale: float = 1,
|
|
154
|
+
start_date: datetime.datetime | None = None,
|
|
155
|
+
end_date: datetime.datetime | None = None,
|
|
156
|
+
base_100: bool = False,
|
|
157
|
+
annotate: bool = False,
|
|
158
|
+
baseline: bool = False,
|
|
159
|
+
format: Format | None = None,
|
|
160
|
+
legend: Legend | None = None,
|
|
161
|
+
) -> None:
|
|
162
|
+
|
|
163
|
+
if out_path.suffix != ".png":
|
|
164
|
+
raise ValueError(f"The out file {out_path} should be a .png file")
|
|
165
|
+
self.out_path = out_path
|
|
166
|
+
|
|
167
|
+
if data_path.suffix != ".feather":
|
|
168
|
+
raise ValueError(
|
|
169
|
+
f"The data file {data_path} must be a .feather file"
|
|
170
|
+
)
|
|
171
|
+
self.data = pd.read_feather(data_path)
|
|
172
|
+
|
|
173
|
+
self.base_100 = base_100
|
|
174
|
+
self.annotate = annotate # unused for the moment
|
|
175
|
+
self.format = format
|
|
176
|
+
self.start_date = start_date
|
|
177
|
+
self.end_date = end_date
|
|
178
|
+
self.series = series
|
|
179
|
+
self.legend = legend
|
|
180
|
+
self.baseline = baseline
|
|
181
|
+
self.scale = scale
|
|
182
|
+
|
|
183
|
+
@classmethod
|
|
184
|
+
def from_yaml(cls, loader: TemplateLoader, node: MappingNode) -> Self:
|
|
185
|
+
line_plot_cfg: dict[str, Any] = loader.construct_mapping(
|
|
186
|
+
node, deep=True
|
|
187
|
+
)
|
|
188
|
+
line_plot_cfg.pop("id")
|
|
189
|
+
line_plot_cfg["out_path"] = Path(line_plot_cfg["out_path"])
|
|
190
|
+
line_plot_cfg["data_path"] = Path(line_plot_cfg["data_path"])
|
|
191
|
+
return cls(**line_plot_cfg)
|
|
192
|
+
|
|
193
|
+
def plot(self) -> plt.Axes:
|
|
194
|
+
start_date: pd.Timestamp = (
|
|
195
|
+
self.data.index.min()
|
|
196
|
+
if self.start_date is None
|
|
197
|
+
else pd.to_datetime(self.start_date)
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
end_date: pd.Timestamp = (
|
|
201
|
+
self.data.index.max()
|
|
202
|
+
if self.end_date is None
|
|
203
|
+
else pd.to_datetime(self.end_date)
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
plot_data: pd.DataFrame = self.data.loc[
|
|
207
|
+
slice(start_date, end_date), self.series.keys()
|
|
208
|
+
]
|
|
209
|
+
plot_data = plot_data.rename(columns=self.series)
|
|
210
|
+
|
|
211
|
+
plot_data = plot_data * self.scale
|
|
212
|
+
|
|
213
|
+
if self.base_100: # maybe more flexible in the future
|
|
214
|
+
plot_data = plot_data / plot_data.iloc[0, :] * 100
|
|
215
|
+
|
|
216
|
+
fig = plt.figure(**FIG_CONFIG)
|
|
217
|
+
ax = fig.add_subplot()
|
|
218
|
+
plot_data.plot(ax=ax)
|
|
219
|
+
|
|
220
|
+
if self.annotate: # not implemented yet
|
|
221
|
+
pass
|
|
222
|
+
|
|
223
|
+
_style_spines( # maybe make this function accept a Format object
|
|
224
|
+
ax,
|
|
225
|
+
decimals=self.format.decimals,
|
|
226
|
+
units=self.format.units,
|
|
227
|
+
**AX_CONFIG["spines"],
|
|
228
|
+
)
|
|
229
|
+
if self.baseline:
|
|
230
|
+
reference = 100 if self.base_100 else 0
|
|
231
|
+
_style_baseline(ax, reference, **AX_CONFIG["baseline"])
|
|
232
|
+
|
|
233
|
+
if self.legend is not None:
|
|
234
|
+
ax.legend(
|
|
235
|
+
loc="upper center",
|
|
236
|
+
bbox_to_anchor=(0.5, LINE_PLOT_CONFIG["legend_sep"]),
|
|
237
|
+
ncol=self.legend.ncol,
|
|
238
|
+
)
|
|
239
|
+
else:
|
|
240
|
+
ax.legend().set_visible(False)
|
|
241
|
+
|
|
242
|
+
fig.savefig(self.out_path)
|
|
243
|
+
return ax
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# Especificación de un documento
|
|
2
|
-
|
|
3
|
-
## Generar los *assets* de un semanal (fase de transición)
|
|
4
|
-
1. Poner en la carpeta [debug](debug) el archivo [flash.feather](debug/flash.feather) generado por el *script* `generar_semanal.py` de `dev2`. Será necesario cambiar a la rama `semanal` con un `git switch semanal`. Recordar revertir este cambio.
|
|
5
|
-
2. `python -m tesorotools.convert`
|
|
6
|
-
3. `python -m tesorotools.main`
|
|
7
|
-
|
|
8
|
-
## Plantilla
|
|
9
|
-
|
|
10
|
-
- Debe ser un archivo `.yaml`
|
|
11
|
-
- Si no se especifica nada, el programa buscará un archivo llamado `template.yaml` en la carpeta desde donde se esté ejecutando. En caso de no encontrarlo, lanzará un error.
|
|
12
|
-
|
|
13
|
-
### Headline
|
|
14
|
-
*Opcional*. Consta de dos entradas, también *opcionales* `title` y `comment`.
|
|
15
|
-
|
|
16
|
-
#### Ejemplo
|
|
17
|
-
```yaml
|
|
18
|
-
headline:
|
|
19
|
-
title: Apertura
|
|
20
|
-
comment: El precio del chocolate con almendras se dispara
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Se renderizará en el estilo `Title` o `Título` del documento base de word proporcionado.
|
|
24
|
-
|
|
25
|
-
### Introduction
|
|
26
|
-
*Opcional*. Consta de dos entradas, también *opcionales* `date` y `hour`.
|
|
27
|
-
|
|
28
|
-
- `date`: Fecha en formato `AAAA-MM-DD`, con o sin comillas.
|
|
29
|
-
- `hour`: Hora en formato `HH:MM`, **siempre** entre comillas.
|
|
30
|
-
|
|
31
|
-
#### Ejemplo
|
|
32
|
-
```yaml
|
|
33
|
-
introduction:
|
|
34
|
-
date: 2025-01-31
|
|
35
|
-
hour: "15:30"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
La fecha se renderizará en el estilo `Subtitle` o `Subtítulo` del documento base de word proporcionado.
|
|
39
|
-
|
|
40
|
-
# Descripción de la estructura y el funcionamiento
|
|
41
|
-
|
|
42
|
-
## Funcionamiento
|
|
43
|
-
- Se *leen* las plantillas del documento.
|
|
44
|
-
- Una vez leídas sabemos:
|
|
45
|
-
- Qué es lo que hay que descargar, de dónde y con qué fechas.
|
|
46
|
-
- Qué es lo que hay que calcular a partir de lo descargado y cómo.
|
|
47
|
-
- Descarga *missing*
|
|
48
|
-
- Debe haber una opción *debug*, así como opción de no descargar y tomar directamente de nuestra bbdd.
|
|
49
|
-
- Cálculo o *prerrenderizado*: se generan las imágenes de los gráficos así como los archivos necesarios para renderizar las tablas en su formato final.
|
|
50
|
-
- *Renderizado* final.
|
|
51
|
-
|
|
52
|
-
## Informes
|
|
53
|
-
- Un *informe* (*Report*) es una **clase** que contiene un diccionario de *contenidos* (*Content*)
|
|
54
|
-
- Un *cotenido* (*Content*) es un **protocolo** que permite consultar y modificar su *nivel de anidamiento* así como construirse a partir de un archivo `.yaml`.
|
|
55
|
-
- Un informe puede *rederizarse* a un documento word a partir de una **plantilla**. Sencillamente, renderizará todos sus componentes uno por uno.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
## Tablas
|
|
2
|
-
|
|
3
|
-
### Columnas
|
|
4
|
-
|
|
5
|
-
- `name`: Nombre de la columna a mostrar.
|
|
6
|
-
|
|
7
|
-
- `scale`: Número por el que se multiplica el valor original en la base de datos a la hora de ser mostrado.
|
|
8
|
-
- `unit`: Símbolo de la unidad del valor a mostrar.
|
|
9
|
-
- `decimals`: Número de decimales a mostrar.
|
|
10
|
-
|
|
11
|
-
- `show_units_in_title`: Se mostrará el símbolo de las unidades en el título de la columna.
|
|
12
|
-
- `show_units_in_cell`: Se mostrará el símbolo de las unidades al lado del valor de cada celda.
|
|
13
|
-
|
|
14
|
-
Variables de localización de los valores a mostrar en la base de datos.
|
|
15
|
-
|
|
16
|
-
- `offset`:
|
|
17
|
-
- `difference`:
|
|
18
|
-
- `stat`:
|
|
19
|
-
|
|
20
|
-
Variables de coloreado.
|
|
21
|
-
|
|
22
|
-
- `colors`: Indica si el valor debe ir coloreado o no en la tabla.
|
|
23
|
-
- `positive_good`: Si es `True` colorearemos los valores positivos de un color que el lector asocie con "*bueno*".
|
|
24
|
-
- `outliers`: Si es `True` sombrearemos las celdas que tengan un valor por encima de cierto umbral.
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
.alemania_series:
|
|
2
|
-
PT10YT=RR_DIFF: DE10YT=RR
|
|
3
|
-
GR10YT=RR_DIFF: DE10YT=RR
|
|
4
|
-
ES10YT=RR_DIFF: DE10YT=RR
|
|
5
|
-
EUUNIEURAE10Y=_DIFF: DE10YT=RR
|
|
6
|
-
IT10YT=RR_DIFF: DE10YT=RR
|
|
7
|
-
FR10YT=RR_DIFF: DE10YT=RR
|
|
8
|
-
|
|
9
|
-
.flash: &flash
|
|
10
|
-
date:
|
|
11
|
-
|
|
12
|
-
.perc_format: &perc_format
|
|
13
|
-
units: "%"
|
|
14
|
-
decimals: 2
|
|
15
|
-
|
|
16
|
-
.pb_format: &pb_format
|
|
17
|
-
units: "p.b."
|
|
18
|
-
decimals: 0
|
|
19
|
-
|
|
20
|
-
.bancos: &bancos
|
|
21
|
-
sorted: True
|
|
22
|
-
blocks:
|
|
23
|
-
bancos_esp:
|
|
24
|
-
label: Bancos españoles
|
|
25
|
-
series:
|
|
26
|
-
BKT.MC: Bankinter
|
|
27
|
-
SAN.MC: Santander
|
|
28
|
-
CABK.MC: Caixabank
|
|
29
|
-
SABE.MC: Sabadell
|
|
30
|
-
BBVA.MC: BBVA
|
|
31
|
-
UNI.MC: Unicaja
|
|
32
|
-
bandos_idx:
|
|
33
|
-
label: Índices bancarios internacionales
|
|
34
|
-
series:
|
|
35
|
-
.IBCA.MA: Índice bancario español*
|
|
36
|
-
.SX7E: EuroStoxx Banks
|
|
37
|
-
.FTNMX301010: Índice bancario UK
|
|
38
|
-
.SPXBK: S&P 500 Bancos EEUU
|
|
39
|
-
.DJUSBK: DJ US Banks
|
|
40
|
-
.DJSRBKT: DJ US Regional Banks
|
|
41
|
-
format:
|
|
42
|
-
<<: *perc_format
|
|
43
|
-
decimals: 0
|
|
44
|
-
annot_format:
|
|
45
|
-
<<: *perc_format
|
|
46
|
-
|
|
47
|
-
bancos_week:
|
|
48
|
-
flash:
|
|
49
|
-
<<: *flash
|
|
50
|
-
deviations: True
|
|
51
|
-
offset: ftd
|
|
52
|
-
difference: relative
|
|
53
|
-
<<: *bancos
|
|
54
|
-
|
|
55
|
-
bancos_mtd:
|
|
56
|
-
flash:
|
|
57
|
-
<<: *flash
|
|
58
|
-
deviations: False
|
|
59
|
-
offset: mtd
|
|
60
|
-
difference: relative
|
|
61
|
-
<<: *bancos
|
|
62
|
-
|
|
63
|
-
.deuda_general: &deuda_general
|
|
64
|
-
sorted: True
|
|
65
|
-
series:
|
|
66
|
-
EUUNIEURAE10Y=: UE
|
|
67
|
-
ES10YT=RR: España*
|
|
68
|
-
DE10YT=RR: Alemania
|
|
69
|
-
FR10YT=RR: Francia
|
|
70
|
-
IT10YT=RR: Italia
|
|
71
|
-
PT10YT=RR: Portugal
|
|
72
|
-
GR10YT=RR: Grecia
|
|
73
|
-
GB10YT=RR: Reino Unido
|
|
74
|
-
US10YT=RR: EEUU
|
|
75
|
-
format:
|
|
76
|
-
<<: *pb_format
|
|
77
|
-
annot_format:
|
|
78
|
-
<<: *pb_format
|
|
79
|
-
axis_format:
|
|
80
|
-
<<: *perc_format
|
|
81
|
-
|
|
82
|
-
deuda_general_week:
|
|
83
|
-
flash:
|
|
84
|
-
<<: *flash
|
|
85
|
-
offset: ftd
|
|
86
|
-
difference: absolute
|
|
87
|
-
deviations: True
|
|
88
|
-
<<: *deuda_general
|
|
89
|
-
|
|
90
|
-
deuda_general_ytd:
|
|
91
|
-
flash:
|
|
92
|
-
<<: *flash
|
|
93
|
-
offset: ytd
|
|
94
|
-
difference: absolute
|
|
95
|
-
deviations: False
|
|
96
|
-
<<: *deuda_general
|
|
97
|
-
|
|
98
|
-
.deuda_diferenciales: &deuda_diferenciales
|
|
99
|
-
sorted: True
|
|
100
|
-
series:
|
|
101
|
-
PT10YT=RR_DIFF: Portugal
|
|
102
|
-
GR10YT=RR_DIFF: Grecia
|
|
103
|
-
ES10YT=RR_DIFF: España*
|
|
104
|
-
EUUNIEURAE10Y=_DIFF: UE
|
|
105
|
-
IT10YT=RR_DIFF: Italia
|
|
106
|
-
FR10YT=RR_DIFF: Francia
|
|
107
|
-
format:
|
|
108
|
-
<<: *pb_format
|
|
109
|
-
annot_format:
|
|
110
|
-
<<: *pb_format
|
|
111
|
-
axis_format:
|
|
112
|
-
<<: *pb_format
|
|
113
|
-
|
|
114
|
-
deuda_diferenciales_week:
|
|
115
|
-
flash:
|
|
116
|
-
<<: *flash
|
|
117
|
-
offset: ftd
|
|
118
|
-
difference: absolute
|
|
119
|
-
deviations: True
|
|
120
|
-
<<: *deuda_diferenciales
|
|
121
|
-
|
|
122
|
-
deuda_diferenciales_ytd:
|
|
123
|
-
flash:
|
|
124
|
-
<<: *flash
|
|
125
|
-
offset: ytd
|
|
126
|
-
difference: absolute
|
|
127
|
-
deviations: False
|
|
128
|
-
<<: *deuda_diferenciales
|
|
129
|
-
|
|
130
|
-
.deuda_esp: &deuda_esp
|
|
131
|
-
sorted: False
|
|
132
|
-
series:
|
|
133
|
-
ES1YT=RR: 1 años
|
|
134
|
-
ES2YT=RR: 2 años
|
|
135
|
-
ES3YT=RR: 3 años
|
|
136
|
-
ES5YT=RR: 5 años
|
|
137
|
-
ES10YT=RR: 10 años*
|
|
138
|
-
ES30YT=RR: 30 años
|
|
139
|
-
format:
|
|
140
|
-
<<: *pb_format
|
|
141
|
-
annot_format:
|
|
142
|
-
<<: *pb_format
|
|
143
|
-
axis_format:
|
|
144
|
-
<<: *perc_format
|
|
145
|
-
|
|
146
|
-
deuda_esp_week:
|
|
147
|
-
flash:
|
|
148
|
-
<<: *flash
|
|
149
|
-
offset: ftd
|
|
150
|
-
difference: absolute
|
|
151
|
-
deviations: True
|
|
152
|
-
<<: *deuda_esp
|
|
153
|
-
|
|
154
|
-
deuda_esp_ytd:
|
|
155
|
-
flash:
|
|
156
|
-
<<: *flash
|
|
157
|
-
offset: ytd
|
|
158
|
-
difference: absolute
|
|
159
|
-
deviations: False
|
|
160
|
-
<<: *deuda_esp
|
|
161
|
-
|
|
162
|
-
.divisas: &divisas
|
|
163
|
-
sorted: True
|
|
164
|
-
series:
|
|
165
|
-
USD_OVER_RUB: Rublo
|
|
166
|
-
GBP=: Libra
|
|
167
|
-
EUR=: Euro*
|
|
168
|
-
USD_OVER_BRL: Real Brasileño
|
|
169
|
-
USD_OVER_CNY: Yuan
|
|
170
|
-
USD_OVER_TRY: Lira Turca
|
|
171
|
-
USD_OVER_JPY: Yen
|
|
172
|
-
USD_OVER_CHF: Franco Suizo
|
|
173
|
-
format:
|
|
174
|
-
<<: *perc_format
|
|
175
|
-
decimals: 0
|
|
176
|
-
annot_format:
|
|
177
|
-
<<: *perc_format
|
|
178
|
-
decimals: 1
|
|
179
|
-
|
|
180
|
-
divisas_week:
|
|
181
|
-
flash:
|
|
182
|
-
<<: *flash
|
|
183
|
-
offset: ftd
|
|
184
|
-
difference: relative
|
|
185
|
-
deviations: True
|
|
186
|
-
<<: *divisas
|
|
187
|
-
format:
|
|
188
|
-
<<: *perc_format
|
|
189
|
-
decimals: 1
|
|
190
|
-
annot_format:
|
|
191
|
-
<<: *perc_format
|
|
192
|
-
decimals: 2
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
divisas_ytd:
|
|
197
|
-
flash:
|
|
198
|
-
<<: *flash
|
|
199
|
-
offset: ytd
|
|
200
|
-
difference: relative
|
|
201
|
-
deviations: False
|
|
202
|
-
<<: *divisas
|