moexapi 1.6.48__tar.gz → 1.7.1__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.48 → moexapi-1.7.1}/PKG-INFO +1 -1
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/bonds.py +1 -1
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/candles.py +23 -3
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi.egg-info/PKG-INFO +1 -1
- {moexapi-1.6.48 → moexapi-1.7.1}/pyproject.toml +1 -1
- {moexapi-1.6.48 → moexapi-1.7.1}/LICENSE +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/README.md +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/__init__.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/changeover.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/dividends.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/exchange.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/history.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/markets.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/splits.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/tickers.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi/utils.py +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi.egg-info/SOURCES.txt +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi.egg-info/dependency_links.txt +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi.egg-info/requires.txt +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/moexapi.egg-info/top_level.txt +0 -0
- {moexapi-1.6.48 → moexapi-1.7.1}/setup.cfg +0 -0
|
@@ -103,7 +103,7 @@ class Bond:
|
|
|
103
103
|
Amortization(date=date, value=line["value"], initialfacevalue=line["initialfacevalue"])
|
|
104
104
|
)
|
|
105
105
|
for line in coupons:
|
|
106
|
-
date = datetime.date.fromisoformat(line["recorddate"])
|
|
106
|
+
date = datetime.date.fromisoformat(line["recorddate"] if line["recorddate"] else line["coupondate"])
|
|
107
107
|
end_date = _max(end_date, date)
|
|
108
108
|
self.coupons.append(
|
|
109
109
|
Coupon(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import typing as T
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import concurrent.futures
|
|
4
4
|
import dataclasses
|
|
5
5
|
import datetime
|
|
6
6
|
|
|
@@ -163,8 +163,8 @@ def _parse_candles(
|
|
|
163
163
|
|
|
164
164
|
def get_candles(
|
|
165
165
|
ticker: tickers.Ticker,
|
|
166
|
-
start_date: T.Optional[T.Union[datetime.datetime, str]] = None,
|
|
167
|
-
end_date: T.Optional[T.Union[datetime.datetime, str]] = None,
|
|
166
|
+
start_date: T.Optional[T.Union[datetime.datetime, datetime.date, str]] = None,
|
|
167
|
+
end_date: T.Optional[T.Union[datetime.datetime, datetime.date, str]] = None,
|
|
168
168
|
interval: T.Optional[int] = None,
|
|
169
169
|
):
|
|
170
170
|
ticker = changeover.get_current_ticker(ticker)
|
|
@@ -179,3 +179,23 @@ def get_candles(
|
|
|
179
179
|
if candle.end.date() < split.date:
|
|
180
180
|
candle.mult(1 / split.mult)
|
|
181
181
|
return result
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def get_candles_batch(
|
|
185
|
+
ticker_list: list[tickers.Ticker],
|
|
186
|
+
start_date: T.Optional[T.Union[datetime.datetime, datetime.date, str]] = None,
|
|
187
|
+
end_date: T.Optional[T.Union[datetime.datetime, datetime.date, str]] = None,
|
|
188
|
+
interval: T.Optional[int] = None,
|
|
189
|
+
max_workers: T.Optional[int] = None,
|
|
190
|
+
) -> list[list[Candle]]:
|
|
191
|
+
"""Load candles for multiple tickers concurrently, keyed by SECID."""
|
|
192
|
+
def load(ticker: tickers.Ticker) -> tuple[str, list[Candle]]:
|
|
193
|
+
return get_candles(
|
|
194
|
+
ticker,
|
|
195
|
+
start_date=start_date,
|
|
196
|
+
end_date=end_date,
|
|
197
|
+
interval=interval,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
|
|
201
|
+
return list(executor.map(load, ticker_list))
|
|
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
|