More time correction.
This commit is contained in:
parent
dffe6f8e89
commit
53f39a26ef
1 changed files with 3 additions and 3 deletions
|
@ -82,14 +82,14 @@ class Yahoo(BaseSource):
|
||||||
prices = [
|
prices = [
|
||||||
Price(date, amount)
|
Price(date, amount)
|
||||||
for i in range(len(timestamps))
|
for i in range(len(timestamps))
|
||||||
if (date := self._date_from_ts(timestamps[i], offset)) <= series.end
|
if (date := self._ts_to_date(timestamps[i] + offset)) <= series.end
|
||||||
if (amount := self._amount(amounts, series.type, i)) is not None
|
if (amount := self._amount(amounts, series.type, i)) is not None
|
||||||
]
|
]
|
||||||
|
|
||||||
return dataclasses.replace(series, quote=quote, prices=prices)
|
return dataclasses.replace(series, quote=quote, prices=prices)
|
||||||
|
|
||||||
def _date_from_ts(self, ts, offset) -> str:
|
def _ts_to_date(self, ts) -> str:
|
||||||
return datetime.fromtimestamp(ts - offset).strftime("%Y-%m-%d")
|
return datetime.fromtimestamp(ts, tz=timezone.utc).date().isoformat()
|
||||||
|
|
||||||
def _amount(self, amounts, type, i):
|
def _amount(self, amounts, type, i):
|
||||||
if type == "mid" and amounts["high"] != "null" and amounts["low"] != "null":
|
if type == "mid" and amounts["high"] != "null" and amounts["low"] != "null":
|
||||||
|
|
Loading…
Add table
Reference in a new issue