Day 7: Tackling Mic Gain Problems and Exploring High-Frequency Trading

Search for a command to run...

No comments yet. Be the first to comment.
In the world of software development, we often talk about "clean code" and "optimal algorithms" in a vacuum. But for many developers, coding doesn't happen in a sterile lab; it happens amidst system crashes, environmental frustrations, and the weight...

Watch the Day 5 raw log here: https://youtu.be/Kh3lQ0drC8Y The Pursuit of Discipline I’ll be honest: today was a rough day and my mood was quite off. I faced setbacks with two Online Assessments (OAs)—one for Milliman that didn't go well and another ...

Watch the Day 4 raw log here: https://youtu.be/TNzKKlwQrYM The Pursuit of Discipline Day 4 is about refining the "Signal." In high-frequency trading, every nanosecond counts, and today I focused on how both our algorithms and our choice of data struc...

Watch the Day 3 raw log here: https://youtu.be/Mcia2gwFWfA The Pursuit of Discipline I’ll be honest: I struggled with procrastination yesterday. I realized my previous 40-minute videos were too long to be sustainable logs, so I'm shifting to more foc...

On this page
Let’s be real: some days of development are 10% coding and 90% fighting your tools. Day 7 was exactly that—a mix of OBS audio tuning, "Day 1" algorithm logic, and deep-level C++ concurrency.
Check the live session here: Watch on YouTube
Before hitting a single line of C++, I spent the first 10 minutes fighting OBS Studio. If your mic gain is too low, nobody listens. If it’s too high, you’re clipping and blowing out eardrums.
We tackled the Maximum Average Subarray problem. The naive way to find the average of elements in an array of size is . That's garbage.
Instead of re-summing elements every time, you just:
Performance Hack: Don’t calculate the average inside the loop. Division is expensive for a CPU. Compare the sums instead, and do a single division at the very end.
// Optimized Logic
for (int i = k; i < nums.size(); ++i) {
currentSum += nums[i] - nums[i - k];
maxSum = std::max(maxSum, currentSum);
}
return (double)maxSum / k; // Single division = Win
When building a Trading Terminal (which I’ve renamed to Hir Trader to avoid trademark drama), every clock cycle is a liability.
Stop using i++. Use ++i.
i++ (Postfix) creates a temporary copy of the object before incrementing.++i (Prefix) increments in place. In a loop running millions of times, those temporary objects add up to a performance tax you don't want to pay.In multithreaded trading engines, two threads can fight over the same Cache Line even if they are touching different variables.
alignas(64) to ensure your atomic variables stay on their own cache lines. This prevents "False Sharing," which can destroy your throughput faster than a bad algorithm.I’m keeping a strict work log and using WinGet for package management to keep the environment clean. Most of the heavy lifting is in C++ and CMake, with a focus on benchmarking the matching engine to handle 100+ orders with sub-millisecond latency.
While the West worries about Friday the 13th, we’re out here celebrating Sankranti and Ekadashi. It's a good reminder that perspective changes everything—whether in life or in code.
The benchmark results for the matching engine are coming next. I’ll be pushing the concurrency-safe structures to GitHub soon.
#CPlusPlus #HFT #CodingLife #SoftwareEngineering #Optimization #SlidingWindow