Welcome to ThroneTrader’s documentation!¶
Trader¶
- class thronetrader.trader.Trader(symbol: str, logger: Optional[Logger] = None)¶
Base class to load logger and stock ticker.
>>> Trader
Instantiates base class.
- Parameters:
symbol – Stock symbol.
logger – Logger object.
- class thronetrader.trader.Predictions(symbol: str, logger: Optional[Logger] = None)¶
Inherited object from base class for predictions.
>>> Predictions
Instantiates base class.
- Parameters:
symbol – Stock symbol.
logger – Logger object.
- gradient_boosting_prediction(threshold: Optional[int] = None) Dict[str, str] ¶
Predict stock price using a Gradient Boosting Regressor model.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
threshold – Limit used to classify predicted price differences into trading signals based on their significance.
See also
By adjusting the threshold value, you can control the sensitivity of the trading signals.
- A higher threshold would lead to fewer and stronger signals,indicating more significant price movements required to trigger a signal.
A lower threshold would result in more frequent signals, capturing smaller price fluctuations.
- The choice of the threshold value depends on your risk tolerance, trading strategy,and the volatility of the stock being analyzed.
- Returns:
A dictionary containing the prediction signal for the next two days.
- Return type:
Dict[str, str]
- linear_regression_prediction(threshold: Optional[int] = None) Dict[str, str] ¶
Predict stock price using linear regression method.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
threshold – Limit used to classify predicted price differences into trading signals based on their significance.
See also
By adjusting the threshold value, you can control the sensitivity of the trading signals.
- A higher threshold would lead to fewer and stronger signals,indicating more significant price movements required to trigger a signal.
A lower threshold would result in more frequent signals, capturing smaller price fluctuations.
- The choice of the threshold value depends on your risk tolerance, trading strategy,and the volatility of the stock being analyzed.
- Returns:
A dictionary containing the prediction signal for the next two days.
- Return type:
Dict[str, str]
- class thronetrader.trader.RealTimeSignals(symbol: str, logger: Optional[Logger] = None)¶
Inherited object from base class for realtime signals.
>>> RealTimeSignals
Instantiates base class.
- Parameters:
symbol – Stock symbol.
logger – Logger object.
- get_financial_signals(pe_threshold: int = 20, pb_threshold: int = 1.5, payout_ratio_threshold_buy: int = 0.5, payout_ratio_threshold_sell: int = 0.7) Optional[str] ¶
Predict buy/sell/hold signals based on financial ratios.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
pe_threshold – Maximum Price-to-Earnings (P/E) ratio considered acceptable for a “Buy” signal.
pb_threshold – Maximum Price-to-Book (P/B) ratio considered acceptable for a “Buy” signal.
payout_ratio_threshold_buy – Maximum payout ratio considered acceptable for a “Buy” signal.
payout_ratio_threshold_sell – Minimum payout ratio considered acceptable for a “Sell” signal.
See also
If you’re inclined towards a buy, set
payout_ratio_threshold_buy
to 0.If you’re inclined towards a sell, set
payout_ratio_threshold_sell
to 1.
- Returns:
Buy, Sell, or Hold signal.
- Return type:
str
- get_insider_signals() List[Dict[str, Union[str, int, float]]] ¶
Get insider signals for a particular stock ticker (if found).
- Parameters:
symbol – Stock ticker.
- Yields:
Dictionary of key value pairs with the transaction information.
- get_trading_volume(hours: int = 48) Tuple[Series, Series] ¶
Get assumed trading volume of a particular stock.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
hours – Number of hours to fetch the historical data.
- Returns:
Returns a tuple of the Series of information for buy and sell.
- Return type:
Tuple[pandas.Series, pandas.Series]
- class thronetrader.trader.StrategicSignals(symbol: str, logger: Optional[Logger] = None)¶
Inherited object from base class for strategic signals.
>>> StrategicSignals
Instantiates base class.
- Parameters:
symbol – Stock symbol.
logger – Logger object.
- get_bollinger_bands_signals(bar_count: int = 100, days: int = 1, window: int = 20, num_std: int = 2) str ¶
Get buy, sell, and hold signals using the Bollinger Bands strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
bar_count – Number of bars from Yahoo Finance.
days – Number of days to consider.
window – The window size for the moving average.
num_std – The number of standard deviations for the Bollinger Bands.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
- get_breakout_signals(bar_count: int = 100, days: int = 1, short_window: int = 20, long_window: int = 50) str ¶
Get buy, sell and hold signals for a particular stock using breakout strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
bar_count – Number of bars from yfinance.
days – Number of days to consider.
short_window – Short term moving average.
long_window – Long term moving average.
See also
A larger
bar_count
/days
gives longer historical data for trend analysis.A smaller count focuses on recent data for short-term signals.
Experiment and backtest to find the best fit for your approach.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
- get_crossover_signals(short_window: int = 20, long_window: int = 50, years: int = 1) str ¶
Get buy, sell and hold signals for a particular stock using breakout strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
short_window – Short term moving average.
long_window – Long term moving average.
years – Number of years for the historical data.
See also
- The number of years used to calculate moving averages impacts the frequency, responsiveness,accuracy, and risk associated with the signals generated by the strategy.
A larger number of years will provide a longer historical perspective and result in smoother moving averages.
This tends to generate fewer buy and sell signals as the strategy focuses on longer-term trends.
Experiment and backtest to find the best fit for your approach.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
- get_macd_signals(bar_count: int = 100) str ¶
Get buy, sell, and hold signals using the Moving Average Convergence Divergence (MACD) strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
bar_count – Number of bars from yfinance.
days – Number of days to consider.
See also
A larger
bar_count
/days
gives longer historical data for trend analysis.A smaller count focuses on recent data for short-term signals.
Experiment and backtest to find the best fit for your approach.
- Short-term EMA (12-day EMA): A smaller span value for the short-term EMA means that it reacts more quicklyto recent price changes. This can lead to more frequent and sensitive crossovers between the MACD line andthe Signal line, resulting in more buy and sell signals. However, it might also generate more false signalsin volatile markets.
- Long-term EMA (26-day EMA): A larger span value for the long-term EMA makes it smoother and less reactiveto short-term price fluctuations. This helps in identifying the long-term trends in the stock’s pricemovement. However, a larger span might result in delayed signals and could miss some short-term trends.
- Crossover Sensitivity: When the short-term EMA crosses above the long-term EMA, it generates a bullishsignal (buy), and when it crosses below the long-term EMA, it generates a bearish signal (sell).The span value influences how quickly these crossovers occur. A smaller span makes crossovers moresensitive, potentially leading to more frequent signals.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
- get_rsi_signals(bar_count: int = 100) str ¶
Get buy, sell, and hold signals using the Relative Strength Index (RSI) strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
bar_count – Number of bars from yfinance.
days – Number of days to consider.
See also
A larger
bar_count
/days
gives longer historical data for trend analysis.A smaller count focuses on recent data for short-term signals.
Experiment and backtest to find the best fit for your approach.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
——–Deep Learning——–¶
LSTM Future Predictions¶
- class thronetrader.DL_algorithms.lstm_future.LSTMTransformer(symbol: str, epochs: int = 100, batch_size: int = 32, years_to_train: int = 5, years_to_validate: int = 1)¶
LSTMTransformer object to predict future prices using Long short-term memory (LSTM) network.
>>> LSTMTransformer
See also
Long short-term memory (LSTM) network is a recurrent neural network (RNN)
LSTM is aimed to deal with the vanishing gradient problem present in traditional RNNs.
- Its relative insensitivity to gap length is its advantage over other RNNs,hidden Markov models and other sequence learning methods.
Download historical stock data and instantiate LSTMTransformer object.
- Parameters:
symbol – Stock ticker.
epochs – Total number of iterations of all the training data in one cycle for training the model.
batch_size – Number of samples propagated through the network before the model is updated.
- training_dataset() DataFrame ¶
Download training dataset for the duration of training period specified.
- Returns:
Returns the training data as a DataFrame.
- Return type:
pandas.DataFrame
- validation_dataset() DataFrame ¶
Download validation dataset for the duration of validation period specified.
- Returns:
Returns the validation data as a DataFrame.
- Return type:
pandas.DataFrame
- generate_predictions() ndarray ¶
Prepare the data, build the LSTM model, train the model and predict future stock prices.
- Returns:
Returns the predictions as a multidimensional, homogeneous array of fixed-size items.
- Return type:
numpy.ndarray
- transform() ndarray ¶
Inverse transform the predictions to get the actual stock prices.
- Returns:
Returns the inverse of scaling predictions as a multidimensional, homogeneous array of fixed-size items.
- Return type:
numpy.ndarray
- plot_it(data: Series) NoReturn ¶
Plot the data using matplotlib.
- Parameters:
data – Takes the future prices as an argument.
- future_prices() Series ¶
Get future predictions mapped to the future dates.
- Returns:
Returns the future predictions mapped to the dates as a Series.
- Return type:
pandas.Series
LSTM Model¶
- thronetrader.DL_algorithms.lstm_model.import_tensorflow() Tuple[LSTM, Dense, Sequential] ¶
Imports tensorflow objects, suppressing the logger information.
- Returns:
Returns a tuple of LSTM, Dense and Sequential objects.
- Return type:
Tuple[LSTM, Dense, Sequential]
- thronetrader.DL_algorithms.lstm_model.prepare_data_lstm(data: DataFrame, look_back: int = 7) Tuple[ndarray, ndarray] ¶
Prepare the data for LSTM model training.
- Parameters:
data – Historical stock data as a DataFrame.
look_back – Number of look-back periods for the LSTM model. Defaults to 7.
- Returns:
A tuple containing the prepared input data (X) and labels (y).
- Return type:
Tuple[numpy.ndarray, numpy.ndarray]
- thronetrader.DL_algorithms.lstm_model.build_lstm_model(input_shape: Tuple[Any, int], optimizer: Optional[str] = None) Sequential ¶
Build the LSTM model.
- Parameters:
input_shape – A tuple containing the prepared input data (X) and labels (y).
optimizer – Takes a custom optimizer as an argument.
- Returns:
Sequential object.
- Return type:
Sequential
GRU Future Predictions¶
- class thronetrader.DL_algorithms.gru_future.GRUTransformer(symbol: str, epochs: int = 100, batch_size: int = 32, years_to_train: int = 5, years_to_validate: int = 1)¶
GRUTransformer object to predict future prices using Gated Recurrent Unit (GRU) model.
>>> GRUTransformer
See also
Gated Recurrent Unit (GRU) is a type of recurrent neural network (RNN)
GRU is designed to capture sequential patterns and relationships in data.
GRU has a more straightforward architecture compared to LSTM, which makes it easier to train and understand.
Due to its simplified design, GRU may require less computational resources and training time compared to LSTM.
Download historical stock data and instantiate GRUTransformer object.
- Parameters:
symbol – Stock ticker.
epochs – Total number of iterations of all the training data in one cycle for training the model.
batch_size – Number of samples propagated through the network before the model is updated.
- training_dataset() DataFrame ¶
Download training dataset for the duration of training period specified.
- Returns:
Returns the training data as a DataFrame.
- Return type:
pandas.DataFrame
- validation_dataset() DataFrame ¶
Download validation dataset for the duration of validation period specified.
- Returns:
Returns the validation data as a DataFrame.
- Return type:
pandas.DataFrame
- generate_predictions() ndarray ¶
Prepare the data, build the GRU model, train the model and predict future stock prices.
- Returns:
Returns the predictions as a multidimensional, homogeneous array of fixed-size items.
- Return type:
numpy.ndarray
- transform() ndarray ¶
Inverse transform the predictions to get the actual stock prices.
- Returns:
Returns the inverse of scaling predictions as a multidimensional, homogeneous array of fixed-size items.
- Return type:
numpy.ndarray
- plot_it(data: Series) NoReturn ¶
Plot the data using matplotlib.
- Parameters:
data – Takes the future prices as an argument.
- future_prices() Series ¶
Get future predictions mapped to the future dates.
- Returns:
Returns the future predictions mapped to the dates as a Series.
- Return type:
pandas.Series
GRU Model¶
- thronetrader.DL_algorithms.gru_model.import_tensorflow() Tuple[Dense, GRU, Sequential] ¶
Imports tensorflow objects, suppressing the logger information.
- Returns:
Returns a tuple of Dense, GRU and Sequential objects.
- Return type:
Tuple[Dense, GRU, Sequential]
- thronetrader.DL_algorithms.gru_model.prepare_data_gru(data: DataFrame, look_back: int = 7) Tuple[ndarray, ndarray] ¶
Prepare the data for GRU model training.
- Parameters:
data – Historical stock data as a DataFrame.
look_back – Number of look-back periods for the GRU model. Defaults to 7.
- Returns:
A tuple containing the prepared input data (X) and labels (y).
- Return type:
Tuple[numpy.ndarray, numpy.ndarray]
- thronetrader.DL_algorithms.gru_model.build_gru_model(input_shape: Tuple[Any, int], optimizer: Optional[str] = None) Sequential ¶
Build the LSTM model.
- Parameters:
input_shape – A tuple containing the prepared input data (X) and labels (y).
optimizer – Takes a custom optimizer as an argument.
- Returns:
Sequential object.
- Return type:
Sequential
Steward¶
- class thronetrader.DL_algorithms.steward.Optimizers(value)¶
Optimizers that can be used.
- adam: str = 'adam'¶
- sgd: str = 'SGD'¶
- _generate_next_value_(start, count, last_values)¶
Generate the next value when not given.
name: the name of the member start: the initial start value or None count: the number of existing members last_value: the last value assigned or None
- _member_names_ = ['adam', 'sgd']¶
- _member_map_ = {'adam': Optimizers.adam, 'sgd': Optimizers.sgd}¶
- _member_type_¶
alias of
str
- _value2member_map_ = {'SGD': Optimizers.sgd, 'adam': Optimizers.adam}¶
——–Machine Learning——–¶
Gradient Boosting¶
- thronetrader.ML_algorithms.gradient_boosting.gradient_boosting_prediction(symbol: str, logger: Logger, threshold: Optional[int] = None) Optional[Dict[str, str]] ¶
Predict stock price using a Gradient Boosting Regressor model.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
threshold – Limit used to classify predicted price differences into trading signals based on their significance.
See also
By adjusting the threshold value, you can control the sensitivity of the trading signals.
- A higher threshold would lead to fewer and stronger signals,indicating more significant price movements required to trigger a signal.
A lower threshold would result in more frequent signals, capturing smaller price fluctuations.
- The choice of the threshold value depends on your risk tolerance, trading strategy,and the volatility of the stock being analyzed.
- Returns:
A dictionary containing the prediction signal for the next two days.
- Return type:
Dict[str, str]
Linear Regression¶
- thronetrader.ML_algorithms.linear_regression.linear_regression_prediction(symbol: str, logger: Logger, threshold: Optional[int] = None) Optional[Dict[str, str]] ¶
Predict stock price using linear regression method.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
threshold – Limit used to classify predicted price differences into trading signals based on their significance.
See also
By adjusting the threshold value, you can control the sensitivity of the trading signals.
- A higher threshold would lead to fewer and stronger signals,indicating more significant price movements required to trigger a signal.
A lower threshold would result in more frequent signals, capturing smaller price fluctuations.
- The choice of the threshold value depends on your risk tolerance, trading strategy,and the volatility of the stock being analyzed.
- Returns:
A dictionary containing the prediction signal for the next two days.
- Return type:
Dict[str, str]
——–Realtime Signals——–¶
Insider Trading¶
- thronetrader.realtime.insider.get_insider(filter_option: FilterOption) List[Dict[str, Union[str, int, float]]] ¶
Retrieves dataframe from finviz.
- Parameters:
filter_option – Takes the filter option (either buy/sell/all)
- Returns:
Converts the DataFrame into a list of dictionaries and returns it.
- Return type:
List[Dict[str, Union[str, int, float]]]
- thronetrader.realtime.insider.aggregate_data(transactions: List[Dict[str, Union[str, int, float]]]) List[Dict[str, Union[str, int, float]]] ¶
Aggregates the data if there are multiple transactions made by the same owner for the same ticker.
- Parameters:
transactions – Transactions received from finviz.
- Returns:
Aggregated transactions.
- Return type:
List[Dict[str, Union[str, int, float]]]
- thronetrader.realtime.insider.get_insider_signals(symbol: str) Generator[Dict[str, Union[str, int, float]]] ¶
Get insider signals for a particular stock ticker (if found).
- Parameters:
symbol – Stock ticker.
- Yields:
Dictionary of key value pairs with the transaction information.
- thronetrader.realtime.insider.get_all_insider_signals() List[Dict[str, Union[str, int, float]]] ¶
Get ALL the insider trading information available.
- thronetrader.realtime.insider.get_all_insider_buy() List[Dict[str, Union[str, int, float]]] ¶
Get the insider trading information for all BUY transactions.
- thronetrader.realtime.insider.get_all_insider_sell() List[Dict[str, Union[str, int, float]]] ¶
Get the insider trading information for all SELL transactions.
Financials¶
- thronetrader.realtime.financial.get_financial_ratios_yfinance(symbol: str) DataFrame ¶
Get financial ratios for a given stock symbol using yfinance.
- Parameters:
symbol – Stock ticker.
- Returns:
DataFrame containing financial ratios.
- Return type:
pandas.DataFrame
- thronetrader.realtime.financial.get_financial_signals(symbol: str, logger: Logger, pe_threshold: int = 20, pb_threshold: int = 1.5, payout_ratio_threshold_buy: int = 0.5, payout_ratio_threshold_sell: int = 0.7) str ¶
Predict buy/sell/hold signals based on financial ratios.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
pe_threshold – Maximum Price-to-Earnings (P/E) ratio considered acceptable for a “Buy” signal.
pb_threshold – Maximum Price-to-Book (P/B) ratio considered acceptable for a “Buy” signal.
payout_ratio_threshold_buy – Maximum payout ratio considered acceptable for a “Buy” signal.
payout_ratio_threshold_sell – Minimum payout ratio considered acceptable for a “Sell” signal.
See also
If you’re inclined towards a buy, set
payout_ratio_threshold_buy
to 0.If you’re inclined towards a sell, set
payout_ratio_threshold_sell
to 1.
- Returns:
Buy, Sell, or Hold signal.
- Return type:
str
Predicted Volume¶
- thronetrader.realtime.volume.get_trading_volume(symbol: str, logger: Logger, hours: int = 48) Optional[Tuple[Series, Series]] ¶
Get assumed trading volume of a particular stock.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
hours – Number of hours to fetch the historical data.
- Returns:
Returns a tuple of the Series of information for buy and sell.
- Return type:
Tuple[pandas.Series, pandas.Series]
——–Strategic Signals——–¶
Bollinger Bands¶
- thronetrader.strategies.bollinger_bands.get_bollinger_bands_signals(symbol: str, logger: Logger, bar_count: int = 100, days: int = 1, window: int = 20, num_std: int = 2) str ¶
Get buy, sell, and hold signals using the Bollinger Bands strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
bar_count – Number of bars from Yahoo Finance.
days – Number of days to consider.
window – The window size for the moving average.
num_std – The number of standard deviations for the Bollinger Bands.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
Breakout¶
- thronetrader.strategies.breakout.get_breakout_signals(symbol: str, logger: Logger, bar_count: int = 100, days: int = 1, short_window: int = 20, long_window: int = 50) str ¶
Get buy, sell and hold signals for a particular stock using breakout strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
bar_count – Number of bars from yfinance.
days – Number of days to consider.
short_window – Short term moving average.
long_window – Long term moving average.
See also
A larger
bar_count
/days
gives longer historical data for trend analysis.A smaller count focuses on recent data for short-term signals.
Experiment and backtest to find the best fit for your approach.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
Crossover¶
- thronetrader.strategies.crossover.get_crossover_signals(symbol: str, logger: Logger, short_window: int = 20, long_window: int = 50, years: int = 1) str ¶
Get buy, sell and hold signals for a particular stock using breakout strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
short_window – Short term moving average.
long_window – Long term moving average.
years – Number of years for the historical data.
See also
- The number of years used to calculate moving averages impacts the frequency, responsiveness,accuracy, and risk associated with the signals generated by the strategy.
A larger number of years will provide a longer historical perspective and result in smoother moving averages.
This tends to generate fewer buy and sell signals as the strategy focuses on longer-term trends.
Experiment and backtest to find the best fit for your approach.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
Moving Average Convergence/Divergence Indicator¶
- thronetrader.strategies.macd.get_macd_signals(symbol: str, logger: Logger, bar_count: int = 100, days: int = 1) str ¶
Get buy, sell, and hold signals using the Moving Average Convergence Divergence (MACD) strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
bar_count – Number of bars from yfinance.
days – Number of days to consider.
See also
A larger
bar_count
/days
gives longer historical data for trend analysis.A smaller count focuses on recent data for short-term signals.
Experiment and backtest to find the best fit for your approach.
- Short-term EMA (12-day EMA): A smaller span value for the short-term EMA means that it reacts more quicklyto recent price changes. This can lead to more frequent and sensitive crossovers between the MACD line andthe Signal line, resulting in more buy and sell signals. However, it might also generate more false signalsin volatile markets.
- Long-term EMA (26-day EMA): A larger span value for the long-term EMA makes it smoother and less reactiveto short-term price fluctuations. This helps in identifying the long-term trends in the stock’s pricemovement. However, a larger span might result in delayed signals and could miss some short-term trends.
- Crossover Sensitivity: When the short-term EMA crosses above the long-term EMA, it generates a bullishsignal (buy), and when it crosses below the long-term EMA, it generates a bearish signal (sell).The span value influences how quickly these crossovers occur. A smaller span makes crossovers moresensitive, potentially leading to more frequent signals.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str
Squire¶
- thronetrader.helper.squire.get_historical_data(symbol: str, years: int = 1, df: bool = False) Union[List[Tuple[str, float]], DataFrame] ¶
Download historical stock data for a given symbol and date range.
- Parameters:
symbol – Stock ticker.
years – Number of years.
df – Return data as a pandas DataFrame.
- Returns:
Dataframe or Tuples of date and stock price in a list for the duration of years.
- Return type:
Union[List[Tuple[str, float]], pandas.DataFrame]
- thronetrader.helper.squire.get_bars(symbol: str, bar_count: int, days: int) DataFrame ¶
Download historical stock data for a given symbol and date range.
- Parameters:
symbol – Stock ticker.
bar_count – Number of bars from yfinance.
days – Number of days to consider.
- Returns:
Returns the historical data as a DataFrame.
- Return type:
pandas.DataFrame
- thronetrader.helper.squire.classify(stock_data: DataFrame, logger: Logger) str ¶
Calculates short term moving average, long term moving average to generate the signals.
Logger¶
- thronetrader.helper.logger.default_logger() Logger ¶
Generates a default console logger.
- Returns:
Logger object.
- Return type:
logging.Logger
Relative Strength Index¶
- thronetrader.strategies.rsi.get_rsi_signals(symbol: str, logger: Logger, bar_count: int = 100, days: int = 1) str ¶
Get buy, sell, and hold signals using the Relative Strength Index (RSI) strategy.
- Parameters:
symbol – Stock ticker.
logger – Logger object.
bar_count – Number of bars from yfinance.
days – Number of days to consider.
See also
A larger
bar_count
/days
gives longer historical data for trend analysis.A smaller count focuses on recent data for short-term signals.
Experiment and backtest to find the best fit for your approach.
- Returns:
Analysis of buy/hold/sell.
- Return type:
str