ohlcutils 0.2.1__tar.gz → 0.2.2__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.
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/PKG-INFO +1 -1
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/data.py +14 -2
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils.egg-info/PKG-INFO +1 -1
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/pyproject.toml +1 -1
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/README.md +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/__init__.py +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/_arg_validators.py +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/archive.py +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/charting.py +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/config/config_sample.yaml +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/config.py +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/enums.py +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/indicators.py +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils/testing.py +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils.egg-info/SOURCES.txt +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils.egg-info/dependency_links.txt +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils.egg-info/requires.txt +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/ohlcutils.egg-info/top_level.txt +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/setup.cfg +0 -0
- {ohlcutils-0.2.1 → ohlcutils-0.2.2}/tests/test_archive.py +0 -0
|
@@ -98,17 +98,29 @@ def get_linked_symbols(short_symbol: str, complete=False) -> pd.DataFrame:
|
|
|
98
98
|
"""
|
|
99
99
|
out = pd.DataFrame()
|
|
100
100
|
end_time = dt.date.today().strftime("%Y-%m-%d")
|
|
101
|
+
# Several rows can share a symbol (NSE lists e.g. NOVARTIS and NOVARTIND -> EVONILE); take the latest
|
|
102
|
+
# row (by date, then file order) and stop on repeats so the chain can never loop forever.
|
|
101
103
|
if complete:
|
|
104
|
+
seen = {short_symbol}
|
|
102
105
|
while True:
|
|
103
106
|
temp = symbolchange.loc[(symbolchange["oldsymbol"] == short_symbol) & (symbolchange["newsymbol"] != "")]
|
|
104
|
-
if len(temp) == 1:
|
|
105
|
-
short_symbol = temp["newsymbol"].item()
|
|
106
107
|
if len(temp) == 0:
|
|
107
108
|
break
|
|
109
|
+
temp = temp.sort_values("effectivedate", kind="stable").tail(1)
|
|
110
|
+
if temp["newsymbol"].item() in seen:
|
|
111
|
+
break
|
|
112
|
+
short_symbol = temp["newsymbol"].item()
|
|
113
|
+
seen.add(short_symbol)
|
|
108
114
|
|
|
115
|
+
seen = {short_symbol}
|
|
109
116
|
while True:
|
|
110
117
|
temp = symbolchange.loc[(symbolchange["newsymbol"] == short_symbol) & (symbolchange["oldsymbol"] != "")]
|
|
118
|
+
if len(temp) > 1:
|
|
119
|
+
temp = temp.sort_values("effectivedate", kind="stable").tail(1)
|
|
120
|
+
if len(temp) == 1 and temp.iloc[0]["oldsymbol"] in seen:
|
|
121
|
+
temp = temp.iloc[0:0]
|
|
111
122
|
if len(temp) == 1:
|
|
123
|
+
seen.add(temp.iloc[0]["oldsymbol"])
|
|
112
124
|
new_row = {
|
|
113
125
|
"starttime": temp.iloc[0]["effectivedate"],
|
|
114
126
|
"endtime": end_time,
|
|
@@ -27,7 +27,7 @@ include-package-data = true
|
|
|
27
27
|
|
|
28
28
|
[project]
|
|
29
29
|
name = "ohlcutils"
|
|
30
|
-
version = "0.2.
|
|
30
|
+
version = "0.2.2"
|
|
31
31
|
description = "A lightweight Python library for python utilities for holidays, dates, options and other tools"
|
|
32
32
|
readme = "README.md"
|
|
33
33
|
license = "MIT"
|
|
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
|