Move all Qt components into top level ui module

bar_select
Tyler Goodlet 2020-06-17 19:20:54 -04:00
parent 82a5daf91b
commit 0b5af4b590
16 changed files with 16 additions and 10 deletions

View File

@ -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)

View File

@ -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])

View File

@ -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