PYield 0.9.2__tar.gz → 0.9.4__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.9.2 → pyield-0.9.4}/PKG-INFO +1 -1
- pyield-0.9.4/pyield/__about__.py +1 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/anbima.py +11 -15
- {pyield-0.9.2 → pyield-0.9.4}/pyproject.toml +1 -1
- pyield-0.9.2/pyield/__about__.py +0 -1
- {pyield-0.9.2 → pyield-0.9.4}/LICENSE +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/README.md +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/__init__.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/bday.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/date_validator.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/__init__.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/futures/__init__.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/futures/common.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/futures/historical.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/futures/intraday.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/futures/xml.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/indicators.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/fetchers/projections.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/holidays/__init__.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/holidays/br_holidays_new.txt +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/holidays/br_holidays_old.txt +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/holidays/holidays_manager.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/interpolators.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/ntnb.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/py.typed +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/pyield/spreads.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/tests/__init__.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/tests/data/SPRD231222.zip +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/tests/data/SPRD240426.zip +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/tests/test_bday.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/tests/test_futures.py +0 -0
- {pyield-0.9.2 → pyield-0.9.4}/tests/test_futures_xml.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.4"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import io
|
|
2
|
+
import os
|
|
2
3
|
|
|
3
4
|
import pandas as pd
|
|
4
5
|
import requests
|
|
@@ -10,24 +11,22 @@ ANBIMA_URL = "https://www.anbima.com.br/informacoes/merc-sec/arqs/"
|
|
|
10
11
|
# URL example: https://www.anbima.com.br/informacoes/merc-sec/arqs/ms240614.txt
|
|
11
12
|
|
|
12
13
|
|
|
13
|
-
def _get_file_content(
|
|
14
|
-
reference_date: pd.Timestamp,
|
|
15
|
-
remote_access: dict | None = None,
|
|
16
|
-
) -> str:
|
|
14
|
+
def _get_file_content(reference_date: pd.Timestamp) -> str:
|
|
17
15
|
url_date = reference_date.strftime("%y%m%d")
|
|
18
16
|
filename = f"ms{url_date}.txt"
|
|
19
17
|
|
|
20
18
|
# Tries to access the member URL first
|
|
21
19
|
try:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
anbima_base_url = os.getenv("ANBIMA_BASE_URL")
|
|
21
|
+
if anbima_base_url:
|
|
22
|
+
anbima_member_url = f"{anbima_base_url}/merc_sec/arqs/"
|
|
23
|
+
anbima_headers = {"private-token": os.getenv("ANBIMA_TOKEN")}
|
|
25
24
|
else:
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
anbima_member_url = "http://www.anbima.associados.rtm/merc_sec/arqs/"
|
|
26
|
+
anbima_headers = None
|
|
28
27
|
|
|
29
|
-
file_url = f"{
|
|
30
|
-
response = requests.get(file_url, headers=
|
|
28
|
+
file_url = f"{anbima_member_url}{filename}"
|
|
29
|
+
response = requests.get(file_url, headers=anbima_headers, timeout=5)
|
|
31
30
|
# Checks if the response was successful (status code 200)
|
|
32
31
|
response.raise_for_status()
|
|
33
32
|
return response.text
|
|
@@ -93,7 +92,6 @@ def _process_raw_df(df_raw: pd.DataFrame) -> pd.DataFrame:
|
|
|
93
92
|
def anbima(
|
|
94
93
|
reference_date: str | pd.Timestamp | None = None,
|
|
95
94
|
bond_type: str | list[str] | None = None,
|
|
96
|
-
remote_access: dict | None = None,
|
|
97
95
|
) -> pd.DataFrame:
|
|
98
96
|
"""
|
|
99
97
|
Fetches indicative treasury rates from ANBIMA for a specified reference date.
|
|
@@ -106,8 +104,6 @@ def anbima(
|
|
|
106
104
|
fetch the indicative rates. If a string is provided, it should be in the
|
|
107
105
|
format 'dd-mm-yyyy'. Defaults last business day if None.
|
|
108
106
|
bond_type (str, optional): The type of bond to filter by. Defaults to None.
|
|
109
|
-
remote_access (dict, optional): Dictionary containing remote access parameters.
|
|
110
|
-
Defaults to None.
|
|
111
107
|
|
|
112
108
|
Returns:
|
|
113
109
|
pd.DataFrame: A DataFrame containing the processed indicative rates for the
|
|
@@ -125,7 +121,7 @@ def anbima(
|
|
|
125
121
|
"""
|
|
126
122
|
# Normalize the reference date
|
|
127
123
|
normalized_date = dv.normalize_date(reference_date)
|
|
128
|
-
file_content = _get_file_content(normalized_date
|
|
124
|
+
file_content = _get_file_content(normalized_date)
|
|
129
125
|
|
|
130
126
|
if not file_content:
|
|
131
127
|
date_str = normalized_date.strftime("%d-%m-%Y")
|
pyield-0.9.2/pyield/__about__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.9.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
|