tesorotools-python 0.0.0__tar.gz → 0.0.1__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.
Files changed (56) hide show
  1. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/PKG-INFO +2 -1
  2. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/README.md +0 -28
  3. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/pyproject.toml +2 -2
  4. tesorotools_python-0.0.1/src/tesorotools/data_sources/README.md +14 -0
  5. tesorotools_python-0.0.0/src/tesorotools/data_sources/eikon.py → tesorotools_python-0.0.1/src/tesorotools/data_sources/lseg.py +15 -21
  6. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/.gitignore +0 -0
  7. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/README.md +0 -0
  8. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/barh_plots.yaml +0 -0
  9. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/data.yaml +0 -0
  10. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/dependencies.yaml +0 -0
  11. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/line_plots.yaml +0 -0
  12. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/offsets.yaml +0 -0
  13. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/plots.yaml +0 -0
  14. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/tables.yaml +0 -0
  15. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/template.yaml +0 -0
  16. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/examples/type_curves.yaml +0 -0
  17. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/__init__.py +0 -0
  18. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/artists/__init__.py +0 -0
  19. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/artists/barh_plot.py +0 -0
  20. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/artists/line_plot.py +0 -0
  21. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/artists/table.py +0 -0
  22. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/artists/type_curve.py +0 -0
  23. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/convert.py +0 -0
  24. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/data_sources/__init__.py +0 -0
  25. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/data_sources/debug.py +0 -0
  26. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/database/__init__.py +0 -0
  27. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/database/push.py +0 -0
  28. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/dependencies/__init__.py +0 -0
  29. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/dependencies/functions.py +0 -0
  30. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/dependencies/node.py +0 -0
  31. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/dependencies/resolution.py +0 -0
  32. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/main.py +0 -0
  33. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/offsets/__init__.py +0 -0
  34. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/offsets/offsets.py +0 -0
  35. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/offsets/outliers.py +0 -0
  36. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/__init__.py +0 -0
  37. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/content/__init__.py +0 -0
  38. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/content/content.py +0 -0
  39. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/content/images.py +0 -0
  40. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/content/section.py +0 -0
  41. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/content/table.py +0 -0
  42. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/headline.py +0 -0
  43. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/introduction.py +0 -0
  44. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/render/report.py +0 -0
  45. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/utils/__init__.py +0 -0
  46. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/utils/config.py +0 -0
  47. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/utils/globals.py +0 -0
  48. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/utils/matplotlib.py +0 -0
  49. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/utils/series.py +0 -0
  50. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools/utils/template.py +0 -0
  51. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools_python.egg-info/PKG-INFO +0 -0
  52. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools_python.egg-info/SOURCES.txt +0 -0
  53. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools_python.egg-info/dependency_links.txt +0 -0
  54. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools_python.egg-info/requires.txt +0 -0
  55. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/src/tesorotools_python.egg-info/top_level.txt +0 -0
  56. {tesorotools_python-0.0.0 → tesorotools_python-0.0.1}/tesoro.mplstyle +0 -0
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tesorotools-python
3
- Version: 0.0.0
3
+ Version: 0.0.1
4
4
  Requires-Dist: babel
5
5
  Requires-Dist: eikon
6
+ Requires-Dist: lseg-data
6
7
  Requires-Dist: matplotlib
7
8
  Requires-Dist: openpyxl
8
9
  Requires-Dist: pandas
@@ -49,34 +49,6 @@ La fecha se renderizará en el estilo `Subtitle` o `Subtítulo` del documento ba
49
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
50
  - *Renderizado* final.
51
51
 
52
- ## Sistema de lectura de archivos `.yaml`
53
- El informe a generar se describe mediante unas *plantillas*, que en la práctica son archivos `.yaml`, con lo que es importante entender cómo el programa procede a la lectura de los mismos.
54
-
55
- Todo archivo `.yaml` debe leerse a través de la función `utils.config.read_config`. Esta toma como parámetros el path al fichero a leer y un *cargador*. Siempre que se vaya a leer una *plantilla*, este cargador debe ser `utils.config.CustomLoader`, en caso contrario, puede dejarse en blanco.
56
-
57
- En el proceso de lectura, el documento completo se representa como un objeto de tipo `MappingNode` y este es el parámetro `node` en la función `construct_mapping`.
58
-
59
- Cada `MappingNode` contiene un atributo `value`, que en una lista de tuplas `(key_node, value_node)`
60
-
61
- Dentro de un documento `.yaml` sencillo como
62
- ```yaml
63
- clave1: "valor1"
64
- ```
65
-
66
- La lista `value` solo tiene una tupla en su interior, donde:
67
- - La clave o `key_node` es de tipo `ScalarNode` con tag `tag:yaml.org,2002:str` *implícito* y valor `clave1`.
68
- - El valor o `value_node` también es de tipo `ScalarNode` con valor `valor1`.
69
-
70
- En casos más complejos como
71
- ```yaml
72
- clave2: !offset_table
73
- subclave: "subvalor"
74
- ```
75
-
76
- De nuevo, la lista `value` solo contendrá una tupla en su interior, donde:
77
- - La clave es un `ScalarNode` con valor `clave2`
78
- - El valor es un `MappingNode` con *tag* personalizado `!offset_table`. Su valor a su vez en una lista de tuplas bla bla bla (se ve la recursividad)
79
-
80
52
  ## Informes
81
53
  - Un *informe* (*Report*) es una **clase** que contiene un diccionario de *contenidos* (*Content*)
82
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`.
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "tesorotools-python"
3
- version = "0.0.0"
4
- dependencies = ["psycopg2", "SQLAlchemy", "pandas", "matplotlib", "pyarrow", "python-docx", "openpyxl", "PyYAML", "babel", "eikon"]
3
+ version = "0.0.1"
4
+ dependencies = ["psycopg2", "SQLAlchemy", "pandas", "matplotlib", "pyarrow", "python-docx", "openpyxl", "PyYAML", "babel", "eikon", "lseg-data"]
5
5
 
6
6
  [build-system]
7
7
  requires = ["hatchling"]
@@ -0,0 +1,14 @@
1
+ # LSEG Data Library for Python
2
+
3
+ ## Capa de acceso
4
+
5
+ ## Capa de contenido
6
+
7
+ ## Capa de reparto
8
+
9
+ ## Capa de sesión
10
+
11
+ ## Referencias
12
+
13
+ - https://cdn.refinitiv.com/public/lseg-lib-python-doc/2.0.0.2/book/en/index.html
14
+ - https://pypi.org/project/lseg-data/
@@ -1,7 +1,7 @@
1
1
  import time
2
2
  from pathlib import Path
3
3
 
4
- import eikon as ek
4
+ import lseg.data as ld
5
5
  import pandas as pd
6
6
 
7
7
 
@@ -16,13 +16,9 @@ def get_series(
16
16
  datapoint_limit: int = 2_000,
17
17
  cache_path: Path | None = None,
18
18
  ) -> pd.DataFrame:
19
- """Downloads data from eikon given that tou have a valid API key"""
20
- ek.set_app_key(api_key)
21
- fields = (
22
- ["TIMESTAMP", "CLOSE", "CF_LAST", "CF_YIELD"]
23
- if fields is None
24
- else fields
25
- )
19
+ """Downloads data from LSEG given that tou have a valid API key"""
20
+ ld.open_session(app_key=api_key)
21
+ fields = ["TIMESTAMP", "CLOSE"] if fields is None else fields
26
22
 
27
23
  dates_list: list[str] = list(
28
24
  pd.date_range(start=start_date, end=end_date, freq=freq).astype("str")
@@ -57,10 +53,10 @@ def get_series(
57
53
  if cache_file_path is None:
58
54
  partial_data.append(data)
59
55
  if downloaded_dates + download_step < len(dates_list):
60
- print(f"Waiting {cooldown} seconds for Eikon to cool down...")
56
+ print(f"Waiting {cooldown} seconds for LSEG to cool down...")
61
57
  time.sleep(cooldown)
62
58
  downloaded_dates += download_step
63
- data = concat_partial_data(cache_path, partial_data)
59
+ # data = concat_partial_data(cache_path, partial_data)
64
60
  return data
65
61
 
66
62
 
@@ -72,22 +68,20 @@ def block_download(
72
68
  fields: list[str] | None = None,
73
69
  cooldown: int = 60,
74
70
  file_path: Path | None = None,
75
- debug: bool = False,
76
71
  ):
77
72
  interval = "daily" if freq == "B" else freq
78
73
 
79
74
  while True:
80
75
  try:
81
- data: pd.DataFrame | None = ek.get_timeseries(
82
- rics=series_id_list,
83
- start_date=start_date,
84
- end_date=end_date,
85
- fields=fields,
76
+ data: pd.DataFrame | None = ld.get_history(
77
+ universe=series_id_list,
78
+ start=start_date,
79
+ end=end_date,
80
+ # fields=fields,
86
81
  interval=interval,
87
- debug=debug,
88
82
  )
89
83
  if data is None:
90
- raise ek.EikonError(
84
+ raise ld.errors.LDError(
91
85
  code=404, message="Service temporarily unavailable"
92
86
  )
93
87
  data = data.drop_duplicates()
@@ -97,10 +91,10 @@ def block_download(
97
91
  if file_path is not None:
98
92
  data.to_csv(file_path)
99
93
  break
100
- except ek.EikonError as e:
101
- print(f"Eikon error: {e}")
94
+ except ld.errors.LDError as e:
95
+ print(f"LSEG error: {e}")
102
96
  print("This is probably not our fault")
103
- print(f"Waiting {cooldown} seconds for Eikon to cool down...")
97
+ print(f"Waiting {cooldown} seconds for LSEG to cool down...")
104
98
  time.sleep(cooldown)
105
99
  return data
106
100