moexapi 1.7.1__tar.gz → 1.7.3__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.7.1 → moexapi-1.7.3}/PKG-INFO +1 -1
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/markets.py +8 -2
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/tickers.py +14 -3
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi.egg-info/PKG-INFO +1 -1
- {moexapi-1.7.1 → moexapi-1.7.3}/pyproject.toml +1 -1
- {moexapi-1.7.1 → moexapi-1.7.3}/LICENSE +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/README.md +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/__init__.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/bonds.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/candles.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/changeover.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/dividends.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/exchange.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/history.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/splits.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi/utils.py +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi.egg-info/SOURCES.txt +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi.egg-info/dependency_links.txt +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi.egg-info/requires.txt +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/moexapi.egg-info/top_level.txt +0 -0
- {moexapi-1.7.1 → moexapi-1.7.3}/setup.cfg +0 -0
|
@@ -9,11 +9,13 @@ class Market:
|
|
|
9
9
|
engines: set[str] = frozenset(),
|
|
10
10
|
markets: set[str] = frozenset(),
|
|
11
11
|
boards: set[str] = frozenset(),
|
|
12
|
+
security_types: set[str] = frozenset(),
|
|
12
13
|
):
|
|
13
14
|
self._name = name
|
|
14
15
|
self._engines = engines
|
|
15
16
|
self._markets = markets
|
|
16
17
|
self._boards = boards
|
|
18
|
+
self._security_types = security_types
|
|
17
19
|
self._parent = parent
|
|
18
20
|
self._childs: list["Market"] = []
|
|
19
21
|
if parent:
|
|
@@ -51,6 +53,10 @@ class Market:
|
|
|
51
53
|
@property
|
|
52
54
|
def boards(self) -> set[str]:
|
|
53
55
|
return self._join("_boards")
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def security_types(self) -> set[str]:
|
|
59
|
+
return self._join("_security_types")
|
|
54
60
|
|
|
55
61
|
def childs(self) -> list["Market"]:
|
|
56
62
|
if len(self._childs) == 0:
|
|
@@ -93,8 +99,8 @@ class Market:
|
|
|
93
99
|
_ALL = Market("all")
|
|
94
100
|
_STOCK = Market("stock", parent=_ALL, engines={"stock"})
|
|
95
101
|
_EQUITY = Market("equity", parent=_STOCK, markets={"shares"})
|
|
96
|
-
_SHARES = Market("shares", parent=_EQUITY,
|
|
97
|
-
_ETFS = Market("etfs", parent=_EQUITY,
|
|
102
|
+
_SHARES = Market("shares", parent=_EQUITY, security_types={"common_share", "preferred_share", "depositary_receipt"})
|
|
103
|
+
_ETFS = Market("etfs", parent=_EQUITY, security_types={"exchange_ppif"})
|
|
98
104
|
_BONDS = Market("bonds", parent=_STOCK, markets={"bonds"})
|
|
99
105
|
_FEDERAL_BONDS = Market("federal bonds", parent=_BONDS, boards={"TQOB"})
|
|
100
106
|
_COMPANY_BONDS = Market("company bonds", parent=_BONDS, boards={"TQCB"})
|
|
@@ -80,7 +80,7 @@ class TickerBoardInfo:
|
|
|
80
80
|
result = None
|
|
81
81
|
for sec_line, market_line in zip(securities, marketdata):
|
|
82
82
|
board = sec_line[BOARDID]
|
|
83
|
-
if
|
|
83
|
+
if board != primary_board:
|
|
84
84
|
boards.append(board)
|
|
85
85
|
continue
|
|
86
86
|
else:
|
|
@@ -127,6 +127,15 @@ class TickerBoardInfo:
|
|
|
127
127
|
)
|
|
128
128
|
if result:
|
|
129
129
|
result.boards.extend(boards)
|
|
130
|
+
response = utils.json_api_call(f"https://iss.moex.com/iss/securities/{secid}.json")
|
|
131
|
+
for line in utils.prepare_dict(response, "boards"):
|
|
132
|
+
board = line[BOARDID.lower()]
|
|
133
|
+
if (
|
|
134
|
+
board not in result.boards
|
|
135
|
+
and line["engine"] in market.engines
|
|
136
|
+
and line["market"] in market.markets
|
|
137
|
+
):
|
|
138
|
+
result.boards.append(board)
|
|
130
139
|
return result
|
|
131
140
|
|
|
132
141
|
|
|
@@ -197,7 +206,7 @@ class Ticker:
|
|
|
197
206
|
result = cls(
|
|
198
207
|
secid=listing.secid,
|
|
199
208
|
alias=listing.secid,
|
|
200
|
-
is_traded=
|
|
209
|
+
is_traded=listing.is_traded,
|
|
201
210
|
market=listing.market,
|
|
202
211
|
shortname=listing.shortname,
|
|
203
212
|
isin=info.isin,
|
|
@@ -279,6 +288,8 @@ def _parse_tickers(market: markets.Market = markets.Markets.ALL) -> list[Listing
|
|
|
279
288
|
if len(securities) == 0:
|
|
280
289
|
break
|
|
281
290
|
for line in securities:
|
|
291
|
+
if child_market.security_types and line.get("type") not in child_market.security_types:
|
|
292
|
+
continue
|
|
282
293
|
isin = line["isin"]
|
|
283
294
|
if isin is None and child_market != markets.Markets.CURRENCY:
|
|
284
295
|
continue
|
|
@@ -305,7 +316,7 @@ def get_ticker(secid: str, market: markets.Market = markets.Markets.ALL, allow_d
|
|
|
305
316
|
def get_tickers(
|
|
306
317
|
market: markets.Market = markets.Markets.ALL,
|
|
307
318
|
is_traded: T.Optional[bool] = None,
|
|
308
|
-
limit: int = None
|
|
319
|
+
limit: T.Optional[int] = None
|
|
309
320
|
) -> list[Ticker]:
|
|
310
321
|
tickers = _parse_tickers(market=market)
|
|
311
322
|
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
|