Skip to content

Commit e6ea716

Browse files
committed
TickStore: Fix ZeroDivisionError
1 parent 250ae10 commit e6ea716

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arctic/tickstore/tickstore.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ def read(self, symbol, date_range=None, columns=None, include_images=False, allo
335335

336336
t = (dt.now() - perf_start).total_seconds()
337337
ticks = len(rtn)
338-
logger.info("%d rows in %s secs: %s ticks/sec" % (ticks, t, int(ticks / t)))
338+
rate = int(ticks / t) if t != 0 else float("nan")
339+
logger.info("%d rows in %s secs: %s ticks/sec" % (ticks, t, rate))
339340
if not rtn.index.is_monotonic:
340341
logger.error("TimeSeries data is out of order, sorting!")
341342
rtn = rtn.sort_index(kind='mergesort')
@@ -537,7 +538,8 @@ def _write(self, buckets):
537538
mongo_retry(self._collection.insert_many)(buckets)
538539
t = (dt.now() - start).total_seconds()
539540
ticks = len(buckets) * self._chunk_size
540-
logger.debug("%d buckets in %s: approx %s ticks/sec" % (len(buckets), t, int(ticks / t)))
541+
rate = int(ticks / t) if t != 0 else float("nan")
542+
logger.debug("%d buckets in %s: approx %s ticks/sec" % (len(buckets), t, rate))
541543

542544
def _pandas_to_buckets(self, x, symbol, initial_image):
543545
rtn = []

0 commit comments

Comments
 (0)