diff --git a/xone/chart.py b/xone/chart.py index e4a0559..90f2dd3 100644 --- a/xone/chart.py +++ b/xone/chart.py @@ -1,12 +1,16 @@ import pandas as pd +from typing import Union from xone import utils from matplotlib import pyplot as plt def plot_ts( - data: (pd.Series, pd.DataFrame), fld='close', - tz=None, vline=None, **kwargs + data: Union[pd.Series, pd.DataFrame], + fld='close', + tz=None, + vline=None, + **kwargs, ): """ Time series data plots @@ -229,7 +233,7 @@ def add_lines( return axes -def xticks(data: (pd.Series, pd.DataFrame), max_cnt=8) -> pd.DataFrame: +def xticks(data: Union[pd.Series, pd.DataFrame], max_cnt=8) -> pd.DataFrame: """ Get x-ticks for intraday data @@ -273,7 +277,7 @@ def xticks(data: (pd.Series, pd.DataFrame), max_cnt=8) -> pd.DataFrame: ) -def intraday(data: (pd.Series, pd.DataFrame), max_cnt=8, **kwargs): +def intraday(data: Union[pd.Series, pd.DataFrame], max_cnt=8, **kwargs): """ Plot intraday data diff --git a/xone/utils.py b/xone/utils.py index 93dfbe3..e4bab1c 100644 --- a/xone/utils.py +++ b/xone/utils.py @@ -7,9 +7,17 @@ import inspect import sys +from typing import Union from xone import __version__ -__all__ = ['__version__'] +__all__ = [ + '__version__', + 'tolist', + 'fmt_dt', + 'trade_day', + 'cur_time', + 'align_data', +] DEFAULT_TZ = pytz.FixedOffset(-time.timezone / 60) @@ -414,7 +422,7 @@ def func_kwarg(func, **kwargs) -> dict: return {k: v for k, v in kwargs.items() if k in kind} -def perf(data: (pd.DataFrame, pd.Series)) -> (pd.DataFrame, pd.Series): +def perf(data: Union[pd.DataFrame, pd.Series]) -> Union[pd.DataFrame, pd.Series]: """ Price performance based at 100