ezyquant.creator.SETSignalCreator.get_data#
- SETSignalCreator.get_data(field: str, timeframe: str, value_by: str = 'stock', method: str = 'constant', method_args: tuple | None = None, method_kwargs: dict | None = None, period: int = 1, shift: int = 0) DataFrame #
Return DataFrame which columns are symbols and index is the trading date start from start_date to end_date.
OHLCV fillna with prior value.
- Parameters:
field (str) – Name of data field depends on timeframe and value_by.
timeframe (str) –
daily
quarterly
yearly
ttm
ytd
value_by (str = "stock") –
stock
industry
sector
method (str = "constant") – Name of Dataframe rolling window functions. See <https://pandas.pydata.org/docs/reference/window.html#rolling-window-functions> for details. - constant - count - sum - mean - median - var - std - min - max - corr - cov - skew - kurt - apply - aggregate - quantile - sem - rank
method_args (Optional[tuple] = None) – Arguments for method.
method_kwargs (Optional[dict] = None) – Keyword arguments for method.
period (int = 1) – Number of periods for rolling Dataframe. Period must be greater than 0.
shift (int = 0) – Number of periods to shift Dataframe. Shift must be greater than or equal to 0.
- Returns:
symbol : str as column
trade date : date as index
- Return type:
pd.DataFrame
Examples
>>> from ezyquant import SETSignalCreator >>> ssc = SETSignalCreator( ... start_date="2022-01-01", ... end_date="2022-01-10", ... index_list=[], ... symbol_list=["COM7", "MALEE"], ... ) >>> ssc.get_data( ... field="close", ... timeframe="daily", ... value_by="stock", ... method="constant", ... period=1, ... shift=0, ... ) COM7 MALEE 2022-01-04 41.875 6.55 2022-01-05 41.625 6.50 2022-01-06 41.500 6.50 2022-01-07 41.000 6.40 2022-01-10 40.875 6.30 ... ... ... 2022-03-28 42.750 5.75 2022-03-29 41.500 5.75 2022-03-30 42.250 5.70 2022-03-31 43.000 5.70 2022-04-01 42.500 5.70
>>> ssc.get_data( ... field="cash", ... timeframe="quarterly", ... value_by="stock", ... method="constant", ... period=1, ... shift=0, ... ) COM7 MALEE 2022-01-04 NaN NaN 2022-01-05 NaN NaN 2022-01-06 NaN NaN 2022-01-07 NaN NaN 2022-01-10 NaN NaN ... ... ... 2022-03-28 1656882.22 80321.08 2022-03-29 1656882.22 80321.08 2022-03-30 1656882.22 80321.08 2022-03-31 1656882.22 80321.08 2022-04-01 1656882.22 80321.08