moexapi 1.6.46__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.
- {moexapi-1.6.46 → moexapi-1.6.47}/PKG-INFO +1 -1
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/candles.py +12 -8
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/history.py +3 -2
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi.egg-info/PKG-INFO +1 -1
- {moexapi-1.6.46 → moexapi-1.6.47}/pyproject.toml +1 -1
- {moexapi-1.6.46 → moexapi-1.6.47}/LICENSE +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/README.md +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/__init__.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/bonds.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/changeover.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/dividends.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/exchange.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/markets.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/splits.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/tickers.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi/utils.py +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi.egg-info/SOURCES.txt +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi.egg-info/dependency_links.txt +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi.egg-info/requires.txt +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/moexapi.egg-info/top_level.txt +0 -0
- {moexapi-1.6.46 → moexapi-1.6.47}/setup.cfg +0 -0
|
@@ -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
|
|
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]:
|
|
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
|