luxorasap 0.1.34__py3-none-any.whl → 0.1.37__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.
- luxorasap/__init__.py +1 -1
- luxorasap/datareader/core.py +26 -7
- luxorasap/utils/tools/excel.py +8 -1
- {luxorasap-0.1.34.dist-info → luxorasap-0.1.37.dist-info}/METADATA +1 -1
- {luxorasap-0.1.34.dist-info → luxorasap-0.1.37.dist-info}/RECORD +8 -8
- {luxorasap-0.1.34.dist-info → luxorasap-0.1.37.dist-info}/WHEEL +0 -0
- {luxorasap-0.1.34.dist-info → luxorasap-0.1.37.dist-info}/entry_points.txt +0 -0
- {luxorasap-0.1.34.dist-info → luxorasap-0.1.37.dist-info}/top_level.txt +0 -0
luxorasap/__init__.py
CHANGED
|
@@ -13,7 +13,7 @@ from types import ModuleType
|
|
|
13
13
|
try:
|
|
14
14
|
__version__: str = metadata.version(__name__)
|
|
15
15
|
except metadata.PackageNotFoundError: # editable install
|
|
16
|
-
__version__ = "0.1.
|
|
16
|
+
__version__ = "0.1.37"
|
|
17
17
|
|
|
18
18
|
# ─── Lazy loader ─────────────────────────────────────────────────
|
|
19
19
|
def __getattr__(name: str) -> ModuleType:
|
luxorasap/datareader/core.py
CHANGED
|
@@ -101,6 +101,13 @@ class LuxorQuery:
|
|
|
101
101
|
return self.blob_client.table_exists(table_path)
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
def list_tables(self):
|
|
105
|
+
"""Lista todas as tabelas disponiveis no blob"""
|
|
106
|
+
tables = self.blob_client.list_blob_files(self.blob_directory, ends_with=".parquet")
|
|
107
|
+
tables = [os.path.basename(t).replace(".parquet","") for t in tables]
|
|
108
|
+
return tables
|
|
109
|
+
|
|
110
|
+
|
|
104
111
|
def get_table(self, table_name, index=False, index_name="index", dtypes_override={}, force_reload=False):
|
|
105
112
|
"""
|
|
106
113
|
Retorna uma copia do DataFrame do 'table_name' correspondente. Se não estiver disponivel,
|
|
@@ -183,9 +190,17 @@ class LuxorQuery:
|
|
|
183
190
|
str_nan_format = str_nan_format.union(dtypes_override['str_nan_format'])
|
|
184
191
|
|
|
185
192
|
if table_name != "last_all_flds":
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
193
|
+
try:
|
|
194
|
+
for col in table_columns.intersection(float_dtypes):
|
|
195
|
+
table_data[col] = table_data[col].astype(float)
|
|
196
|
+
except :
|
|
197
|
+
logger.error(f"Ao carregar tabela '{table_name}', nao foi possivel converter dados da coluna {col} para float.")
|
|
198
|
+
#logger.warning(f"Colunas com erro: {table_columns.intersection(float_dtypes)}")
|
|
199
|
+
#logger.warning(f"Colunas disponiveis: {table_columns}")
|
|
200
|
+
#print(table_data.dtypes)
|
|
201
|
+
|
|
202
|
+
raise ValueError(f"Erro ao converter colunas para float na tabela '{table_name}'.")
|
|
203
|
+
|
|
189
204
|
if table_name == "hist_risk_metrics":
|
|
190
205
|
try:
|
|
191
206
|
cols_to_format = list(set(table_data.columns) - {"Date", "Fund"})
|
|
@@ -201,10 +216,14 @@ class LuxorQuery:
|
|
|
201
216
|
table_data[col] = table_data[col].apply(lambda x: pd.to_datetime(x))
|
|
202
217
|
|
|
203
218
|
for col in table_columns.intersection(bool_dtypes):
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
try:
|
|
220
|
+
table_data[col] = (table_data[col].str.lower()
|
|
221
|
+
.replace("false", "").replace("falso", "")
|
|
222
|
+
.replace("0", "").replace("nan", "").astype(bool))
|
|
223
|
+
except Exception:
|
|
224
|
+
logger.error(f"Ao carregar tabela '{table_name}', nao foi possivel converter dados da coluna {col} para bool.")
|
|
225
|
+
raise ValueError(f"Erro ao converter coluna {col} para bool na tabela '{table_name}'.")
|
|
226
|
+
|
|
208
227
|
for col in table_columns.intersection(str_nan_format):
|
|
209
228
|
table_data[col] = table_data[col].replace("nan", pd.NA).replace("", pd.NA)
|
|
210
229
|
|
luxorasap/utils/tools/excel.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
|
|
2
|
+
import platform
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
if platform.system() == "Windows":
|
|
5
|
+
import win32com.client
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
def close_excel_worksheet(filename, save=True):
|
|
@@ -11,6 +13,11 @@ def close_excel_worksheet(filename, save=True):
|
|
|
11
13
|
"""
|
|
12
14
|
|
|
13
15
|
try:
|
|
16
|
+
|
|
17
|
+
if platform.system() != "Windows":
|
|
18
|
+
print("Esta função só está disponível no Windows.")
|
|
19
|
+
return
|
|
20
|
+
|
|
14
21
|
excel = win32com.client.Dispatch("Excel.Application")
|
|
15
22
|
for wb in excel.Workbooks:
|
|
16
23
|
if wb.Name.lower() == filename.lower(): # compara ignorando maiúsc/minúsc
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
luxorasap/__init__.py,sha256=
|
|
1
|
+
luxorasap/__init__.py,sha256=ypP4poAZBYVwJee1iiBrOxIoFUH6kFQ1mXxT1nPPZ7w,1356
|
|
2
2
|
luxorasap/btgapi/__init__.py,sha256=QUlfb5oiBY6K1Q5x4-a-x2wECe1At5wc2962I5odOJk,620
|
|
3
3
|
luxorasap/btgapi/auth.py,sha256=PvyCtbEyBO2B1CIeAlNXWugKW1OgiKfPcVzS6K5FBnQ,1872
|
|
4
4
|
luxorasap/btgapi/reports.py,sha256=ZVEMLoJPXc0r3XjPJPMsKQN0zZd1Npd7umNpAj1bncs,8040
|
|
5
5
|
luxorasap/btgapi/trades.py,sha256=956HZ9BvN9C_VQvKTyBLN0x6ZygwVqBZN11F7OnNbDI,5985
|
|
6
6
|
luxorasap/datareader/__init__.py,sha256=41RAvbrQ4R6oj67S32CrKqolx0CJ2W8cbOF6g5Cqm2g,120
|
|
7
|
-
luxorasap/datareader/core.py,sha256=
|
|
7
|
+
luxorasap/datareader/core.py,sha256=HBpVKwcNEQx83sDgJ6IJLXQZijoTZ1vFwTyBv_K7GDY,157345
|
|
8
8
|
luxorasap/ingest/__init__.py,sha256=XhxDTN2ar-u6UCPhnxNU_to-nWiit-SpQ6cA_N9eMSs,795
|
|
9
9
|
luxorasap/ingest/cloud/__init__.py,sha256=7yqEgeDxplkqYTzZNB0kfkSQ8PXF-77BXMW2DMYtJbU,2911
|
|
10
10
|
luxorasap/ingest/legacy_local/dataloader.py,sha256=DF3CvojDAi0itVDZPsQbmpl5pqMTNwOOpxTz4Ju8mho,12419
|
|
@@ -15,9 +15,9 @@ luxorasap/utils/dataframe/transforms.py,sha256=OIvlTTcjFX6bUhuQp_syEp7ssm4sLzwvg
|
|
|
15
15
|
luxorasap/utils/storage/__init__.py,sha256=U3XRq94yzRp3kgBSUcRzs2tQgJ4o8h8a1ZzwiscA5XM,67
|
|
16
16
|
luxorasap/utils/storage/blob.py,sha256=0QnwrUP-9vWYK8ffa6NqE7rV_t6RdScRM8GQnMxY_4w,3184
|
|
17
17
|
luxorasap/utils/tools/__init__.py,sha256=dvK7Z4xnNQAuEiObVN7qjeLWAvP49JeFn2Oq9GdgmXs,76
|
|
18
|
-
luxorasap/utils/tools/excel.py,sha256=
|
|
19
|
-
luxorasap-0.1.
|
|
20
|
-
luxorasap-0.1.
|
|
21
|
-
luxorasap-0.1.
|
|
22
|
-
luxorasap-0.1.
|
|
23
|
-
luxorasap-0.1.
|
|
18
|
+
luxorasap/utils/tools/excel.py,sha256=SfeTcbJWsWq3uKruwKSjJ4aWgMovITzlNXjP2bhdMjI,1246
|
|
19
|
+
luxorasap-0.1.37.dist-info/METADATA,sha256=LEP0TN8K5_wRlMpBxlr_Q7XsQGr5MqqFtA9FQ4alBlw,3804
|
|
20
|
+
luxorasap-0.1.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
21
|
+
luxorasap-0.1.37.dist-info/entry_points.txt,sha256=XFh-dOwUhlya9DmGvgookMI0ezyUJjcOvTIHDEYS44g,52
|
|
22
|
+
luxorasap-0.1.37.dist-info/top_level.txt,sha256=9YOL6bUIpzY06XFBRkUW1e4rgB32Ds91fQPGwUEjxzU,10
|
|
23
|
+
luxorasap-0.1.37.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|