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): def chart(config, symbol, date, tl, rate, test):
"""Start an option chain UI """Start an option chain UI
""" """
from .qt._chart import main from ._chart import main
main(symbol) main(symbol)

View File

@ -89,6 +89,7 @@ class BaseQuotes(np.recarray):
return self return self
def convert_dates(self, dates): def convert_dates(self, dates):
breakpoint()
return np.array([d.timestamp().time for d in dates]) return np.array([d.timestamp().time for d in dates])

View File

@ -62,14 +62,18 @@ class QuotesLoader:
@classmethod @classmethod
def _save_to_disk(cls, fpath, data): def _save_to_disk(cls, fpath, data):
logger.debug('Saving quotes to a file: %s', fpath) logger.debug('Saving quotes to a file: %s', fpath)
breakpoint()
with open(fpath, 'wb') as f: with open(fpath, 'wb') as f:
pass
pickle.dump(data, f, pickle.HIGHEST_PROTOCOL) pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
d = pickle.load(f)
@classmethod @classmethod
def _load_from_disk(cls, fpath): def _load_from_disk(cls, fpath):
logger.debug('Loading quotes from a file: %s', fpath) logger.debug('Loading quotes from a file: %s', fpath)
with open(fpath, 'rb') as f: with open(fpath, 'rb') as f:
return pickle.load(f) breakpoint()
data = pickle.load(f)
@classmethod @classmethod
@timeit @timeit
@ -84,10 +88,11 @@ class QuotesLoader:
quotes = None quotes = None
fpath = cls._get_file_path(symbol, cls.timeframe, date_from, date_to) fpath = cls._get_file_path(symbol, cls.timeframe, date_from, date_to)
if os.path.exists(fpath): # if os.path.exists(fpath):
quotes = Quotes.new(cls._load_from_disk(fpath)) # quotes = Quotes.new(cls._load_from_disk(fpath))
else: # else:
quotes_raw = cls._get(symbol, date_from, date_to) quotes_raw = cls._get(symbol, date_from, date_to)
breakpoint()
quotes = Quotes.new( quotes = Quotes.new(
quotes_raw, source=cls.source, default_tf=cls.default_tf quotes_raw, source=cls.source, default_tf=cls.default_tf
) )