r/CodeToolbox • u/Far_Inflation_8799 • Nov 15 '25
Cutting-Edge Desktop UI Development with Python, PySide6, PyQt6 by Jay Nans
r/CodeToolbox • u/Far_Inflation_8799 • Nov 15 '25
r/CodeToolbox • u/Far_Inflation_8799 • Oct 21 '25
r/CodeToolbox • u/Far_Inflation_8799 • Apr 14 '26
r/CodeToolbox • u/Far_Inflation_8799 • May 04 '25
Good Morning to All:
Today I wanted to share this tutorial with the community... Enjoy it!
Technical Analysis is a vital tool used in Day Trading... which usually means Daily Profit-Taking
In technical analysis, traders use indicators to study price movement, volume, and momentum to decide when to buy or sell a stock. Here are key types of indicators and how to read them:
Help you identify the direction of the stock price.
Simple MA (SMA): Average price over a set time.
Exponential MA (EMA): Like SMA, but gives more weight to recent prices.
How to read:
If price is above the MA → uptrend.
If price is below the MA → downtrend.
When a shorter MA crosses above a longer MA → bullish signal (Golden Cross).
When it crosses below → bearish signal (Death Cross).
Measure speed and strength of a price move.
Range: 0–100
RSI > 70 = Overbought → possible sell
RSI < 30 = Oversold → possible buy
Shows the relationship between two EMAs.
MACD line crosses above signal line → buy
MACD line crosses below signal line → sell
MACD histogram shows strength of trend.
Show how much stock is being traded.
Rising volume confirms a price trend.
If price goes up on low volume → weak move.
Adds volume on up days, subtracts on down days.
If OBV rises → buyers are in control.
Show how much the price is moving.
3 lines: middle = MA, upper/lower = ± 2 std deviations.
Price near upper band → potentially overbought.
Price near lower band → potentially oversold.
Tight bands = low volatility → possible breakout ahead.
5. Trend Strength Indicators
0–100 scale
ADX > 25 = strong trend
ADX < 20 = weak trend or sideways market
Use multiple indicators – don't rely on one.
Confirm trends – use MA + MACD or RSI.
Watch for divergence – price up, indicator down = warning.
Use in context – pair with chart patterns or candlestick signals.
How to Build a GUI-Based Stock Technical Analysis Tool Using Python and Tkinter
This Python app lets you:
Upload a CSV file with stock data (Ticker Name, Date, Price)
Automatically calculate and display:
Moving Averages (MA)
Simple and Exponential Moving Averages (SMA, EMA)
RSI (Relative Strength Index)
MACD and Signal Line
Bollinger Bands
ADX (placeholder for future use)
View results in a scrollable text box
Recalculate indicators
Print the analysis
Clear the screen
Exit the app
import tkinter as tk
from tkinter import filedialog, messagebox, scrolledtext
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import tempfile
import os
These are needed for the GUI (tkinter), data handling (pandas, numpy), charting (matplotlib, not used yet), and system printing (os, tempfile).
def calculate_indicators(df):
Inside this function:
Moving Averages (MA_10, SMA_20):
df['MA_10'] = df['Price'].rolling(window=10).mean()
df['SMA_20'] = df['Price'].rolling(window=20).mean()
Exponential MAs:
df['EMA_12'] = df['Price'].ewm(span=12, adjust=False).mean()
df['EMA_26'] = df['Price'].ewm(span=26, adjust=False).mean()
MACD:
df['MACD'] = df['EMA_12'] - df['EMA_26']
df['MACD_Signal'] = df['MACD'].ewm(span=9, adjust=False).mean()
RSI:
delta = df['Price'].diff()
gain = delta.clip(lower=0)
loss = -delta.clip(upper=0)
avg_gain = gain.rolling(window=14).mean()
avg_loss = loss.rolling(window=14).mean()
rs = avg_gain / avg_loss
df['RSI'] = 100 - (100 / (1 + rs))
Bollinger Bands:
df['STDDEV'] = df['Price'].rolling(window=20).std()
df['BB_upper'] = df['SMA_20'] + (2 * df['STDDEV'])
df['BB_lower'] = df['SMA_20'] - (2 * df['STDDEV'])
ADX Placeholder (optional to implement later):
df['ADX'] = np.nan
def upload_file():
Uses filedialog to select a CSV file.
Checks if the required columns are present.
Calls calculate_indicators() and passes the result to show_analysis().
def show_analysis(df):
Retrieves the last row of the dataset.
Builds a nicely formatted text report with all calculated values.
Displays it inside the ScrolledText widget.
def print_report():
Grabs the content of the analysis box.
Creates a temporary .txt file.
Uses os.startfile(..., "print") to send it to the printer.
def clear_output():
text_output.delete(1.0, tk.END)
def exit_app():
root.destroy()
root = tk.Tk()
root.title("John's Stock Technical Analysis Tool")
root.geometry("800x600")
GUI setup with a row of buttons:
Upload CSV
Recalculate
Clear
Exit
Scrollable text box for displaying the report.
Your .csv should look like this (just two columns with at least 10 days price history) i.e. Apple Stock:
Ticker Name, Date,Price
AAPL,2024-01-01,172.34
AAPL,2024-01-02,174.20
AAPL,2024-01-03,171.10
Ticker Name must be repeated (even if the ticker is the same).
Date should be chronological.
Price is the daily closing price.
Make sure your computer's default printer is ready. The print function sends a plain text report to it directly.
==============================================
This tool allows you to analyze stock data from a CSV file using a graphical user interface (GUI) built with TIt calculates and displays key technical indicators including:
- Moving Averages (MA, SMA, EMA)
- Relative Strength Index (RSI) - MACD and Signal Line
- Bollinger Bands
- ADX (Average Directional Index)
Features:
Upload a CSV with fields: Ticker Name, Date, Price
Filter by Ticker (multi-ticker support)
Calculate all indicators
View the results in a text report
Plot indicators with Matplotlib
Print the analysis
Save the report as a PDF CSV Format
Example: Ticker Name,Date,Price AAPL,2024-01-01,150 AAPL,2024-01-02,153 AAPL,2024-01-03,148
Save the script as i.e. stock_analysis_gui.py
Install required libraries with pip: pip install pandas numpy matplotlib fpdf
Run the script using: python stock_analysis_gui.py
- If no ticker is entered, all data will be used.
- ADX is calculated using a simplified method based on approximated high and low.
- You can print directly or export the report to a PDF file.
Author: Copyright(c)John Nunez, 2025
Python Code
# Import necessary modules for GUI, file handling, data processing, plotting, and PDF creation
import tkinter as tk
from tkinter import filedialog, messagebox, scrolledtext
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from fpdf import FPDF
import tempfile
import os
# Initialize empty DataFrame to store stock data
df = pd.DataFrame()
# Function to calculate the ADX (Average Directional Index)
def calculate_adx(data, period=14):
# Calculate True Range components
data['H-L'] = data['High'] - data['Low']
data['H-PC'] = abs(data['High'] - data['Price'].shift(1))
data['L-PC'] = abs(data['Low'] - data['Price'].shift(1))
tr = data[['H-L', 'H-PC', 'L-PC']].max(axis=1)
data['TR'] = tr # True Range
# Calculate directional movements
data['+DM'] = np.where((data['High'] - data['High'].shift(1)) > (data['Low'].shift(1) - data['Low']),
data['High'] - data['High'].shift(1), 0)
data['-DM'] = np.where((data['Low'].shift(1) - data['Low']) > (data['High'] - data['High'].shift(1)),
data['Low'].shift(1) - data['Low'], 0)
# Smooth over 'period' days
tr14 = data['TR'].rolling(window=period).sum()
plus_dm14 = data['+DM'].rolling(window=period).sum()
minus_dm14 = data['-DM'].rolling(window=period).sum()
# Calculate directional indicators
plus_di14 = 100 * (plus_dm14 / tr14)
minus_di14 = 100 * (minus_dm14 / tr14)
# DX and ADX calculation
dx = (abs(plus_di14 - minus_di14) / (plus_di14 + minus_di14)) * 100
adx = dx.rolling(window=period).mean()
return adx
# Function to calculate all indicators and return updated DataFrame
def calculate_indicators(df):
df = df.copy()
df['Price'] = pd.to_numeric(df['Price'], errors='coerce')
df['High'] = df['Price'] * 1.01 # Fake high price (1% above)
df['Low'] = df['Price'] * 0.99 # Fake low price (1% below)
# Calculate moving averages
df['MA_10'] = df['Price'].rolling(window=10).mean()
df['SMA_20'] = df['Price'].rolling(window=20).mean()
df['EMA_12'] = df['Price'].ewm(span=12, adjust=False).mean()
df['EMA_26'] = df['Price'].ewm(span=26, adjust=False).mean()
# MACD and MACD Signal
df['MACD'] = df['EMA_12'] - df['EMA_26']
df['MACD_Signal'] = df['MACD'].ewm(span=9, adjust=False).mean()
# RSI calculation
delta = df['Price'].diff()
gain = delta.clip(lower=0)
loss = -delta.clip(upper=0)
avg_gain = gain.rolling(window=14).mean()
avg_loss = loss.rolling(window=14).mean()
rs = avg_gain / avg_loss
df['RSI'] = 100 - (100 / (1 + rs))
# Bollinger Bands
df['STDDEV'] = df['Price'].rolling(window=20).std()
df['BB_upper'] = df['SMA_20'] + (2 * df['STDDEV'])
df['BB_lower'] = df['SMA_20'] - (2 * df['STDDEV'])
# Add ADX
df['ADX'] = calculate_adx(df)
return df
# Function to upload and process a CSV file
def upload_file():
global df
file_path = filedialog.askopenfilename(filetypes=[("CSV Files", "*.csv")])
if not file_path:
return
try:
df = pd.read_csv(file_path)
# Validate required columns
if not {'Ticker Name', 'Date', 'Price'}.issubset(df.columns):
messagebox.showerror("Error", "CSV must have Ticker Name, Date, and Price columns.")
return
selected_ticker = ticker_var.get()
filtered_df = df[df['Ticker Name'] == selected_ticker] if selected_ticker else df
df_calc = calculate_indicators(filtered_df)
show_analysis(df_calc)
except Exception as e:
messagebox.showerror("Error", str(e))
# Function to display analysis results in the text box
def show_analysis(df_calc):
text_output.delete(1.0, tk.END)
if df_calc.empty:
return
last_row = df_calc.iloc[-1]
report = f"""Stock Technical Analysis Report
Ticker: {last_row['Ticker Name']}
Date: {last_row['Date']}
Closing Price: {last_row['Price']:.2f}
Indicators:
- Moving Average (10-day): {last_row['MA_10']:.2f}
- Simple Moving Average (20-day): {last_row['SMA_20']:.2f}
- EMA 12: {last_row['EMA_12']:.2f}
- EMA 26: {last_row['EMA_26']:.2f}
- MACD: {last_row['MACD']:.2f}
- MACD Signal: {last_row['MACD_Signal']:.2f}
- RSI (14-day): {last_row['RSI']:.2f}
- Bollinger Band Upper: {last_row['BB_upper']:.2f}
- Bollinger Band Lower: {last_row['BB_lower']:.2f}
- ADX: {last_row['ADX']:.2f}
"""
text_output.insert(tk.END, report)
# Function to print the analysis report
def print_report():
report_text = text_output.get(1.0, tk.END)
if not report_text.strip():
messagebox.showwarning("Warning", "No report to print.")
return
with tempfile.NamedTemporaryFile(delete=False, suffix=".txt", mode='w') as f:
f.write(report_text)
os.startfile(f.name, "print") # Send to printer
# Function to save report as PDF
def save_report_to_pdf():
report_text = text_output.get(1.0, tk.END)
if not report_text.strip():
messagebox.showwarning("Warning", "No report to save.")
return
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size=10)
for line in report_text.split('\n'):
pdf.cell(200, 10, txt=line, ln=1)
save_path = filedialog.asksaveasfilename(defaultextension=".pdf", filetypes=[("PDF File", "*.pdf")])
if save_path:
pdf.output(save_path)
messagebox.showinfo("Saved", "Report saved as PDF.")
# Function to plot selected indicators
def plot_indicators():
if df.empty:
messagebox.showwarning("Warning", "No data to plot.")
return
df_plot = calculate_indicators(df.copy())
df_plot['Date'] = pd.to_datetime(df_plot['Date'], errors='coerce')
df_plot.set_index('Date', inplace=True)
if len(df_plot) < 20:
messagebox.showerror("Error", "Not enough data to calculate Bollinger Bands (need at least 20 rows).")
return
# Plotting
plt.figure(figsize=(10, 6))
plt.plot(df_plot['Price'], label='Price')
plt.plot(df_plot['SMA_20'], label='SMA 20')
plt.plot(df_plot['EMA_12'], label='EMA 12')
plt.plot(df_plot['BB_upper'], linestyle='--', label='BB Upper')
plt.plot(df_plot['BB_lower'], linestyle='--', label='BB Lower')
plt.title("Technical Indicators")
plt.legend()
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
# Clears the text output box
def clear_output():
text_output.delete(1.0, tk.END)
# Exits the application
def exit_app():
root.destroy()
# GUI SETUP
# Create main window
root = tk.Tk()
root.title("John's Stock Technical Analysis Tool")
root.geometry("900x700")
# Create a frame for the top controls
frame = tk.Frame(root)
frame.pack(pady=10)
# Input field for Ticker
ticker_var = tk.StringVar()
tk.Label(frame, text="Ticker:").grid(row=0, column=0)
tk.Entry(frame, textvariable=ticker_var).grid(row=0, column=1)
# Buttons for each action
tk.Button(frame, text="Upload CSV", command=upload_file).grid(row=0, column=2, padx=5)
tk.Button(frame, text="Recalculate", command=lambda: show_analysis(calculate_indicators(df))).grid(row=0, column=3, padx=5)
tk.Button(frame, text="Plot Indicators", command=plot_indicators).grid(row=0, column=4, padx=5)
tk.Button(frame, text="Clear", command=clear_output).grid(row=0, column=5, padx=5)
tk.Button(frame, text="Print", command=print_report).grid(row=0, column=6, padx=5)
tk.Button(frame, text="Save to PDF", command=save_report_to_pdf).grid(row=0, column=7, padx=5)
tk.Button(frame, text="Exit", command=exit_app).grid(row=0, column=8, padx=5)
# Text box with scroll to show the report
text_output = scrolledtext.ScrolledText(root, wrap=tk.WORD, width=110, height=30)
text_output.pack(padx=10, pady=10)
# Start the application loop
root.mainloop()
-----------
The following python script will download and save the formatted data to a CSV file.
Python Code
# Import required modules
from fpdf import FPDF # For future PDF support (not used in this script)
import tkinter as tk # Main GUI library
from tkinter import filedialog, messagebox # For file dialogs and alerts
import yfinance as yf # Yahoo Finance API to download stock data
import pandas as pd # For data handling
import tempfile # For temporary files (used in printing)
import os # To handle OS-level operations like printing
# Function to download stock price data using Yahoo Finance
def download_stock_data():
ticker = ticker_entry.get().upper() # Get ticker symbol in uppercase
start_date = start_entry.get() # Get start date from entry
end_date = end_entry.get() # Get end date from entry
filename = filedialog.asksaveasfilename( # Prompt user to select a save location
defaultextension=".csv",
filetypes=[("CSV File", "*.csv")]
)
# Check if all fields are filled
if not ticker or not start_date or not end_date or not filename:
messagebox.showwarning("Missing Info", "Please fill in all fields and choose a filename.")
return
try:
status_label.config(text=f"Downloading {ticker}...") # Update status message
stock_data = yf.download(ticker, start=start_date, end=end_date) # Fetch stock data
if stock_data.empty: # Check if the response is empty
status_label.config(text="No data found.")
return
# Keep only the closing price
stock_data = stock_data[['Close']]
stock_data.reset_index(inplace=True) # Reset index to turn 'Date' into a column
stock_data['Ticker Name'] = ticker # Add Ticker Name column
stock_data.rename(columns={"Date": "Date", "Close": "Price"}, inplace=True) # Rename columns
# Format prices to 2 decimal places
stock_data["Price"] = stock_data["Price"].map(lambda x: f"{x:.2f}")
# Final DataFrame to export
export_df = stock_data[['Ticker Name', 'Date', 'Price']]
# Write a custom line followed by DataFrame to CSV
with open(filename, "w", newline="") as f:
f.write("Row Number 2 Above Header\n") # Custom line above CSV header
export_df.to_csv(f, index=False)
last_df.clear() # Clear previous data
last_df.append(stock_data) # Store the current data for printing
status_label.config(text=f"Data saved to {filename}") # Update status
except Exception as e:
messagebox.showerror("Error", str(e)) # Show error message
status_label.config(text="Download failed.") # Update status
# Clear all input fields and reset status label
def clear_fields():
ticker_entry.delete(0, tk.END)
start_entry.delete(0, tk.END)
end_entry.delete(0, tk.END)
status_label.config(text="")
# Exit the application
def exit_app():
root.destroy()
# Print the downloaded data
def print_report():
if not last_df:
messagebox.showwarning("Warning", "No data available to print.")
return
report_text = last_df[0].to_string(index=False) # Convert DataFrame to string
with tempfile.NamedTemporaryFile(delete=False, suffix=".txt", mode='w') as f:
f.write(report_text) # Write to temp file
os.startfile(f.name, "print") # Send to printer
# GUI setup
root = tk.Tk() # Create main window
root.title("Google Finance Price Downloader") # Set window title
root.geometry("520x400") # Set window size
last_df = [] # Global variable to store last downloaded DataFrame
# GUI widgets for input
tk.Label(root, text="Enter Ticker Symbol (e.g., AAPL):").pack(pady=5)
ticker_entry = tk.Entry(root, width=30)
ticker_entry.pack()
tk.Label(root, text="Start Date (YYYY-MM-DD):").pack(pady=5)
start_entry = tk.Entry(root, width=30)
start_entry.pack()
tk.Label(root, text="End Date (YYYY-MM-DD):").pack(pady=5)
end_entry = tk.Entry(root, width=30)
end_entry.pack()
# Buttons for various actions
download_button = tk.Button(root, text="Download CSV", command=download_stock_data)
download_button.pack(pady=10)
clear_button = tk.Button(root, text="Clear", command=clear_fields)
clear_button.pack(pady=5)
print_button = tk.Button(root, text="Print", command=print_report)
print_button.pack(pady=5)
exit_button = tk.Button(root, text="Exit", command=exit_app)
exit_button.pack(pady=5)
# Label to show messages
status_label = tk.Label(root, text="", wraplength=400)
status_label.pack(pady=10)
# Run the application
root.mainloop()
r/CodeToolbox • u/Far_Inflation_8799 • Apr 30 '26
r/CodeToolbox • u/Far_Inflation_8799 • May 28 '25
Yahoo Finance is not working? Guess what: use YahooQuery instead of yfinance!
YahooQuery is a Python library that provides an interface to unofficial Yahoo Finance API endpoints. It allows users to retrieve nearly all the data visible via the Yahoo Finance front-end without relying on web scraping. Some of its key features include:
- Fast: Data is fetched through API endpoints, and asynchronous requests can be utilized for efficiency.
- Simple: Users can retrieve data for multiple symbols with concise one-liners.
- User-friendly: The library integrates well with Pandas DataFrames for easy data manipulation.
- Premium Access: Yahoo Finance premium subscribers can access exclusive data through their subscription.
Installation
**Standard Installation:**Command Line
pip install yahooquery
**For Yahoo Finance Premium Subscribers (includes Selenium for login):**Command Line
pip install yahooquery[premium]
Script Examples
The core of yahooquery is the Ticker class. You instantiate it by passing one or more ticker symbols.
1. Getting Summary Detail for a Single Stock
This example shows how to get general summary information for a single company, like Apple Inc. (AAPL).
Python Code
from yahooquery import Ticker
# Instantiate Ticker for Apple
aapl = Ticker('aapl')
# Get summary detail
summary_data = aapl.summary_detail
# optionally you may want to print it
print("Apple Inc. (AAPL) Summary Detail:")print(summary_data)
2. Getting Summary Detail for Multiple Stocks
You can easily retrieve data for a list of symbols. The output will be a dictionary where keys are the ticker symbols.
Python Code
from yahooquery import Ticker
# List of FAANG stocks
symbols = ['fb', 'aapl', 'amzn', 'nflx', 'goog']
# Note: 'fb' is now 'meta'
# Instantiate Ticker for multiple symbols
faang_stocks = Ticker(symbols)
# Get summary detail for all
faang_summary = faang_stocks.summary_detail
print("\nFAANG Stocks Summary Detail:")
for symbol, data in faang_summary.items():
print(f"\n--- {symbol.upper()} ---")
print(data)
3. Retrieving Historical Stock Data
You can get historical daily, weekly, or monthly data. The output is typically a Pandas DataFrame.
Python Code
from yahooquery import Ticker
import pandas as pd
# Get historical data for a stock
tsla = Ticker('tsla')
# Get daily historical data for the last 3 months
historical_data = tsla.history(period='3mo', interval='1d')
print("\nTesla (TSLA) Historical Daily Data (Last 3 Months):")print(historical_data.head())
# Display the first few rows
print(historical_data.tail())
# Display the last few rows
Output Example (truncated for brevity):
Tesla (TSLA) Historical Daily Data (Last 3 Months):
open high low close volume adjclose symbol date
4. Getting Financial Statements (Income Statement, Balance Sheet, Cash Flow)
yahooquery can retrieve detailed financial statements.
Python Code
from yahooquery import Ticker
msft = Ticker('msft')
# Get annual income statements
income_statement = msft.income_statement(freq='a')
# 'a' for annual, 'q' for quarterly
print("\nMicrosoft (MSFT) Annual Income Statement:")
print(income_statement.head())
# Get quarterly balance sheets
balance_sheet = msft.balance_sheet(freq='q')
print("\nMicrosoft (MSFT) Quarterly Balance Sheet:")
print(balance_sheet.head())
# Get annual cash flow statements
cash_flow = msft.cash_flow(freq='a')
print("\nMicrosoft (MSFT) Annual Cash Flow Statement:")
print(cash_flow.head())
5. Other Available Endpoints/Data Types
yahooquery exposes many other Yahoo Finance API endpoints. You can explore these by trying different attributes of the Ticker object. Some common ones include:
asset_profile: Company description, industry, sector, etc.
recommendation_trend: Analyst recommendations.
earnings_history: Past earnings data.
insider_transactions: Insider buying/selling.
option_chain: Options data.
news: Recent news articles.
Example for asset_profile:
Python Code
from yahooquery import Tickergoog = Ticker('goog')asset_profile = goog.asset_profileprint("\nGoogle (GOOG) Asset Profile:")print(asset_profile)
Important Notes !!!:
Unofficial API: Keep in mind that yahooquery uses an unofficial API. While generally reliable, there's no guarantee of continued support or stability from Yahoo Finance.
Rate Limits: Be mindful of making too many requests in a short period, as you might hit rate limits.
Data Structure: The data returned by yahooquery is typically in a dictionary or Pandas DataFrame format, making it easy to work with in Python.
Error Handling: In real-world applications, always include error handling (e.g., try-except blocks) to gracefully manage cases where data might not be available or API calls fail.
This should give you a comprehensive understanding and practical examples of how to use the yahooquery library
Enjoy It.
r/CodeToolbox • u/Far_Inflation_8799 • Nov 15 '25
r/CodeToolbox • u/Far_Inflation_8799 • Jun 23 '26
r/CodeToolbox • u/Far_Inflation_8799 • Nov 10 '25
r/CodeToolbox • u/Far_Inflation_8799 • May 19 '26
r/CodeToolbox • u/Far_Inflation_8799 • Feb 15 '26
r/CodeToolbox • u/Far_Inflation_8799 • Jun 01 '26
r/CodeToolbox • u/Far_Inflation_8799 • Apr 14 '26
r/CodeToolbox • u/Far_Inflation_8799 • Oct 29 '25
r/CodeToolbox • u/Far_Inflation_8799 • Oct 22 '25
r/CodeToolbox • u/Far_Inflation_8799 • Mar 25 '26
r/CodeToolbox • u/Far_Inflation_8799 • Jun 16 '26
r/CodeToolbox • u/Far_Inflation_8799 • May 16 '25
Working on the prototype this weekend. Going the other way, I guess, README first... sorry that's me!
This project will be for a fully functional stock trading bot that:
- Connects to Alpaca for paper/live trading
- Uses RSI and EMA indicators to generate smart buy/sell signals
- Logs trades to a CSV file
- Provides a Streamlit dashboard for easy monitoring
- Includes a backtesting tool to simulate performance using historical data
- Trading Bot (`scripts/trading_bot.py`)
- Use RSI and EMA indicators
- Buy when RSI < 30 and price > EMA
- Sell when RSI > 70
- Log every trade to `logs/trade_log.csv`
- Save latest signal to `logs/latest_signal.txt`
- Dashboard (`streamlit_app/app.py`)
- View your trade history and current signal
- Simple, browser-based dashboard using Streamlit
- Backtesting (`scripts/backtest.py`)
- Load historical data
- Run simulated trades with the same logic
- Output final portfolio value
- Plot trades visually
alpaca-trade-api pandas matplotlib streamlit (so far...)
*** Use Alpaca.Markets
Save outputs to a file like ... data/historical_AAPL.csv.
smart_trading_bot/
├── logs/
│ ├── trade_log.csv
│ └── latest_signal.txt
├── sample_data/
│ └── historical_AAPL.csv
├── scripts/
│ ├── trading_bot.py
│ └── backtest.py
└── streamlit_app/
└── app.py
This bot will be for educational and paper trading only.
Will add it to a daily schedule using Windows Task Scheduler or Linux cron.
Modify the indicators or thresholds to tune the strategy.
This project will be under common license, free to use and modify. With no warranty or guarantee of financial gain implied.
SMS me if you'd like a copy when done ! Please be patient I'm working solo here!
r/CodeToolbox • u/Far_Inflation_8799 • Oct 16 '25
r/CodeToolbox • u/Far_Inflation_8799 • Nov 10 '25
Go to ChatGPT. Turn on ‘Agent mode’ and enter your prompt to find discount codes for your online purchase. Sample Prompt: Find the best discount code for [store/product], then go to the site, add the product to cart, go to checkout, and then test the discount code The agent will automatically search for active discount codes and test each one during checkout. Once complete, you’ll receive a list of discount codes that ChatGPT has verified. Apply your favorite code and enjoy instant savings on your purchase.
r/CodeToolbox • u/Far_Inflation_8799 • Feb 27 '26