moexapi 1.6.43__tar.gz → 1.6.44__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.43 → moexapi-1.6.44}/PKG-INFO +1 -1
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/tickers.py +16 -2
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi.egg-info/PKG-INFO +1 -1
- {moexapi-1.6.43 → moexapi-1.6.44}/pyproject.toml +1 -1
- {moexapi-1.6.43 → moexapi-1.6.44}/LICENSE +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/README.md +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/__init__.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/bonds.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/candles.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/changeover.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/dividends.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/exchange.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/history.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/markets.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/splits.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi/utils.py +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi.egg-info/SOURCES.txt +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi.egg-info/dependency_links.txt +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi.egg-info/requires.txt +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/moexapi.egg-info/top_level.txt +0 -0
- {moexapi-1.6.43 → moexapi-1.6.44}/setup.cfg +0 -0
|
@@ -28,6 +28,7 @@ ACCRUEDINT = "ACCRUEDINT"
|
|
|
28
28
|
VALTODAY = "VALTODAY"
|
|
29
29
|
CURRENCY = "CURRENCYID"
|
|
30
30
|
IS_TRADED = "is_traded"
|
|
31
|
+
LISTED_TILL = "listed_till"
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
def _sur_to_rub(currency: T.Optional[str]) -> T.Optional[str]:
|
|
@@ -145,22 +146,29 @@ class TickerInfo:
|
|
|
145
146
|
isin: T.Optional[str]
|
|
146
147
|
subtype: T.Optional[str]
|
|
147
148
|
listlevel: T.Optional[int]
|
|
149
|
+
listed_till: T.Optional[datetime.date] = None
|
|
148
150
|
|
|
149
151
|
@classmethod
|
|
150
152
|
def from_secid(cls, secid: str, market: markets.Market) -> "TickerInfo":
|
|
151
153
|
response = utils.json_api_call(f"https://iss.moex.com/iss/securities/{secid}.json")
|
|
152
154
|
boards = utils.prepare_dict(response, "boards")
|
|
153
155
|
is_traded = False
|
|
156
|
+
listed_till = datetime.date.min
|
|
154
157
|
for line in boards:
|
|
155
158
|
if not market.boards or line[BOARDID.lower()] in market.boards and line[IS_TRADED] == 1:
|
|
156
159
|
is_traded = True
|
|
160
|
+
if line[LISTED_TILL] is not None and listed_till is not None:
|
|
161
|
+
listed_till = max(listed_till, datetime.date.fromisoformat(line[LISTED_TILL]))
|
|
162
|
+
else:
|
|
163
|
+
listed_till = None
|
|
157
164
|
description = get_ticker_info_dict(secid)
|
|
158
165
|
return cls(
|
|
159
166
|
shortname=description.get(SHORTNAME),
|
|
160
167
|
isin=description.get(ISIN),
|
|
161
168
|
subtype=description.get(SECSUBTYPE),
|
|
162
169
|
listlevel=int(description[LISTLEVEL]) if LISTLEVEL in description else None,
|
|
163
|
-
is_traded=is_traded
|
|
170
|
+
is_traded=is_traded,
|
|
171
|
+
listed_till=listed_till,
|
|
164
172
|
)
|
|
165
173
|
|
|
166
174
|
|
|
@@ -181,7 +189,7 @@ class Ticker:
|
|
|
181
189
|
price_in_rub: T.Optional[float] = None
|
|
182
190
|
accumulated_coupon: T.Optional[float] = None
|
|
183
191
|
value: T.Optional[float] = None
|
|
184
|
-
|
|
192
|
+
listed_till: T.Optional[datetime.date] = None
|
|
185
193
|
@classmethod
|
|
186
194
|
def from_listing(cls, listing: Listing) -> "Ticker":
|
|
187
195
|
info = TickerInfo.from_secid(listing.secid, listing.market)
|
|
@@ -195,6 +203,7 @@ class Ticker:
|
|
|
195
203
|
isin=info.isin,
|
|
196
204
|
subtype=info.subtype,
|
|
197
205
|
listlevel=info.listlevel,
|
|
206
|
+
listed_till=info.listed_till,
|
|
198
207
|
)
|
|
199
208
|
board_info = TickerBoardInfo.from_secid(listing.secid, listing.market, listing.board)
|
|
200
209
|
if board_info is not None:
|
|
@@ -238,6 +247,11 @@ class Ticker:
|
|
|
238
247
|
if ticker not in unique_tickers:
|
|
239
248
|
unique_tickers.append(ticker)
|
|
240
249
|
tickers = unique_tickers
|
|
250
|
+
if len(tickers) > 1 and any(ticker.listed_till is None for ticker in tickers):
|
|
251
|
+
tickers = [ticker for ticker in tickers if ticker.listed_till is None]
|
|
252
|
+
if len(tickers) > 1:
|
|
253
|
+
max_listed_till = max(ticker.listed_till for ticker in tickers)
|
|
254
|
+
tickers = [ticker for ticker in tickers if ticker.listed_till == max_listed_till]
|
|
241
255
|
if len(tickers) != 1:
|
|
242
256
|
if len(tickers) > 1:
|
|
243
257
|
logger.error(f'Find too many tickers for {secid}: {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
|
|
File without changes
|
|
File without changes
|