time_series_transform.stock_transform package¶
Subpackages¶
Submodules¶
time_series_transform.stock_transform.base module¶
-
class
time_series_transform.stock_transform.base.
Portfolio
(time_series_data, time_index, symbolIx, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ Bases:
time_series_transform.transform_core_api.base.Time_Series_Data_Collection
-
classmethod
from_time_series_collection
(time_series_data_collection, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ from_time_series_collection making Portfolio object from Time_Series_Data_Collection
- Parameters
time_series_data_collection (Time_Series_Data_Collection) – input data
High (str or int, optional) – the index or name for High, by default ‘High’
Low (str or int, optional) – the index or name for Low, by default ‘Low’
Close (str or int, optional) – the index or name for Close, by default ‘Close’
Open (str or int, optional) – the index or name for Open, by default ‘Open’
Volume (str or int, optional) – the index or name for Volume, by default ‘Volume’
- Returns
- Return type
-
get_technical_indicator
(strategy, n_jobs=1, verbose=0, backend='loky', *args, **kwargs)[source]¶ get_technical_indicator making different technical indicator
pandas-ta implmentation https://github.com/twopirllc/pandas-ta
-
classmethod
-
class
time_series_transform.stock_transform.base.
Stock
(data, time_index, symbol=None, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ Bases:
time_series_transform.transform_core_api.base.Time_Series_Data
-
classmethod
from_time_series_data
(time_series_data, symbol=None, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ making Stock object from Time_Series_Data class
- Parameters
time_series_data (Time_Series_Data) – input Data
symbol (str, option) – ticker name, by default None
High (str or int, optional) – the index or name for High, by default ‘High’
Low (str or int, optional) – the index or name for Low, by default ‘Low’
Close (str or int, optional) – the index or name for Close, by default ‘Close’
Open (str or int, optional) – the index or name for Open, by default ‘Open’
Volume (str or int, optional) – the index or name for Volume, by default ‘Volume’
- Returns
- Return type
-
get_technical_indicator
(strategy)[source]¶ get_technical_indicator making different technical indicator
pandas-ta implmentation https://github.com/twopirllc/pandas-ta
- Parameters
strategy (Strategy) – pandas-ta strategy
- Returns
- Return type
self
-
classmethod
time_series_transform.stock_transform.stock_extractor module¶
-
class
time_series_transform.stock_transform.stock_extractor.
Portfolio_Extractor
(symbolList, engine, *args, **kwargs)[source]¶ Bases:
object
-
get_date
(start_date, end_date, n_threads=8)[source]¶ get_portfolio_date extracts the list of stock by the date period
-
get_intra_day
(start_date, end_date, interval='1m', n_threads=8)[source]¶ get_intra_day extracts the intraday data of the list of stock data by the date period
- Parameters
- Returns
portfolio data of the given stock list
- Return type
portfolio
-
-
class
time_series_transform.stock_transform.stock_extractor.
Stock_Extractor
(symbol, engine, *args, **kwargs)[source]¶ Bases:
object
time_series_transform.stock_transform.stock_transfromer module¶
-
class
time_series_transform.stock_transform.stock_transfromer.
Stock_Transformer
(time_series_data, time_seriesIx, symbolIx, symbolName=None, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ Bases:
time_series_transform.transform_core_api.time_series_transformer.Time_Series_Transformer
-
classmethod
from_arrow_table
(arrow_table, timeSeriesCol, symbolIx, symbolName=None, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ from_arrow_table [summary]
[extended_summary]
- Parameters
arrow_table (arrow table) – input data
timeSeriesCol (str or numeric) – time series column name
symbolIx (str or numeric) – main category name
symbolName (str or numeric, option) – ticker name only used when single stock, by default None
High (str or int, optional) – the index or name for High, by default ‘High’
Low (str or int, optional) – the index or name for Low, by default ‘Low’
Close (str or int, optional) – the index or name for Close, by default ‘Close’
Open (str or int, optional) – the index or name for Open, by default ‘Open’
Volume (str or int, optional) – the index or name for Volume, by default ‘Volume’
- Returns
- Return type
-
classmethod
from_feather
(feather_dir, timeSeriesCol, symbolIx, symbolName=None, columns=None, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ from_feather import data from feather
- Parameters
feather_dir (str) – directory of feather file
timeSeriesCol (str or numeric) – time series column name
symbolIx (str or numeric) – main category name
symbolName (str or numeric, option) – ticker name only used when single stock, by default None
columns (str or numeric, optional) – target columns (apache arrow implmentation), by default None
High (str or int, optional) – the index or name for High, by default ‘High’
Low (str or int, optional) – the index or name for Low, by default ‘Low’
Close (str or int, optional) – the index or name for Close, by default ‘Close’
Open (str or int, optional) – the index or name for Open, by default ‘Open’
Volume (str or int, optional) – the index or name for Volume, by default ‘Volume’
- Returns
- Return type
-
classmethod
from_numpy
(numpyData, timeSeriesCol, mainCategoryCol, High, Low, Close, Open, Volume, symbolName=None)[source]¶ from_numpy from_numpy import data from numpy
- Parameters
numpyData (numpy ndArray) – input data
timeSeriesCol (int) – index of time series column
mainCategoryCol (int) – index of main category column
High (int, optional) – the column index for High, by default ‘High’
Low (int, optional) – the column index for Low, by default ‘Low’
Close (int, optional) – the column index for Close, by default ‘Close’
Open (int, optional) – the column index for Open, by default ‘Open’
Volume (int, optional) – the column index for Volume, by default ‘Volume’
symbolName (str or numeric, option) – ticker name only used when single stock, by default None
- Returns
- Return type
-
classmethod
from_pandas
(pandasFrame, timeSeriesCol, mainCategoryCol, symbolName=None, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ from_pandas import data from pandas dataFrame
- Parameters
pandasFrame (pandas DataFrame) – input data
timeSeriesCol (str or numeric) – time series column name
mainCategoryCol (str or numeric) – main category name
symbolName (str or numeric, option) – ticker name only used when single stock, by default None
High (str or int, optional) – the column name for High, by default ‘High’
Low (str or int, optional) – the column name for Low, by default ‘Low’
Close (str or int, optional) – the column name for Close, by default ‘Close’
Open (str or int, optional) – the column name for Open, by default ‘Open’
Volume (str or int, optional) – the column name for Volume, by default ‘Volume’
- Returns
- Return type
-
classmethod
from_parquet
(parquet_dir, timeSeriesCol, symbolIx, symbolName=None, columns=None, partitioning='hive', filters=None, filesystem=None, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ from_parquet import data from parquet file
- Parameters
parquet_dir (str) – directory of parquet file
timeSeriesCol (str or numeric) – time series column name
symbolIx (str or numeric) – main category name
symbolName (str or numeric, option) – ticker name only used when single stock, by default None
columns (str or numeric, optional) – target columns (apache arrow implmentation), by default None
partitioning (str, optional) – type of partitioning, by default ‘hive’
filters (str, optional) – filter (apache arrow implmentation), by default None
filesystem (str, optional) – filesystem (apache arrow implmentation), by default None
High (str or int, optional) – the index or name for High, by default ‘High’
Low (str or int, optional) – the index or name for Low, by default ‘Low’
Close (str or int, optional) – the index or name for Close, by default ‘Close’
Open (str or int, optional) – the index or name for Open, by default ‘Open’
Volume (str or int, optional) – the index or name for Volume, by default ‘Volume’
- Returns
- Return type
-
classmethod
from_stock_engine_date
(symbols, start_date, end_date, engine, n_threads=8, *args, **kwargs)[source]¶ from_stock_engine_date [summary]
[extended_summary]
- Parameters
- Returns
- Return type
-
classmethod
from_stock_engine_intraday
(symbols, start_date, end_date, engine='yahoo', interval='1m', n_threads=8, *args, **kwargs)[source]¶
-
classmethod
from_stock_engine_period
(symbols, period, engine, n_threads=8, *args, **kwargs)[source]¶ from_stock_engine_period fetching data from online
the current engine support yfinance and investpy
- Parameters
- Returns
- Return type
-
classmethod
from_time_series_transformer
(time_series_transformer, symbolName=None, High='High', Low='Low', Close='Close', Open='Open', Volume='Volume')[source]¶ from_time_series_transformer making Stock_Transformer from Time_Series_Transformer
- Parameters
time_series_transformer (Time_Series_Transformer) – input data
symbolName (str or numeric, option) – ticker name only used when single stock, by default None
High (str or int, optional) – the index or name for High, by default ‘High’
Low (str or int, optional) – the index or name for Low, by default ‘Low’
Close (str or int, optional) – the index or name for Close, by default ‘Close’
Open (str or int, optional) – the index or name for Open, by default ‘Open’
Volume (str or int, optional) – the index or name for Volume, by default ‘Volume’
- Returns
- Return type
-
get_technial_indicator
(strategy, n_jobs=1, verbose=10, backend='loky')[source]¶ get_technical_indicator making different technical indicator
pandas-ta implmentation https://github.com/twopirllc/pandas-ta
-
classmethod
time_series_transform.stock_transform.util module¶
-
time_series_transform.stock_transform.util.
macd
(arr, return_diff=False)[source]¶ Return the moving average convergence/divergence
-
time_series_transform.stock_transform.util.
rsi
(arr, n_day=14)[source]¶ Return the Relative Strength Index
- Parameters
arr (array) – data used to calculate the Relative Strength Index
- Returns
rsi – Relative Strength Index of the given array
- Return type
array
-
time_series_transform.stock_transform.util.
stochastic_oscillator
(arr, window=14)[source]¶ Return the stochastic oscillator
- Parameters
arr (pandas or Time_Series_Data) – data used to calculate the stochastic oscillator
window (int) – window of the stochastic oscillator
- Returns
ret – stochastic oscillator of the given data, including k and d values
- Return type