PYield 0.40.2__tar.gz → 0.40.3__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.
- {pyield-0.40.2 → pyield-0.40.3}/PKG-INFO +1 -1
- pyield-0.40.3/pyield/__about__.py +1 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/data_cache.py +0 -3
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/auctions.py +26 -37
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/ntnf.py +0 -2
- pyield-0.40.2/pyield/__about__.py +0 -1
- {pyield-0.40.2 → pyield-0.40.3}/.gitignore +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/LICENSE +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/README.md +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/anbima/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/anbima/difusao.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/anbima/ettj_intraday.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/anbima/ettj_last.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/anbima/ima.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/anbima/imaq.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/anbima/tpf.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/b3/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/b3/di1.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/b3/di_over.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/b3/futures/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/b3/futures/common.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/b3/futures/historical.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/b3/futures/intraday.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/b3/futures/xml.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bc/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bc/auction.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bc/ptax_api.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bc/rates.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bc/repo.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bc/trades_intraday.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bc/trades_monthly.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bc/vna.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bday/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bday/core.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bday/holidays/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bday/holidays/br_holidays_new.txt +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bday/holidays/br_holidays_old.txt +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/bday/holidays/brholidays.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/config.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/conftest.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/converters.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/fwd.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/interpolator.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/ipca/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/ipca/historical.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/ipca/projected.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/py.typed +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/retry.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/__init__.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/benchmark.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/lft.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/ltn.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/ntnb.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/ntnc.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/pre.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/tn/tools.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyield/types.py +0 -0
- {pyield-0.40.2 → pyield-0.40.3}/pyproject.toml +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.40.3"
|
|
@@ -72,9 +72,6 @@ def _get_dataset_with_ttl(dataset_id: str, date_key: str) -> pl.DataFrame:
|
|
|
72
72
|
raise
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
# --- API Pública ---
|
|
76
|
-
|
|
77
|
-
|
|
78
75
|
def get_cached_dataset(dataset_id: DatasetId) -> pl.DataFrame:
|
|
79
76
|
"""
|
|
80
77
|
Obtém um dataset configurado pelo seu ID, garantindo que o cache
|
|
@@ -130,13 +130,7 @@ def _transform_raw_data(raw_data: list[dict]) -> pl.DataFrame:
|
|
|
130
130
|
.rename(COLUMN_MAP)
|
|
131
131
|
.with_columns(
|
|
132
132
|
# Conversão de datas
|
|
133
|
-
cs.starts_with("data_")
|
|
134
|
-
.exclude("data_liquidacao_2v")
|
|
135
|
-
.str.strptime(pl.Date, "%d/%m/%Y"),
|
|
136
|
-
# Tratamento da data de 2ª volta que tem formato diferente
|
|
137
|
-
pl.col("data_liquidacao_2v").str.strptime(
|
|
138
|
-
pl.Date, "%Y-%m-%dT%H:%M:%S%.f%#z", strict=False
|
|
139
|
-
),
|
|
133
|
+
cs.starts_with("data_").str.strptime(pl.Date, "%d/%m/%Y"),
|
|
140
134
|
# Cálculos de totais
|
|
141
135
|
pl.sum_horizontal("quantidade_ofertada_1v", "quantidade_ofertada_2v").alias(
|
|
142
136
|
"quantidade_ofertada_total"
|
|
@@ -192,28 +186,25 @@ def _transform_raw_data(raw_data: list[dict]) -> pl.DataFrame:
|
|
|
192
186
|
cs.starts_with("financeiro_ofertado").round(2),
|
|
193
187
|
(cs.starts_with("taxa") / 100).round(7), # Percentual -> decimal
|
|
194
188
|
)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
]
|
|
210
|
-
]
|
|
211
|
-
)
|
|
189
|
+
)
|
|
190
|
+
ajustar_cols = [
|
|
191
|
+
"pu_minimo",
|
|
192
|
+
"pu_medio",
|
|
193
|
+
"tipo_pu_medio",
|
|
194
|
+
"taxa_media",
|
|
195
|
+
"taxa_maxima",
|
|
196
|
+
]
|
|
197
|
+
# Se a quantidade aceita for zero, ajustar colunas específicas para None
|
|
198
|
+
df = df.with_columns(
|
|
199
|
+
pl.when(pl.col("quantidade_aceita_1v") == 0)
|
|
200
|
+
.then(None)
|
|
201
|
+
.otherwise(pl.col(ajustar_cols))
|
|
202
|
+
.name.keep()
|
|
212
203
|
)
|
|
213
204
|
|
|
214
205
|
# Cálculo de dias úteis (requer acesso a colunas já convertidas)
|
|
215
206
|
dias_uteis = bday.count(df["data_liquidacao_1v"], df["data_vencimento"])
|
|
216
|
-
df = df.with_columns(
|
|
207
|
+
df = df.with_columns(dias_uteis.alias("dias_uteis"))
|
|
217
208
|
return df.sort(["data_1v", "titulo", "data_vencimento"])
|
|
218
209
|
|
|
219
210
|
|
|
@@ -244,13 +235,11 @@ def _add_duration(df: pl.DataFrame) -> pl.DataFrame:
|
|
|
244
235
|
|
|
245
236
|
df = df.with_columns(
|
|
246
237
|
pl.struct(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
"dias_uteis",
|
|
253
|
-
]
|
|
238
|
+
"titulo",
|
|
239
|
+
"data_liquidacao_1v",
|
|
240
|
+
"data_vencimento",
|
|
241
|
+
"taxa_media",
|
|
242
|
+
"dias_uteis",
|
|
254
243
|
)
|
|
255
244
|
.map_elements(calculate_duration_per_row, return_dtype=pl.Float64)
|
|
256
245
|
.alias("duration")
|
|
@@ -279,9 +268,9 @@ def _add_dv01(df: pl.DataFrame) -> pl.DataFrame:
|
|
|
279
268
|
|
|
280
269
|
df = df.with_columns(
|
|
281
270
|
# 2. Criar as colunas DV01 multiplicando a expressão base pelas quantidades.
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
271
|
+
dv01_1v=dv01_unit_expr * pl.col("quantidade_aceita_1v"),
|
|
272
|
+
dv01_2v=dv01_unit_expr * pl.col("quantidade_aceita_2v"),
|
|
273
|
+
dv01_total=dv01_unit_expr * pl.col("quantidade_aceita_total"),
|
|
285
274
|
).with_columns(cs.starts_with("dv01").round(2))
|
|
286
275
|
|
|
287
276
|
return df
|
|
@@ -301,7 +290,7 @@ def _fetch_ptax_data(auction_date: dt.date) -> pl.DataFrame:
|
|
|
301
290
|
return pl.DataFrame()
|
|
302
291
|
|
|
303
292
|
return (
|
|
304
|
-
df.select(
|
|
293
|
+
df.select("Date", "MidRate")
|
|
305
294
|
.rename({"Date": "data_ref", "MidRate": "ptax"})
|
|
306
295
|
.sort("data_ref")
|
|
307
296
|
)
|
|
@@ -346,7 +335,7 @@ def auction(auction_date: DateScalar) -> pl.DataFrame:
|
|
|
346
335
|
{...},
|
|
347
336
|
{
|
|
348
337
|
"quantidade_bcb": 0,
|
|
349
|
-
"liquidacao_segunda_volta": "2025
|
|
338
|
+
"liquidacao_segunda_volta": "30/09/2025",
|
|
350
339
|
"oferta_segunda_volta": 37499,
|
|
351
340
|
"data_leilao": "30/09/2025",
|
|
352
341
|
"oferta": 150000,
|
|
@@ -647,8 +647,6 @@ def di_net_spread( # noqa
|
|
|
647
647
|
ntnf_rate (float): The yield to maturity (YTM) of the bond.
|
|
648
648
|
di_rates (FloatArray): A Series of DI rates.
|
|
649
649
|
di_expirations (DateArray): A list or Series of DI expiration dates.
|
|
650
|
-
initial_guess (float, optional): An initial guess for the spread. Defaults to
|
|
651
|
-
None. A good initial guess is the DI gross spread for the bond.
|
|
652
650
|
|
|
653
651
|
Returns:
|
|
654
652
|
float: The net DI spread in decimal format (e.g., 0.0012 for 12 bps).
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.40.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|