The Stock Market Mood Ring

Day 62 of 100 Days Coding Challenge: Python

Yesterday, I taught my script how to look into the past—specifically, the last 30 days of each tracked stock’s closing prices. Today, we’re talking emotions—well, stock emotions. I added a function in Python to show each stock’s daily percentage change, color-coded like a moody person: green when it’s up, red when it’s down, and default when it’s flat.

Now, to be clear, I’m not a day trader glued to five monitors with live tickers whizzing by. I have a full-time job, thank you very much, and no one’s got time for that kind of circus. I check in weekly, adjust when needed, and focus on consistency over drama. Still, this function gives me a quick visual snapshot of how things are moving—and more importantly, how they might move. It’s like giving your portfolio a morning coffee and asking, “How are we feeling today?”

Patterns are the name of the game. If I can start spotting them, maybe one day I’ll teach this program to make some educated guesses—and eventually, add a bit of risk management to keep me from playing financial roulette. The next few days are all about adding the kind of analytical firepower that helps with smarter decisions down the road. And honestly? I’m kind of pumped.

Today’s Motivation / Challenge

You know that moment when you look at your bank account and squint, wondering, “What happened yesterday?” That’s what this feature is for. It’s like a digital mood chart for your stocks—without the therapy bills. Adding daily change percentages, especially in color, helps me scan for drama or calm in seconds. It’s a tiny step toward building a truly useful tool for hands-off investors like me, who want the intel without the stress.

Purpose of the Code (Object)

This code adds a quick visual check-in for each stock in my portfolio. It tells me whether a stock’s price went up or down today—and by how much—without needing a spreadsheet or third-party app. It’s lightweight, readable, and tailored to my investment rhythm.

AI Prompt (used to create today’s function):

“Please add the following function to the script.
Daily Change (%): Show today’s % change for each stock with green/red highlight.

Functions & Features

  • Calculates daily percent change for each stock.
  • Highlights gains in green and losses in red.
  • Leaves unchanged stocks in default color.
  • Makes my console look like it actually cares.

Requirements / Setup

pip install yfinance

Minimal Code Sample

if change_percent > 0:

    color = “\033[92m”  # Green

elif change_percent < 0:

    color = “\033[91m”  # Red

else:

    color = “\033[0m”   # Reset

This assigns a text color based on the day’s percent change in stock price.

Stock Tracker

Notes / Lessons Learned


I’m starting to feel like a feature-adding machine—well-oiled, slightly caffeinated, and surprisingly organized. Thanks to the roadmap I drafted early on, it’s easier to stack new functions like LEGO bricks (minus the foot pain).

Today, I learned how to add color using ANSI escape codes. Think of them as secret signals you whisper to your terminal to make it look fancier. So now, green means the stock had a good day, red means it might need a hug, and the reset command keeps the rest of the terminal from turning into Christmas.

What I love about this feature? It’s subtle but powerful. Visual clarity goes a long way when you don’t have time to deep dive. And hey—who knew the terminal had a flair for drama?

Optional Ideas for Expansion

  • Add arrows (↑/↓) next to the percent for more flair.
  • Let users set custom alert colors (purple for panic? Why not).
  • Create a summary line showing how many stocks gained vs. lost today.

Watching Your Stocks Like a Hawk (But With a Graph)

Day 61 of 100 Days Coding Challenge: Python

The last five days were all about laying the foundation—think of it as assembling IKEA furniture, but with Python and fewer Allen wrenches. I got the stock tracker’s bones in place, installing essentials like the yfinance library. Now, it’s time to dress it up and make it do something more alive—like track real stock movement over time.

I’m finally stepping into the exciting part: creating a portfolio visualization that doesn’t require squinting at 14 browser tabs.

We’re starting simple. One historical price chart per stock. No more, no less. Why? Because trying to cram five charts into one screen is like watching five soap operas at once—dramatic, confusing, and probably bad for your blood pressure.

Back in university, my finance professors swore by stock observation like it was a sacred rite. Watch the markets, they said. Understand the impact of events—unemployment numbers, interest rate announcements, or when Jerome Powell so much as blinks. These things shake the market, and now, thanks to a bit of Python magic, I can watch those ripples without hopping from one website to another.

Today’s Motivation / Challenge

Have you ever tried checking your stocks manually, one by one? It’s like chasing toddlers in different directions. Today’s goal: automate that madness. With a single function, I want to see the historical price trends of each stock in my portfolio—visually. Because numbers are fine, but a chart? A chart speaks volumes.

Purpose of the Code (Object)

This little script fetches and plots the past 30 days of closing prices for each stock in your portfolio. It doesn’t try to impress anyone with fancy calculations. It just shows you what your stock has been up to, in a nice, simple line graph—so you can stop opening 27 browser tabs.

AI Prompt

Add the function to plot past 30-day price history for a single stock

Functions & Features

  • Plots past 30-day price history for a single stock
  • Automatically fetches historical data from Yahoo Finance.
  • Easy to reuse for each stock in your portfolio

Requirements / Setup

pip install yfinance matplotlib

Minimal Code Sample

import yfinance as yf

import matplotlib.pyplot as plt

def plot_stock_history(ticker):

    stock = yf.Ticker(ticker)

    hist = stock.history(period=”30d”)

    hist[‘Close’].plot(title=f”{ticker} – Last 30 Days”)

    plt.xlabel(“Date”)

    plt.ylabel(“Price ($)”)

    plt.grid(True)

    plt.show()

→ Fetches and plots 30-day closing price for a given stock symbol.

Stock Tracker

Notes / Lessons Learned

To get this feature working, I first installed yfinance and matplotlib. Easy enough—until I noticed the pip version nagging me to update (again). I was on 25.1.1, and suddenly it wants 25.2. It’s like that one friend who insists on “just one more update” before going out.

This is the reality of programming: libraries get updated more often than your favorite streaming shows, and if you’re not careful, your working code might just throw a tantrum the next day. I used to roll my eyes when game servers went down for “maintenance.” Now I know—those devs were heroes.

Also, pro tip: stock movements don’t just come from earnings reports. Tariff announcements? Those hit hard. I saw a few of my stocks tumble right after one went into effect. Should’ve bought the dip… but hey, now I can at least see it happening, in style.

Optional Ideas for Expansion

  • Add a dropdown menu or an input box to select stock instead of typing it
  • Color-code gains vs losses on the chart
  • Combine charts into one interactive dashboard (when you’re feeling brave)

Pull-Ups, Greed, and the Fine Art of Pushing Just Enough

Brian’s fitness journal after a brain stroke

I woke up a few minutes early this morning, which already put me in a suspiciously good mood. Mondays usually require negotiation. Today did not. Today was pull-up day.

That meant I had a decision to make.

I’d originally set my goal at 20 pull-ups—a nice, round, respectable number. I hit that last week. So the question was simple:
Do I maintain… or do I get greedy?

Before my brain stroke, I used to follow a program called P90X. I had one of those doorway pull-up bars—the kind that makes you question both engineering and your doorframe. A year before my stroke, my wife upgraded me to a proper exercise bar. Then the stroke happened. The bar sat unused. Later, it was dismantled when we moved to Nashville.

For a long time, upper-body strength wasn’t even on the agenda.

First came walking—with a walker.
Then walking with my wife’s support.
Then a stick.
Then jogging.
And now… 10K runs.

A few years ago, I pulled the equipment back out and reassembled it. At first, pull-ups were brutal. Awkward. Humbling. But slowly—quietly—they came back.

Here’s the strange part:
I can now do more pull-ups than I could before my stroke.

That still surprises me.

So this morning, being appropriately greedy, I went for 21.

I completed the first 10 without dropping from the bar and immediately felt victorious enough to justify the decision. When you push just beyond what you think you can handle—not recklessly, but deliberately—your body often agrees to the negotiation.

The remaining 11 came in two bursts:
6 pull-ups, a few seconds of existential bargaining, then 5 more.

Done.

I’m still careful. I have to be. My kidneys mean I can’t overwork muscle tissue or recover like a typical athlete. Cardio and resistance training are good for me—but excess is not. Everything lives in the margins of balance.

Still, this kind of pushing works for me.

For now, I think I’ll keep increasing the count each week—at least until I can comfortably complete two clean sets of 10 with only a short break between them.

After that?
We’ll renegotiate again.

That’s how progress works—not in straight lines, but in small, stubborn decisions made on ordinary Monday mornings.

How to Simulate Weighted Stock Investments in Python

Day 60 of 100 Days Coding Challenge: Python

When it comes to investing, I tend to lean toward the systematic approach. I like a plan. Not a “buy high, panic low” kind of plan, but a “how can I make $100 go as far as possible without needing a spreadsheet and a prayer” plan. Many stocks—especially ETFs—allow fractional share purchases, which is a blessing for anyone whose investing budget is less Wall Street and more wallet lint. That’s the beauty of modern investing: even if you don’t have a mountain of capital, you can still climb the hill.

So today I asked myself, what if my program could simulate that for me? What if I could say, “Here’s my $100,” and the program could allocate it automatically? Then I thought: what if I want to invest 25% in TSLA and only 5% in that random biotech company I’m not sure I trust? That’s where the idea of weighted allocation came in. A little money invested consistently can become something big over time—and the code now knows how to treat your dollars like they matter. Because they do.

Today’s Motivation / Challenge

You’ve probably heard some version of the advice “invest consistently, even with small amounts.” But how do you split that $100 in a smart, intentional way? Today’s challenge was about helping the program act like a friendly robo-advisor. Instead of dividing your money equally, it now lets you decide how much each stock gets. More TSLA, less risk. Or more risk, less cash. Either way, it’s your call—and the math is on your side.

Purpose of the Code (Object)

This new feature lets you simulate how much stock you could buy with a specific amount of money based on custom weight percentages. You choose the amount to invest, set the allocation weights for each stock, and the script calculates how many shares you could get, what it would cost, and how much remains. It’s budgeting, but for your imaginary portfolio.

AI Prompt: 

Create a Python function that takes a total investment amount and a custom percentage for each stock, then calculates how many shares can be purchased and the cost per stock using yfinance.

Functions & Features

  • Add or remove stock symbols from your portfolio
  • View real-time prices of all tracked stocks
  • Simulate investment allocation based on equal weights
  • Simulate investment allocation based on custom weight percentages
  • Check the price of a specific stock
  • Exit the program (option 99)

Requirements / Setup

pip install yfinance

Works with Python 3.8+. Use a virtual environment for clean setup.

Minimal Code Sample

def simulate_weighted_allocation():

    total = float(input(“How much to invest? $”))

    for symbol in stocks:

        weight = float(input(f”{symbol} weight (%): “))

        allocated = (weight / 100) * total

        shares = allocated / get_price(symbol)

        print(f”{symbol}: {shares:.4f} shares for ${allocated:.2f}”)

Takes your total investment and simulates purchasing based on custom weights.

Stock Tracker App

Notes / Lessons Learned

Initially, my simulation just split the money evenly—simple and safe. With 13 stocks in my portfolio, that reminded me of those index funds that allocate 1% to everything, like some kind of financial democracy. And while that’s a solid strategy (Vanguard would approve), I wanted control. I wanted to give TSLA a bigger slice of my $100 pie. So I added a custom weight input. Now the script lets me play mini portfolio manager.

One catch: if your percentages don’t add up to exactly 100, the program will throw a gentle tantrum. So you do have to plan ahead and know what you’re allocating. Otherwise, it’s like hosting a potluck and forgetting who brings dessert—awkward and disappointing. Still, once it worked, I thought: This is cool. It’s like mock investing with real math—and zero risk.

Optional Ideas for Expansion

  • Save your weight presets for recurring investment styles
  • Add error handling to automatically rebalance weights to 100%
  • Display a pie chart of your allocation with matplotlib

This marks the point where the stock tracker grows from a utility to a personal investing playground. And we’re only 60 days in.