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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moexapi
3
- Version: 1.6.48
3
+ Version: 1.7.1
4
4
  Summary: Python API for MOEX ISS
5
5
  Author-email: Aliaksei Rak <kventinel@gmail.com>
6
6
  License: MIT License
@@ -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 copy
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))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moexapi
3
- Version: 1.6.48
3
+ Version: 1.7.1
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.6.48"
7
+ version = "1.7.1"
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