moexapi 1.6.36__tar.gz → 1.6.37__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.36 → moexapi-1.6.37}/PKG-INFO +1 -1
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/tickers.py +9 -12
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi.egg-info/PKG-INFO +1 -1
- {moexapi-1.6.36 → moexapi-1.6.37}/pyproject.toml +1 -1
- {moexapi-1.6.36 → moexapi-1.6.37}/LICENSE +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/README.md +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/__init__.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/bonds.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/candles.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/changeover.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/dividends.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/exchange.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/history.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/markets.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/splits.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi/utils.py +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi.egg-info/SOURCES.txt +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi.egg-info/dependency_links.txt +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi.egg-info/requires.txt +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/moexapi.egg-info/top_level.txt +0 -0
- {moexapi-1.6.36 → moexapi-1.6.37}/setup.cfg +0 -0
|
@@ -208,15 +208,12 @@ class Ticker:
|
|
|
208
208
|
def from_secid(cls, secid: str, market: markets.Market = markets.Markets.ALL) -> "Ticker":
|
|
209
209
|
parsed_tickers = _parse_tickers(market=market)
|
|
210
210
|
tickers = [cls.from_listing(ticker) for ticker in parsed_tickers if ticker.secid == secid]
|
|
211
|
-
tickers_length = len(tickers)
|
|
212
211
|
if len([ticker for ticker in tickers if ticker.is_traded]) == 0:
|
|
213
212
|
tickers.extend([
|
|
214
213
|
cls.from_listing(ticker) for ticker in parsed_tickers if ticker.shortname.replace(' ', '') == secid
|
|
215
214
|
])
|
|
216
|
-
tickers_length = tickers_length if tickers_length > 0 else len(tickers)
|
|
217
215
|
if len([ticker for ticker in tickers if ticker.is_traded]) == 0:
|
|
218
216
|
tickers.extend([cls.from_listing(ticker) for ticker in parsed_tickers if ticker.isin == secid])
|
|
219
|
-
tickers_length = tickers_length if tickers_length > 0 else len(tickers)
|
|
220
217
|
if (
|
|
221
218
|
len([ticker for ticker in tickers if ticker.is_traded]) == 0 and
|
|
222
219
|
len(secid) == 3 and
|
|
@@ -227,18 +224,13 @@ class Ticker:
|
|
|
227
224
|
cls.from_listing(ticker)
|
|
228
225
|
for ticker in parsed_tickers if ticker.secid == cur_secid and market.has(markets.Markets.CURRENCY)
|
|
229
226
|
])
|
|
230
|
-
tickers_length = tickers_length if tickers_length > 0 else len(tickers)
|
|
231
227
|
if len([ticker for ticker in tickers if ticker.is_traded]) == 0:
|
|
232
228
|
tickers.extend([
|
|
233
229
|
cls.from_listing(ticker) for ticker in parsed_tickers
|
|
234
230
|
if ticker.shortname == cur_secid and market.has(markets.Markets.CURRENCY)
|
|
235
231
|
])
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if len([ticker for ticker in tickers if ticker.is_traded]) != 0:
|
|
239
|
-
tickers = [ticker for ticker in tickers if ticker.is_traded]
|
|
240
|
-
else:
|
|
241
|
-
tickers = tickers[:tickers_length]
|
|
232
|
+
if len(tickers) > 1 and len([ticker for ticker in tickers if ticker.is_traded]) != 0:
|
|
233
|
+
tickers = [ticker for ticker in tickers if ticker.is_traded]
|
|
242
234
|
if len(tickers) != 1:
|
|
243
235
|
if len(tickers) > 1:
|
|
244
236
|
logger.error(f'Find too many tickers for {secid}: {tickers}')
|
|
@@ -282,6 +274,11 @@ def get_ticker(secid: str, market: markets.Market = markets.Markets.ALL) -> Tick
|
|
|
282
274
|
return Ticker.from_secid(secid, market=market)
|
|
283
275
|
|
|
284
276
|
|
|
285
|
-
def get_tickers(market: markets.Market = markets.Markets.ALL) -> list[Ticker]:
|
|
277
|
+
def get_tickers(market: markets.Market = markets.Markets.ALL, limit: int = None) -> list[Ticker]:
|
|
286
278
|
tickers = _parse_tickers(market=market)
|
|
287
|
-
|
|
279
|
+
result = []
|
|
280
|
+
for idx, ticker in enumerate(tickers):
|
|
281
|
+
if idx >= limit:
|
|
282
|
+
break
|
|
283
|
+
result.append(Ticker.from_secid(secid=ticker.secid, market=ticker.market))
|
|
284
|
+
return result
|
|
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
|