moexapi 1.7.3__tar.gz → 1.7.4__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.3 → moexapi-1.7.4}/PKG-INFO +1 -1
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/tickers.py +11 -7
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi.egg-info/PKG-INFO +1 -1
- {moexapi-1.7.3 → moexapi-1.7.4}/pyproject.toml +1 -1
- {moexapi-1.7.3 → moexapi-1.7.4}/LICENSE +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/README.md +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/__init__.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/bonds.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/candles.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/changeover.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/dividends.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/exchange.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/history.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/markets.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/splits.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi/utils.py +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi.egg-info/SOURCES.txt +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi.egg-info/dependency_links.txt +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi.egg-info/requires.txt +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/moexapi.egg-info/top_level.txt +0 -0
- {moexapi-1.7.3 → moexapi-1.7.4}/setup.cfg +0 -0
|
@@ -37,6 +37,12 @@ def _sur_to_rub(currency: T.Optional[str]) -> T.Optional[str]:
|
|
|
37
37
|
return currency
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
def _get_security_currency(security: dict) -> T.Optional[str]:
|
|
41
|
+
if FACEVALUEONSETTLEDATE in security or LOTVALUE in security:
|
|
42
|
+
return _sur_to_rub(security.get(FACEUNIT, "RUB"))
|
|
43
|
+
return _sur_to_rub(security.get(CURRENCY, "RUB"))
|
|
44
|
+
|
|
45
|
+
|
|
40
46
|
class NotFindTicker(RuntimeError):
|
|
41
47
|
def __init__(self, ticker, candidates):
|
|
42
48
|
self.ticker = ticker
|
|
@@ -76,12 +82,12 @@ class TickerBoardInfo:
|
|
|
76
82
|
securities = utils.prepare_dict(response, "securities")
|
|
77
83
|
marketdata = utils.prepare_dict(response, "marketdata")
|
|
78
84
|
assert len(securities) == len(marketdata)
|
|
79
|
-
boards = []
|
|
85
|
+
boards: list[tuple[str, T.Optional[str]]] = []
|
|
80
86
|
result = None
|
|
81
87
|
for sec_line, market_line in zip(securities, marketdata):
|
|
82
88
|
board = sec_line[BOARDID]
|
|
83
89
|
if board != primary_board:
|
|
84
|
-
boards.append(board)
|
|
90
|
+
boards.append((board, _get_security_currency(sec_line)))
|
|
85
91
|
continue
|
|
86
92
|
else:
|
|
87
93
|
assert result is None, f"Second accurance of ticker {secid}: {result.boards[0]} vs {board}"
|
|
@@ -97,10 +103,7 @@ class TickerBoardInfo:
|
|
|
97
103
|
lotvalue = sec_line.get(FACEVALUEONSETTLEDATE)
|
|
98
104
|
if lotvalue is None:
|
|
99
105
|
lotvalue = sec_line.get(LOTVALUE)
|
|
100
|
-
|
|
101
|
-
currency = _sur_to_rub(sec_line.get(FACEUNIT, "RUB"))
|
|
102
|
-
else:
|
|
103
|
-
currency = _sur_to_rub(sec_line.get(CURRENCY, "RUB"))
|
|
106
|
+
currency = _get_security_currency(sec_line)
|
|
104
107
|
rate = 1
|
|
105
108
|
price = raw_price
|
|
106
109
|
if currency is not None and currency != "RUB" and market != markets.Markets.CURRENCY and price is not None:
|
|
@@ -126,7 +129,7 @@ class TickerBoardInfo:
|
|
|
126
129
|
value=market_line[VALTODAY],
|
|
127
130
|
)
|
|
128
131
|
if result:
|
|
129
|
-
result.boards.extend(boards)
|
|
132
|
+
result.boards.extend(board for board, currency in boards if currency == result.currency)
|
|
130
133
|
response = utils.json_api_call(f"https://iss.moex.com/iss/securities/{secid}.json")
|
|
131
134
|
for line in utils.prepare_dict(response, "boards"):
|
|
132
135
|
board = line[BOARDID.lower()]
|
|
@@ -134,6 +137,7 @@ class TickerBoardInfo:
|
|
|
134
137
|
board not in result.boards
|
|
135
138
|
and line["engine"] in market.engines
|
|
136
139
|
and line["market"] in market.markets
|
|
140
|
+
and _sur_to_rub(line.get(CURRENCY.lower())) == result.currency
|
|
137
141
|
):
|
|
138
142
|
result.boards.append(board)
|
|
139
143
|
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
|