Compare commits

...

5 Commits

Author SHA1 Message Date
ValueRaider
56759e3f3c Bump version to 0.1.87 2022-11-16 12:38:10 +00:00
ValueRaider
c193428b38 Merge pull request #1163 from ranaroussi/patch/threads-print-deadlock
Fix disable prints inside threads (bpython deadlock)
2022-11-16 12:36:48 +00:00
ValueRaider
a625d9e9c5 Merge pull request #1176 from ranaroussi/patch/dst-nonexistent
Fix localizing midnight when non-existent (DST)
2022-11-16 12:33:54 +00:00
ValueRaider
36e80a73f7 Fix localizing midnight when non-existent (DST) 2022-11-16 12:28:29 +00:00
ValueRaider
bad6456a44 Fix disable prints inside threads (bpython deadlock) 2022-11-10 18:30:34 +00:00
4 changed files with 20 additions and 12 deletions

View File

@@ -1,6 +1,11 @@
Change Log
===========
0.1.87
------
- Fix localizing midnight when non-existent (DST) #1176
- Fix thread deadlock in bpython #1163
0.1.86
------
- Fix 'trailingPegRatio' #1141

View File

@@ -145,6 +145,9 @@ class TickerBase():
debug_mode = True
if "debug" in kwargs and isinstance(kwargs["debug"], bool):
debug_mode = kwargs["debug"]
if "many" in kwargs and kwargs["many"]:
# Disable prints with threads, it deadlocks/throws
debug_mode = False
err_msg = "No data found for this date range, symbol may be delisted"
@@ -155,7 +158,7 @@ class TickerBase():
# Every valid ticker has a timezone. Missing = problem
shared._DFS[self.ticker] = utils.empty_df()
shared._ERRORS[self.ticker] = err_msg
if "many" not in kwargs and debug_mode:
if debug_mode:
print('- %s: %s' % (self.ticker, err_msg))
return utils.empty_df()
@@ -216,7 +219,7 @@ class TickerBase():
if data is None or not type(data) is dict or 'status_code' in data.keys():
shared._DFS[self.ticker] = utils.empty_df()
shared._ERRORS[self.ticker] = err_msg
if "many" not in kwargs and debug_mode:
if debug_mode:
print('- %s: %s' % (self.ticker, err_msg))
return utils.empty_df()
@@ -224,7 +227,7 @@ class TickerBase():
err_msg = data["chart"]["error"]["description"]
shared._DFS[self.ticker] = utils.empty_df()
shared._ERRORS[self.ticker] = err_msg
if "many" not in kwargs and debug_mode:
if debug_mode:
print('- %s: %s' % (self.ticker, err_msg))
return shared._DFS[self.ticker]
@@ -232,7 +235,7 @@ class TickerBase():
not data["chart"]["result"]:
shared._DFS[self.ticker] = utils.empty_df()
shared._ERRORS[self.ticker] = err_msg
if "many" not in kwargs and debug_mode:
if debug_mode:
print('- %s: %s' % (self.ticker, err_msg))
return shared._DFS[self.ticker]
@@ -247,7 +250,7 @@ class TickerBase():
except Exception:
shared._DFS[self.ticker] = utils.empty_df()
shared._ERRORS[self.ticker] = err_msg
if "many" not in kwargs and debug_mode:
if debug_mode:
print('- %s: %s' % (self.ticker, err_msg))
return shared._DFS[self.ticker]
@@ -283,7 +286,7 @@ class TickerBase():
err_msg = "back_adjust failed with %s" % e
shared._DFS[self.ticker] = utils.empty_df()
shared._ERRORS[self.ticker] = err_msg
if "many" not in kwargs and debug_mode:
if debug_mode:
print('- %s: %s' % (self.ticker, err_msg))
if rounding:
@@ -313,7 +316,7 @@ class TickerBase():
else:
# If a midnight is during DST transition hour when clocks roll back,
# meaning clock hits midnight twice, then use the 2nd (ambiguous=True)
df.index = _pd.to_datetime(df.index.date).tz_localize(tz_exchange, ambiguous=True)
df.index = _pd.to_datetime(df.index.date).tz_localize(tz_exchange, ambiguous=True, nonexistent='shift_forward')
df.index.name = "Date"
# duplicates and missing rows cleanup

View File

@@ -198,7 +198,7 @@ def _download_one_threaded(ticker, start=None, end=None,
data = _download_one(ticker, start, end, auto_adjust, back_adjust,
actions, period, interval, prepost, proxy, rounding,
keepna, timeout)
keepna, timeout, many=True)
shared._DFS[ticker.upper()] = data
if progress:
shared._PROGRESS_BAR.animate()
@@ -208,11 +208,11 @@ def _download_one(ticker, start=None, end=None,
auto_adjust=False, back_adjust=False,
actions=False, period="max", interval="1d",
prepost=False, proxy=None, rounding=False,
keepna=False, timeout=None):
keepna=False, timeout=None, many=False):
return Ticker(ticker).history(period=period, interval=interval,
start=start, end=end, prepost=prepost,
actions=actions, auto_adjust=auto_adjust,
back_adjust=back_adjust, proxy=proxy,
rounding=rounding, keepna=keepna, many=True,
timeout=timeout)
rounding=rounding, keepna=keepna, timeout=timeout,
many=many)

View File

@@ -1 +1 @@
version = "0.1.86"
version = "0.1.87"