moexapi 1.7.15__tar.gz → 1.7.16__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.15 → moexapi-1.7.16}/PKG-INFO +1 -1
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/candles.py +6 -1
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/history.py +8 -1
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi.egg-info/PKG-INFO +1 -1
- {moexapi-1.7.15 → moexapi-1.7.16}/pyproject.toml +1 -1
- {moexapi-1.7.15 → moexapi-1.7.16}/LICENSE +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/README.md +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/__init__.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/bonds.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/changeover.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/dividends.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/exchange.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/markets.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/splits.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/tickers.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi/utils.py +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi.egg-info/SOURCES.txt +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi.egg-info/dependency_links.txt +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi.egg-info/requires.txt +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/moexapi.egg-info/top_level.txt +0 -0
- {moexapi-1.7.15 → moexapi-1.7.16}/setup.cfg +0 -0
|
@@ -22,7 +22,8 @@ class Candle:
|
|
|
22
22
|
open -- open price of the day
|
|
23
23
|
close -- close price of the day
|
|
24
24
|
volume -- number of shares/bonds/currencies sold on the day
|
|
25
|
-
value -- sum of all transactions in
|
|
25
|
+
value -- sum of all transactions in currency for the day
|
|
26
|
+
currency -- currency of transaction value
|
|
26
27
|
"""
|
|
27
28
|
start: datetime.datetime
|
|
28
29
|
end: datetime.datetime
|
|
@@ -32,9 +33,11 @@ class Candle:
|
|
|
32
33
|
close: float
|
|
33
34
|
volume: T.Optional[int]
|
|
34
35
|
value: T.Optional[float]
|
|
36
|
+
currency: T.Optional[str] = None
|
|
35
37
|
|
|
36
38
|
@classmethod
|
|
37
39
|
def merge(cls, first: 'Candle', second: 'Candle'):
|
|
40
|
+
assert first.currency == second.currency, "Can't merge candles in different currencies"
|
|
38
41
|
if second.start < first.start:
|
|
39
42
|
start = second.start
|
|
40
43
|
open = second.open
|
|
@@ -56,6 +59,7 @@ class Candle:
|
|
|
56
59
|
close=close,
|
|
57
60
|
volume=first.volume + second.volume,
|
|
58
61
|
value=first.value + second.value,
|
|
62
|
+
currency=first.currency,
|
|
59
63
|
)
|
|
60
64
|
|
|
61
65
|
def mult(self, mult: float) -> None:
|
|
@@ -141,6 +145,7 @@ def _parse_candles_one_board(
|
|
|
141
145
|
close=close,
|
|
142
146
|
volume=line.get("volume"),
|
|
143
147
|
value=line.get("value"),
|
|
148
|
+
currency=tickers._sur_to_rub(ticker.currency),
|
|
144
149
|
)
|
|
145
150
|
)
|
|
146
151
|
if len(candles) == 0:
|
|
@@ -38,7 +38,8 @@ class History:
|
|
|
38
38
|
mid_price -- weighted average price of the day
|
|
39
39
|
numtrades -- number of trades for the day
|
|
40
40
|
volume -- number of shares/bonds/currencies sold on the day
|
|
41
|
-
value -- sum of all transactions in
|
|
41
|
+
value -- sum of all transactions in currency for the day
|
|
42
|
+
currency -- currency of transaction value
|
|
42
43
|
"""
|
|
43
44
|
date: datetime.date
|
|
44
45
|
low: float
|
|
@@ -49,10 +50,12 @@ class History:
|
|
|
49
50
|
numtrades: int
|
|
50
51
|
volume: T.Optional[int]
|
|
51
52
|
value: T.Optional[float]
|
|
53
|
+
currency: T.Optional[str] = None
|
|
52
54
|
|
|
53
55
|
@classmethod
|
|
54
56
|
def merge(cls, first: 'History', second: 'History'):
|
|
55
57
|
assert first.date == second.date
|
|
58
|
+
assert first.currency == second.currency, "Can't merge history in different currencies"
|
|
56
59
|
return cls(
|
|
57
60
|
date=first.date,
|
|
58
61
|
low=min(first.low, second.low),
|
|
@@ -63,6 +66,7 @@ class History:
|
|
|
63
66
|
numtrades=first.numtrades + second.numtrades,
|
|
64
67
|
volume=_maybe_sum(first.volume, second.volume),
|
|
65
68
|
value=_maybe_sum(first.value, second.value),
|
|
69
|
+
currency=first.currency,
|
|
66
70
|
)
|
|
67
71
|
|
|
68
72
|
def mult(self, mult: float) -> None:
|
|
@@ -134,8 +138,10 @@ def _parse_history(
|
|
|
134
138
|
if low == 0.0 or high == 0.0 or open == 0.0 or close == 0.0:
|
|
135
139
|
continue
|
|
136
140
|
value = line.get("VALUE")
|
|
141
|
+
currency = tickers._sur_to_rub(line.get("CURRENCYID") or ticker.currency)
|
|
137
142
|
if ticker.market == markets.Markets.CURRENCY:
|
|
138
143
|
value = line.get("VOLRUR")
|
|
144
|
+
currency = "RUB"
|
|
139
145
|
item = History(
|
|
140
146
|
date=date,
|
|
141
147
|
low=low,
|
|
@@ -146,6 +152,7 @@ def _parse_history(
|
|
|
146
152
|
numtrades=line.get("NUMTRADES") or 0,
|
|
147
153
|
volume=line.get("VOLUME"),
|
|
148
154
|
value=value,
|
|
155
|
+
currency=currency,
|
|
149
156
|
)
|
|
150
157
|
if len(result) > 0 and result[-1].date == date:
|
|
151
158
|
if board in boards:
|
|
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
|