From 0b5af4b5905d56176071d94d9d062f9bdccce650 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 17 Jun 2020 19:20:54 -0400 Subject: [PATCH] Move all Qt components into top level ui module --- piker/ui/{qt => }/_axes.py | 0 piker/ui/{qt => }/_chart.py | 0 piker/ui/{qt => }/_exec.py | 0 piker/ui/{qt => }/_graphics.py | 0 piker/ui/{qt => }/_source.py | 0 piker/ui/{qt => }/_style.py | 0 piker/ui/cli.py | 2 +- piker/ui/{qt => }/quantdom/__init__.py | 0 piker/ui/{qt => }/quantdom/_equity.py | 0 piker/ui/{qt => }/quantdom/base.py | 1 + piker/ui/{qt => }/quantdom/charts.py | 0 piker/ui/{qt => }/quantdom/const.py | 0 piker/ui/{qt => }/quantdom/loaders.py | 23 ++++++++++++++--------- piker/ui/{qt => }/quantdom/performance.py | 0 piker/ui/{qt => }/quantdom/portfolio.py | 0 piker/ui/{qt => }/quantdom/utils.py | 0 16 files changed, 16 insertions(+), 10 deletions(-) rename piker/ui/{qt => }/_axes.py (100%) rename piker/ui/{qt => }/_chart.py (100%) rename piker/ui/{qt => }/_exec.py (100%) rename piker/ui/{qt => }/_graphics.py (100%) rename piker/ui/{qt => }/_source.py (100%) rename piker/ui/{qt => }/_style.py (100%) rename piker/ui/{qt => }/quantdom/__init__.py (100%) rename piker/ui/{qt => }/quantdom/_equity.py (100%) rename piker/ui/{qt => }/quantdom/base.py (99%) rename piker/ui/{qt => }/quantdom/charts.py (100%) rename piker/ui/{qt => }/quantdom/const.py (100%) rename piker/ui/{qt => }/quantdom/loaders.py (90%) rename piker/ui/{qt => }/quantdom/performance.py (100%) rename piker/ui/{qt => }/quantdom/portfolio.py (100%) rename piker/ui/{qt => }/quantdom/utils.py (100%) diff --git a/piker/ui/qt/_axes.py b/piker/ui/_axes.py similarity index 100% rename from piker/ui/qt/_axes.py rename to piker/ui/_axes.py diff --git a/piker/ui/qt/_chart.py b/piker/ui/_chart.py similarity index 100% rename from piker/ui/qt/_chart.py rename to piker/ui/_chart.py diff --git a/piker/ui/qt/_exec.py b/piker/ui/_exec.py similarity index 100% rename from piker/ui/qt/_exec.py rename to piker/ui/_exec.py diff --git a/piker/ui/qt/_graphics.py b/piker/ui/_graphics.py similarity index 100% rename from piker/ui/qt/_graphics.py rename to piker/ui/_graphics.py diff --git a/piker/ui/qt/_source.py b/piker/ui/_source.py similarity index 100% rename from piker/ui/qt/_source.py rename to piker/ui/_source.py diff --git a/piker/ui/qt/_style.py b/piker/ui/_style.py similarity index 100% rename from piker/ui/qt/_style.py rename to piker/ui/_style.py diff --git a/piker/ui/cli.py b/piker/ui/cli.py index 59d7bfb5..78c749df 100644 --- a/piker/ui/cli.py +++ b/piker/ui/cli.py @@ -115,6 +115,6 @@ def optschain(config, symbol, date, tl, rate, test): def chart(config, symbol, date, tl, rate, test): """Start an option chain UI """ - from .qt._chart import main + from ._chart import main main(symbol) diff --git a/piker/ui/qt/quantdom/__init__.py b/piker/ui/quantdom/__init__.py similarity index 100% rename from piker/ui/qt/quantdom/__init__.py rename to piker/ui/quantdom/__init__.py diff --git a/piker/ui/qt/quantdom/_equity.py b/piker/ui/quantdom/_equity.py similarity index 100% rename from piker/ui/qt/quantdom/_equity.py rename to piker/ui/quantdom/_equity.py diff --git a/piker/ui/qt/quantdom/base.py b/piker/ui/quantdom/base.py similarity index 99% rename from piker/ui/qt/quantdom/base.py rename to piker/ui/quantdom/base.py index 9f5eb074..fed59508 100644 --- a/piker/ui/qt/quantdom/base.py +++ b/piker/ui/quantdom/base.py @@ -89,6 +89,7 @@ class BaseQuotes(np.recarray): return self def convert_dates(self, dates): + breakpoint() return np.array([d.timestamp().time for d in dates]) diff --git a/piker/ui/qt/quantdom/charts.py b/piker/ui/quantdom/charts.py similarity index 100% rename from piker/ui/qt/quantdom/charts.py rename to piker/ui/quantdom/charts.py diff --git a/piker/ui/qt/quantdom/const.py b/piker/ui/quantdom/const.py similarity index 100% rename from piker/ui/qt/quantdom/const.py rename to piker/ui/quantdom/const.py diff --git a/piker/ui/qt/quantdom/loaders.py b/piker/ui/quantdom/loaders.py similarity index 90% rename from piker/ui/qt/quantdom/loaders.py rename to piker/ui/quantdom/loaders.py index c3bc6069..8de6c274 100644 --- a/piker/ui/qt/quantdom/loaders.py +++ b/piker/ui/quantdom/loaders.py @@ -62,14 +62,18 @@ class QuotesLoader: @classmethod def _save_to_disk(cls, fpath, data): logger.debug('Saving quotes to a file: %s', fpath) + breakpoint() with open(fpath, 'wb') as f: + pass pickle.dump(data, f, pickle.HIGHEST_PROTOCOL) + d = pickle.load(f) @classmethod def _load_from_disk(cls, fpath): logger.debug('Loading quotes from a file: %s', fpath) with open(fpath, 'rb') as f: - return pickle.load(f) + breakpoint() + data = pickle.load(f) @classmethod @timeit @@ -84,14 +88,15 @@ class QuotesLoader: quotes = None fpath = cls._get_file_path(symbol, cls.timeframe, date_from, date_to) - if os.path.exists(fpath): - quotes = Quotes.new(cls._load_from_disk(fpath)) - else: - quotes_raw = cls._get(symbol, date_from, date_to) - quotes = Quotes.new( - quotes_raw, source=cls.source, default_tf=cls.default_tf - ) - cls._save_to_disk(fpath, quotes) + # if os.path.exists(fpath): + # quotes = Quotes.new(cls._load_from_disk(fpath)) + # else: + quotes_raw = cls._get(symbol, date_from, date_to) + breakpoint() + quotes = Quotes.new( + quotes_raw, source=cls.source, default_tf=cls.default_tf + ) + cls._save_to_disk(fpath, quotes) return quotes diff --git a/piker/ui/qt/quantdom/performance.py b/piker/ui/quantdom/performance.py similarity index 100% rename from piker/ui/qt/quantdom/performance.py rename to piker/ui/quantdom/performance.py diff --git a/piker/ui/qt/quantdom/portfolio.py b/piker/ui/quantdom/portfolio.py similarity index 100% rename from piker/ui/qt/quantdom/portfolio.py rename to piker/ui/quantdom/portfolio.py diff --git a/piker/ui/qt/quantdom/utils.py b/piker/ui/quantdom/utils.py similarity index 100% rename from piker/ui/qt/quantdom/utils.py rename to piker/ui/quantdom/utils.py