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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moexapi
3
- Version: 1.7.1
3
+ Version: 1.7.3
4
4
  Summary: Python API for MOEX ISS
5
5
  Author-email: Aliaksei Rak <kventinel@gmail.com>
6
6
  License: MIT License
@@ -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, boards={"TQBR", "EQBR", "EQNE", "EQNL", "EQBS"})
97
- _ETFS = Market("etfs", parent=_EQUITY, boards={"TQTF", "TQTD", "TQTY"})
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 market.boards and board != primary_board:
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=info.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 = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moexapi
3
- Version: 1.7.1
3
+ Version: 1.7.3
4
4
  Summary: Python API for MOEX ISS
5
5
  Author-email: Aliaksei Rak <kventinel@gmail.com>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "moexapi"
7
- version = "1.7.1"
7
+ version = "1.7.3"
8
8
  description = "Python API for MOEX ISS"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Aliaksei Rak", email = "kventinel@gmail.com" }]
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