luxorasap 0.2.10__py3-none-any.whl → 0.2.11__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 +34 -24
- {luxorasap-0.2.10.dist-info → luxorasap-0.2.11.dist-info}/METADATA +1 -1
- {luxorasap-0.2.10.dist-info → luxorasap-0.2.11.dist-info}/RECORD +7 -7
- {luxorasap-0.2.10.dist-info → luxorasap-0.2.11.dist-info}/WHEEL +0 -0
- {luxorasap-0.2.10.dist-info → luxorasap-0.2.11.dist-info}/entry_points.txt +0 -0
- {luxorasap-0.2.10.dist-info → luxorasap-0.2.11.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.2.
|
|
16
|
+
__version__ = "0.2.11"
|
|
17
17
|
|
|
18
18
|
# ─── Lazy loader ─────────────────────────────────────────────────
|
|
19
19
|
def __getattr__(name: str) -> ModuleType:
|
luxorasap/datareader/core.py
CHANGED
|
@@ -156,7 +156,6 @@ class LuxorQuery:
|
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
def __load_table(self, table_name, index=False, index_name="index", dtypes_override={}, auto_convert_mapped_types=True):
|
|
159
|
-
|
|
160
159
|
def __load_parquet(table_name):
|
|
161
160
|
table_path = f"{self.blob_directory}/{table_name}.parquet"#self.tables_path/"parquet"/f"{table_name}.parquet"
|
|
162
161
|
|
|
@@ -1911,7 +1910,12 @@ class LuxorQuery:
|
|
|
1911
1910
|
.fillna(0)+1).reset_index()
|
|
1912
1911
|
|
|
1913
1912
|
us_margin_cost = self.get_prices("sofr + 75bps", period="60m", currency=currency, usdbrl_ticker=usdbrl_ticker)
|
|
1914
|
-
|
|
1913
|
+
try:
|
|
1914
|
+
us_margin_cost["Date"] = us_margin_cost["Date"].dt.date
|
|
1915
|
+
except AttributeError:
|
|
1916
|
+
logging.info(f'Erro ao converter usd_margin_cost para date. currency:{currency}, usdbrl_ticker:{usdbrl_ticker}\
|
|
1917
|
+
{us_margin_cost.dtypes}')
|
|
1918
|
+
|
|
1915
1919
|
us_margin_cost = (us_margin_cost[["Date", "Last_Price"]]
|
|
1916
1920
|
.rename(columns={"Last_Price":"us_margin_cost"})
|
|
1917
1921
|
.set_index("Date").pct_change()
|
|
@@ -2156,28 +2160,34 @@ class LuxorQuery:
|
|
|
2156
2160
|
types_to_recalculate = ['ndf usdbrl']
|
|
2157
2161
|
# Separando os dados em dois grupos, para editar um deles
|
|
2158
2162
|
df_exposure = df.query("Type.isin(@types_to_recalculate)").copy()
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2163
|
+
if len(df_exposure) > 0:
|
|
2164
|
+
df = df.query("~Type.isin(@types_to_recalculate)").copy()
|
|
2165
|
+
# Calculo especifico para pnl do FX.
|
|
2166
|
+
|
|
2167
|
+
df_exposure["Pnl_Bought"] = df_exposure["Pnl_Bought"].astype('float')
|
|
2168
|
+
df_exposure["Pnl_Sold"] = df_exposure["Pnl_Sold"].astype('float')
|
|
2169
|
+
df_exposure["Pnl_Unchanged"] = df_exposure["Pnl_Unchanged"].astype('float')
|
|
2170
|
+
|
|
2171
|
+
df_exposure["Total_Pnl"] = df_exposure["Pnl_Bought"] + df_exposure["Pnl_Sold"] \
|
|
2172
|
+
+ df_exposure["Pnl_Unchanged"]
|
|
2173
|
+
|
|
2174
|
+
df_exposure = df_exposure.set_index(["Asset_ID"])
|
|
2175
|
+
# Valor de mercado sera o PnL acumulado
|
|
2176
|
+
|
|
2177
|
+
df_exposure["Total_Pnl"] = df_exposure.groupby(["Asset_ID"])["Total_Pnl"].cumsum()
|
|
2178
|
+
df_exposure = df_exposure.reset_index()
|
|
2179
|
+
df_exposure["Close_Mkt_Value"] = df_exposure["Total_Pnl"]
|
|
2180
|
+
df_exposure["Open_Mkt_Value"] = df_exposure["Close_Mkt_Value"].shift(1, fill_value=0)
|
|
2181
|
+
|
|
2182
|
+
# Retirando qualquer possibilidade de impacto para aporte e resgate
|
|
2183
|
+
df_exposure["Shares_Bought_Cost"] = 0
|
|
2184
|
+
df_exposure["Amount_Sold"] = 0
|
|
2185
|
+
# TODO Pensar o que vai mudar no caso de uma zeragem parcial
|
|
2186
|
+
df_exposure = df_exposure.drop(columns="Total_Pnl")
|
|
2187
|
+
|
|
2188
|
+
|
|
2189
|
+
# Juntando dfs novamente
|
|
2190
|
+
df = pd.concat([df, df_exposure])
|
|
2181
2191
|
|
|
2182
2192
|
# Calculando net de aporte e resgate por ativo
|
|
2183
2193
|
df["Cash_Flow"] = abs(df["Shares_Bought_Cost"]) + -abs(df["Amount_Sold"])
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
luxorasap/__init__.py,sha256=
|
|
1
|
+
luxorasap/__init__.py,sha256=2oaOQ9biubY-DQ-DhpQEpPoip4s_RqAn4rvb3fE8y1A,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=VyUmD9DsFG6pemdotWZdjVIxpzkNqfhIl10elCZrh88,158680
|
|
8
8
|
luxorasap/ingest/__init__.py,sha256=gHkw8FU8TuRL5tfHkACxwsLHwLYX8SgX9xHkB8uTjww,831
|
|
9
9
|
luxorasap/ingest/cloud/__init__.py,sha256=I0JZh9FbGnIVxu7VmiTXe8rKN_w5OWLULvkVkVZNeUk,7242
|
|
10
10
|
luxorasap/ingest/legacy_local/dataloader.py,sha256=DF3CvojDAi0itVDZPsQbmpl5pqMTNwOOpxTz4Ju8mho,12419
|
|
@@ -17,8 +17,8 @@ luxorasap/utils/storage/blob.py,sha256=vgCKMOiVgP-V1A2xZRhG3kJhPFU-LA9E9kddOQTxY
|
|
|
17
17
|
luxorasap/utils/storage/change_tracker.py,sha256=HkeKc62UyD2BtP2gqafnJHZSBvYreH_7SQI1CYhn3Us,11709
|
|
18
18
|
luxorasap/utils/tools/__init__.py,sha256=dvK7Z4xnNQAuEiObVN7qjeLWAvP49JeFn2Oq9GdgmXs,76
|
|
19
19
|
luxorasap/utils/tools/excel.py,sha256=SfeTcbJWsWq3uKruwKSjJ4aWgMovITzlNXjP2bhdMjI,1246
|
|
20
|
-
luxorasap-0.2.
|
|
21
|
-
luxorasap-0.2.
|
|
22
|
-
luxorasap-0.2.
|
|
23
|
-
luxorasap-0.2.
|
|
24
|
-
luxorasap-0.2.
|
|
20
|
+
luxorasap-0.2.11.dist-info/METADATA,sha256=VxmpijHTlDCIgqzDQj-D1Uz0Bng9_6R7O1sw-7rZg-c,3804
|
|
21
|
+
luxorasap-0.2.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
22
|
+
luxorasap-0.2.11.dist-info/entry_points.txt,sha256=XFh-dOwUhlya9DmGvgookMI0ezyUJjcOvTIHDEYS44g,52
|
|
23
|
+
luxorasap-0.2.11.dist-info/top_level.txt,sha256=9YOL6bUIpzY06XFBRkUW1e4rgB32Ds91fQPGwUEjxzU,10
|
|
24
|
+
luxorasap-0.2.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|