moexapi 1.6.47__tar.gz → 1.6.49__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.
- {moexapi-1.6.47 → moexapi-1.6.49}/PKG-INFO +1 -1
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/bonds.py +1 -1
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/changeover.py +1 -1
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/tickers.py +9 -3
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi.egg-info/PKG-INFO +1 -1
- {moexapi-1.6.47 → moexapi-1.6.49}/pyproject.toml +1 -1
- {moexapi-1.6.47 → moexapi-1.6.49}/LICENSE +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/README.md +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/__init__.py +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/candles.py +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/dividends.py +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/exchange.py +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/history.py +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/markets.py +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/splits.py +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi/utils.py +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi.egg-info/SOURCES.txt +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi.egg-info/dependency_links.txt +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi.egg-info/requires.txt +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/moexapi.egg-info/top_level.txt +0 -0
- {moexapi-1.6.47 → moexapi-1.6.49}/setup.cfg +0 -0
|
@@ -103,7 +103,7 @@ class Bond:
|
|
|
103
103
|
Amortization(date=date, value=line["value"], initialfacevalue=line["initialfacevalue"])
|
|
104
104
|
)
|
|
105
105
|
for line in coupons:
|
|
106
|
-
date = datetime.date.fromisoformat(line["recorddate"])
|
|
106
|
+
date = datetime.date.fromisoformat(line["recorddate"] if line["recorddate"] else line["coupondate"])
|
|
107
107
|
end_date = _max(end_date, date)
|
|
108
108
|
self.coupons.append(
|
|
109
109
|
Coupon(
|
|
@@ -45,7 +45,7 @@ def get_prev_tickers(ticker: tickers.Ticker) -> list[tickers.Ticker]:
|
|
|
45
45
|
for line in changeovers:
|
|
46
46
|
if line.new_secid == result[-1].secid:
|
|
47
47
|
try:
|
|
48
|
-
result.insert(0, tickers.get_ticker(line.old_secid, market=ticker.market))
|
|
48
|
+
result.insert(0, tickers.get_ticker(line.old_secid, market=ticker.market, allow_delisted=True))
|
|
49
49
|
except tickers.NotFindTicker as ex:
|
|
50
50
|
logger.warning(f"Can't find old version {ex.ticker} for {ticker}")
|
|
51
51
|
return result
|
|
@@ -215,7 +215,7 @@ class Ticker:
|
|
|
215
215
|
return result
|
|
216
216
|
|
|
217
217
|
@classmethod
|
|
218
|
-
def from_secid(cls, secid: str, market: markets.Market = markets.Markets.ALL) -> "Ticker":
|
|
218
|
+
def from_secid(cls, secid: str, market: markets.Market = markets.Markets.ALL, allow_delisted: bool = False) -> "Ticker":
|
|
219
219
|
parsed_tickers = _parse_tickers(market=market)
|
|
220
220
|
tickers = [cls.from_listing(ticker) for ticker in parsed_tickers if ticker.secid == secid]
|
|
221
221
|
if len([ticker for ticker in tickers if ticker.is_traded]) == 0:
|
|
@@ -255,6 +255,12 @@ class Ticker:
|
|
|
255
255
|
if len(tickers) != 1:
|
|
256
256
|
if len(tickers) > 1:
|
|
257
257
|
logger.error(f'Find too many tickers for {secid}: {tickers}')
|
|
258
|
+
if allow_delisted and len(tickers) == 0:
|
|
259
|
+
info = TickerInfo.from_secid(secid, market)
|
|
260
|
+
response = utils.json_api_call(f"https://iss.moex.com/iss/securities/{secid}.json")
|
|
261
|
+
boards = [line["boardid"] for line in utils.prepare_dict(response, "boards")]
|
|
262
|
+
if boards:
|
|
263
|
+
return cls(secid=secid, alias=secid, is_traded=False, market=market, shortname=info.shortname, isin=info.isin, subtype=info.subtype, listlevel=info.listlevel, boards=boards, listed_till=info.listed_till)
|
|
258
264
|
raise NotFindTicker(secid, len(tickers))
|
|
259
265
|
tickers[0].alias = secid
|
|
260
266
|
return tickers[0]
|
|
@@ -292,8 +298,8 @@ def _parse_tickers(market: markets.Market = markets.Markets.ALL) -> list[Listing
|
|
|
292
298
|
return list(tickers.values())
|
|
293
299
|
|
|
294
300
|
|
|
295
|
-
def get_ticker(secid: str, market: markets.Market = markets.Markets.ALL) -> Ticker:
|
|
296
|
-
return Ticker.from_secid(secid, market=market)
|
|
301
|
+
def get_ticker(secid: str, market: markets.Market = markets.Markets.ALL, allow_delisted: bool = False) -> Ticker:
|
|
302
|
+
return Ticker.from_secid(secid, market=market, allow_delisted=allow_delisted)
|
|
297
303
|
|
|
298
304
|
|
|
299
305
|
def get_tickers(
|
|
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
|