moexapi 1.6.45__tar.gz → 1.6.47__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.45
3
+ Version: 1.6.47
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["coupondate"])
106
+ date = datetime.date.fromisoformat(line["recorddate"])
107
107
  end_date = _max(end_date, date)
108
108
  self.coupons.append(
109
109
  Coupon(
@@ -178,7 +178,7 @@ class Bond:
178
178
  date_from = date_from or datetime.date.today()
179
179
  result = [offer for offer in self.offers if offer.date >= date_from]
180
180
  return result[0] if len(result) > 0 else None
181
-
181
+
182
182
  def has_next_offer(self, date_from: T.Optional[datetime.date] = None) -> bool:
183
183
  return self.next_offer(date_from=date_from) is not None
184
184
 
@@ -57,7 +57,7 @@ class Candle:
57
57
  volume=first.volume + second.volume,
58
58
  value=first.value + second.value,
59
59
  )
60
-
60
+
61
61
  def mult(self, mult: float) -> None:
62
62
  self.low *= mult
63
63
  self.high *= mult
@@ -100,11 +100,15 @@ def _merge_candles_list(candles: list[list[Candle]]) -> list[Candle]:
100
100
  def _parse_candles_one_board(
101
101
  ticker: tickers.Ticker,
102
102
  board: str,
103
- start_date: T.Optional[datetime.datetime] = None,
104
- end_date: T.Optional[datetime.datetime] = None,
103
+ start_date: T.Optional[T.Union[datetime.datetime, str]] = None,
104
+ end_date: T.Optional[T.Union[datetime.datetime, str]] = None,
105
105
  interval: T.Optional[int] = None,
106
106
  ) -> list[Candle]:
107
107
  result = []
108
+ if isinstance(start_date, str):
109
+ start_date = datetime.datetime.fromisoformat(start_date)
110
+ if isinstance(end_date, str):
111
+ end_date = datetime.datetime.fromisoformat(end_date)
108
112
  while True:
109
113
  start_str = f"from={start_date.isoformat()}" if start_date else ""
110
114
  end_str = f"till={end_date.isoformat()}" if end_date else ""
@@ -145,8 +149,8 @@ def _parse_candles_one_board(
145
149
 
146
150
  def _parse_candles(
147
151
  ticker: tickers.Ticker,
148
- start_date: T.Optional[datetime.datetime] = None,
149
- end_date: T.Optional[datetime.datetime] = None,
152
+ start_date: T.Optional[T.Union[datetime.datetime, str]] = None,
153
+ end_date: T.Optional[T.Union[datetime.datetime, str]] = None,
150
154
  interval: T.Optional[int] = None,
151
155
  ):
152
156
  candles = []
@@ -159,8 +163,8 @@ def _parse_candles(
159
163
 
160
164
  def get_candles(
161
165
  ticker: tickers.Ticker,
162
- start_date: T.Optional[datetime.datetime] = None,
163
- end_date: T.Optional[datetime.datetime] = None,
166
+ start_date: T.Optional[T.Union[datetime.datetime, str]] = None,
167
+ end_date: T.Optional[T.Union[datetime.datetime, str]] = None,
164
168
  interval: T.Optional[int] = None,
165
169
  ):
166
170
  ticker = changeover.get_current_ticker(ticker)
@@ -172,6 +176,6 @@ def get_candles(
172
176
  result = _merge_candles_list(candles)
173
177
  for split in ticker_splits:
174
178
  for candle in result:
175
- if candle.end < split.date:
179
+ if candle.end.date() < split.date:
176
180
  candle.mult(1 / split.mult)
177
181
  return result
@@ -64,14 +64,15 @@ class History:
64
64
  volume=_maybe_sum(first.volume, second.volume),
65
65
  value=_maybe_sum(first.value, second.value),
66
66
  )
67
-
67
+
68
68
  def mult(self, mult: float) -> None:
69
69
  self.low *= mult
70
70
  self.high *= mult
71
71
  self.open *= mult
72
72
  self.close *= mult
73
73
  self.mid_price *= mult
74
- self.value *= mult
74
+ if self.value is not None:
75
+ self.value *= mult
75
76
 
76
77
 
77
78
  def _merge_history(first: list[History], second: list[History]) -> list[History]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moexapi
3
- Version: 1.6.45
3
+ Version: 1.6.47
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.45"
7
+ version = "1.6.47"
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