
An Apple Pies Approach To Algorithmic Trading!
Who made the first apple pie? Where did it originate? Honestly, I have no clue! But you know who might? Lauren Cabral from BackThenHistory. Here’s what she has to say:
“Like apples, apple pie isn’t as American as you might think. It actually originated in Europe, influenced by multiple culinary traditions, including British, French, Dutch, and Ottoman cuisines.”
An anonymous Due South writer adds: “The earliest recorded apple pie recipe dates back to 1381 in a cookbook called The Forme of Cury, compiled by King Richard II’s master cooks.”
So, apple pie was first documented in a royal cookbook? Makes sense! Back then, rich and extravagant flavors were reserved for the elite. But does it really matter where apple pie came from? What truly matters is that this sweet and savory dish—apples blended with sugar, flour, and other ingredients—has become one of the world’s most beloved treats.
Where to Begin?
To create our version of this classic treat—once exclusive to the elite but now mastered by a select few—we’ll blend financial apple instruments, sugar-like correlations, and statistical flour packages. Then, we’ll mix these ingredients in our integrated development environment (IDE) bowl and bake them using our application programming interface (API) oven, hoping to serve up some profitable results in the markets.
As newcomers to the business, we first need the right setup. Our tools of choice? PyCharm as our IDE bowl and Interactive Brokers’ Web API as our API oven. (For context, an IDE is where we write and run code, while an API connects us to live financial data from our brokerage account.)
The Challenge: Competing in the Market
Pie markets, like financial markets, are volatile. There are countless pies and even more pie makers, making it tough to stand out. Powell’s Pies will be competing with seasoned players who dominate the industry—J Pie Morgan, MorgPie Stanley, and GoldPie Stacks.
But what if Powell’s Pies received a $100,000 investment? Could we compete then? Maybe. Let’s consider how another pie business, Samy’s Pies, thrives.
A Strategic Approach: Lessons from Samy’s Pies
Samy’s Pies sells year-round but sees peak revenue during the holidays. By offering seasonal specialties—apple peach pies in spring and green apple pies for St. Patrick’s Day—Samy capitalizes on untapped market segments.
Algorithmic trading follows a similar logic. Competing with financial giants requires a unique strategy, much like running a new pie shop—leveraging available capital to exploit overlooked opportunities. Sounds like Business 101!
Finding Profit in Market Movements
Matt Levine’s Bloomberg newsletter, The SEC Was Busy Last Week, explains a simple trading strategy:
1. Most investors hold 60/40 portfolios—60% stocks, 40% bonds.
2. If stocks rise 2% and bonds fall 2%, the portfolio shifts to 61/39.
3. To rebalance, investors must sell stocks and buy bonds.
4. This buying and selling impacts market prices, creating an opportunity to profit.
A clever approach to pie sales follows the same principle—sell directly to pie companies that struggle to meet demand at certain times. Ethical? Maybe. Profitable? Definitely.
The Dark Side of Sweetening the Pot
Levine also discusses the SEC’s enforcement case against Two Sigma, a quantitative hedge fund. Two Sigma researchers allegedly manipulated their firm’s algorithmic trading model, prioritizing their own signals to boost performance and increase their personal payouts.
Hedge funds rely on trading signals—ingredients that enhance their strategy. These signals feed into an IDE, guiding investment decisions based on factors like market trends or even political events, such as a Trump tweet affecting the U.S. dollar.
In Two Sigma’s case, researchers manipulated correlation—a measure of how assets move together—to artificially boost returns. Their actions led to a $400 million gain for some funds but a $165 million loss for others. While the firm netted a $235 million profit, the deception harmed investors in the underperforming fund. As a result, Two Sigma paid $165 million in restitution and an additional $90 million to the SEC, bringing their total penalty to $255 million. That’s a costly lesson in ethics.
The Key Takeaway: Balancing Ingredients for Success
In trading, as in baking, too much correlation (or sugar) can be harmful. Manipulating data to obscure true risk is even worse. If Powell’s Pies advertised a specific sugar content but secretly overloaded its recipes, regulatory bodies—let’s call them the PIE-SEC—would step in.
This example highlights a crucial principle: The weighting of our algorithmic trading ingredients matters. A well-structured portfolio with low correlation among assets leads to optimal risk-adjusted returns.
In our next post, we’ll explore how to achieve this ideal balance. Until then, let’s keep our pies—and our trades—both sweet and sound!