tesorotools-python 0.0.0__py2.py3-none-any.whl → 0.0.1__py2.py3-none-any.whl
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/data_sources/README.md +14 -0
- tesorotools/data_sources/{eikon.py → lseg.py} +15 -21
- {tesorotools_python-0.0.0.dist-info → tesorotools_python-0.0.1.dist-info}/METADATA +2 -1
- {tesorotools_python-0.0.0.dist-info → tesorotools_python-0.0.1.dist-info}/RECORD +5 -4
- {tesorotools_python-0.0.0.dist-info → tesorotools_python-0.0.1.dist-info}/WHEEL +0 -0
|
@@ -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
|
|
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
|
|
20
|
-
|
|
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
|
|
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 =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
|
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
|
|
101
|
-
print(f"
|
|
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
|
|
97
|
+
print(f"Waiting {cooldown} seconds for LSEG to cool down...")
|
|
104
98
|
time.sleep(cooldown)
|
|
105
99
|
return data
|
|
106
100
|
|
|
@@ -6,9 +6,10 @@ tesorotools/artists/barh_plot.py,sha256=3KkoT0DLkctzYNMV3Pz1EcAT9i29YGYSkTLTFNb3
|
|
|
6
6
|
tesorotools/artists/line_plot.py,sha256=BqOHnmVB6fL0ElN_WDpvCzP0L7O2-mp6ULfHo3qwiCI,3405
|
|
7
7
|
tesorotools/artists/table.py,sha256=CjyjWivn5YrNP5m8_eWi-ZA7R1ts3aIhATrYMEgTuOU,7651
|
|
8
8
|
tesorotools/artists/type_curve.py,sha256=VGFCCyMVNwjliLK9usyw_nLC6emKcJYOSV1pmWJQNXk,6463
|
|
9
|
+
tesorotools/data_sources/README.md,sha256=iMAeLsv9Xk3IogDh8nCt2pSeTqCHmXA66KPvV25Za7I,261
|
|
9
10
|
tesorotools/data_sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
11
|
tesorotools/data_sources/debug.py,sha256=fmUHt7f3dAd6qUBo5D_kTn__MgGC0hisdaC6sFXHKNg,877
|
|
11
|
-
tesorotools/data_sources/
|
|
12
|
+
tesorotools/data_sources/lseg.py,sha256=Kvp3rpfO69UUgnR_2Zu5O12DWXwIHDDa1ARIkEfmF0s,3621
|
|
12
13
|
tesorotools/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
14
|
tesorotools/database/push.py,sha256=Y1ToNupMIdNfXcg20P0sFijXza05FUCB1OK53cPXYtU,1960
|
|
14
15
|
tesorotools/dependencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -33,6 +34,6 @@ tesorotools/utils/globals.py,sha256=gFhNjCjeih7NaNEb6yjgoJbkTSUuJu9Xw5-UDtCPAQA,
|
|
|
33
34
|
tesorotools/utils/matplotlib.py,sha256=tKidZIcDLKWgawIOJggWwVoaTMsrjw1WEJQouydSYbI,1197
|
|
34
35
|
tesorotools/utils/series.py,sha256=eUEUOdzDfA7YbgO4o6KtxwJOL5cQYdqLjrdvuQ7Hqhc,1168
|
|
35
36
|
tesorotools/utils/template.py,sha256=xpBVad28gG9ZLVwd9e0dTWsGsbujjmVcCPEW2mIKEJo,4917
|
|
36
|
-
tesorotools_python-0.0.
|
|
37
|
-
tesorotools_python-0.0.
|
|
38
|
-
tesorotools_python-0.0.
|
|
37
|
+
tesorotools_python-0.0.1.dist-info/METADATA,sha256=D0i6EvR2bIjJbfS2UTqegX8Lrg-OCCL6SDaEWarojGw,323
|
|
38
|
+
tesorotools_python-0.0.1.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
39
|
+
tesorotools_python-0.0.1.dist-info/RECORD,,
|
|
File without changes
|