AI finance TA writer, yfinance, pandas_ta, WIP
This commit is contained in:
@@ -36,13 +36,13 @@ def write_blog_options():
|
||||
("Audio To Blog", "Audio To Blog - Transcribe Audio files into blog content"),
|
||||
("AI Story Writer", "AI Story Writer"),
|
||||
("AI Essay Writer", "AI Essay writer"),
|
||||
("AI News Articles", "News - AI News article writer, factual trusted sources"),
|
||||
("AI Finance TA report", "AI TA report - Write stocks Techincal Analysis report."),
|
||||
("AI News Articles", "AI News Writer - AI News article writer, factual trusted sources"),
|
||||
("AI Finance Writer", "AI Finance Writer - Write stocks Techincal Analysis report."),
|
||||
("Programming", "Programming - Write technical blogs on latest topics"),
|
||||
("Scholar", "Scholar - Research Reports from google scholar, arxiv articles."),
|
||||
("Quit", "Quit")
|
||||
]
|
||||
selected_blog_type = radiolist_dialog(title="Choose a blog type:", values=choices).run()
|
||||
selected_blog_type = radiolist_dialog(title="Choose Content creation Type:", values=choices).run()
|
||||
return selected_blog_type if selected_blog_type else None
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ def write_blog():
|
||||
blog_from_audio()
|
||||
elif blog_type == 'AI News Articles':
|
||||
ai_news_writer()
|
||||
elif blog_type == 'AI Finance TA report':
|
||||
elif blog_type == 'AI Finance Writer':
|
||||
ai_finance_ta_writer()
|
||||
elif blog_type == 'GitHub':
|
||||
github = prompt("Enter GitHub URL, CSV file, or topic:")
|
||||
|
||||
@@ -105,94 +105,6 @@ def analyze_stock(ticker_symbol, start_date, end_date):
|
||||
if last_day_summary is not None:
|
||||
print("Summary of Technical Indicators for the Last Day:")
|
||||
print(last_day_summary)
|
||||
|
||||
# Plot the technical indicators
|
||||
plt.figure(figsize=(14, 8))
|
||||
|
||||
# Price Trend Chart
|
||||
plt.subplot(3, 3, 1)
|
||||
plt.plot(stock_data.index, stock_data['Adj Close'], label='Adj Close', color='blue')
|
||||
plt.plot(stock_data.index, stock_data['EMA_50'], label='EMA 50', color='green')
|
||||
plt.plot(stock_data.index, stock_data['SMA_20'], label='SMA_20', color='orange')
|
||||
plt.title("Price Trend")
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
plt.legend()
|
||||
plt.show()
|
||||
|
||||
# On-Balance Volume Chart
|
||||
plt.subplot(3, 3, 2)
|
||||
plt.plot(stock_data['OBV'], label='On-Balance Volume')
|
||||
plt.title('On-Balance Volume (OBV) Indicator')
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
plt.legend()
|
||||
|
||||
# MACD Plot
|
||||
plt.subplot(3, 3, 3)
|
||||
plt.plot(stock_data['MACD_12_26_9'], label='MACD')
|
||||
plt.plot(stock_data['MACDh_12_26_9'], label='MACD Histogram')
|
||||
plt.title('MACD Indicator')
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
plt.title("MACD")
|
||||
plt.legend()
|
||||
|
||||
# RSI Plot
|
||||
plt.subplot(3, 3, 4)
|
||||
plt.plot(stock_data['RSI_14'], label='RSI')
|
||||
plt.axhline(y=70, color='r', linestyle='--', label='Overbought (70)')
|
||||
plt.axhline(y=30, color='g', linestyle='--', label='Oversold (30)')
|
||||
plt.legend()
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
plt.title('RSI Indicator')
|
||||
|
||||
# Bollinger Bands Plot
|
||||
plt.subplot(3, 3, 5)
|
||||
plt.plot(stock_data.index, stock_data['BBU_5_2.0'], label='Upper BB')
|
||||
plt.plot(stock_data.index, stock_data['BBM_5_2.0'], label='Middle BB')
|
||||
plt.plot(stock_data.index, stock_data['BBL_5_2.0'], label='Lower BB')
|
||||
plt.plot(stock_data.index, stock_data['Adj Close'], label='Adj Close', color='brown')
|
||||
plt.title("Bollinger Bands")
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
plt.legend()
|
||||
|
||||
# Stochastic Oscillator Plot
|
||||
plt.subplot(3, 3, 6)
|
||||
plt.plot(stock_data.index, stock_data['STOCHk_14_3_3'], label='Stoch %K')
|
||||
plt.plot(stock_data.index, stock_data['STOCHd_14_3_3'], label='Stoch %D')
|
||||
plt.title("Stochastic Oscillator")
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
plt.legend()
|
||||
|
||||
# Williams %R Plot
|
||||
plt.subplot(3, 3, 7)
|
||||
plt.plot(stock_data.index, stock_data['WILLR_14'])
|
||||
plt.title("Williams %R")
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
|
||||
# ADX Plot
|
||||
plt.subplot(3, 3, 8)
|
||||
plt.plot(stock_data.index, stock_data['ADX_14'])
|
||||
plt.title("Average Directional Index (ADX)")
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
|
||||
# CMF Plot
|
||||
plt.subplot(3, 3, 9)
|
||||
plt.plot(stock_data.index, stock_data['CMF_20'])
|
||||
plt.title("Chaikin Money Flow (CMF)")
|
||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%b%d')) # Format date as "Jun14"
|
||||
plt.xticks(rotation=45, fontsize=8) # Adjust font size
|
||||
|
||||
# Show the plots
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
|
||||
return last_day_summary
|
||||
else:
|
||||
logging.error("Stock data is None, unable to calculate indicators.")
|
||||
|
||||
Reference in New Issue
Block a user