Part 2: Ultimate Trading Bot - GPT-4o, Lost Code, and Questionable Life Choices
24th October 2024
Creating a trading bot that could revolutionise my crypto trading strategy? Sounded simple enough in theory. Turns out, it was a bit like wrestling with an octopus: you fix one tentacle and another smacks you in the face.
This second episode covers the technical shitty-gritty of building the bot, from classes to risk modes, as well as the killer setbacks - like GPT colossally fucking up. If you’re wondering if this drove me to drink... yeah of course it did!
The Technical Plan
In theory, the plan was great - set up some clever classes to handle trade execution, load in some AI models for predictive magic, and slot in a few risk management strategies. A tidy bit of AI generated code that could churn out trades like a well-oiled machine and save me hours of manual coding. Or so I thought. Enter GPT-4o, whose ‘performance improvements’ seemed more interested in making my life difficult than actually improving anything.
Main Classes
The Mysterious Diff-appearances
One of the most mind-boggling issues I faced during this project was GPT-4o’s tendency to suggest enhancements and then unceremoniously delete random files or chop out crucial sections of code. I had spent hours perfecting the real-time TradeMonitor when GPT-4o, in its infinite wisdom, suggested some optimisations. Before I knew it, the file was half its original size, and the logic that made it work had been neatly snipped away. To add to that the whole interface would become sluggish with each use; eventually becoming unusable through "Error Generating" errors or long drawn out freezing of the application in my browser.
Libraries That GPT-4o Kept Forgetting
AI Models That Survived (Somehow)
Miraculously, some of my AI models made it through GPT-4o’s optimisations. The CNNs did their job recognising patterns, and Reinforcement Learning kept the bot learning (though, given the errors, it might’ve been learning how to break down faster). Still, every time GPT-4o suggested a ‘performance tweak’, I held my breath, waiting to see which part of the AI setup would vanish into the void.
The Risk Modes: From Mild Panic to Full-Blown Chaos
The bot’s risk modes were designed to scale from Conservative to God Mode. What I didn’t anticipate was how GPT-4o would take these modes and, well, make them far riskier than intended.
Conservative Mode
The 'safe' option, where the bot makes low-risk trades with small leverage. At least, that’s what it should have been. After a few GPT-4o 'improvements', it felt like the bot had forgotten the meaning of ‘safe’ altogether.
Recommended by LinkedIn
if risk_mode == DEF_CON3:
leverage = 1.5 # Small, low-risk leverage.
trade_size = balance * 0.01
if AIModelManager.predict_signal(pair) == SIG_STRONG_BUY': TradeManager.execute_trade(pair, trade_size, leverage)
Aggressive Mode
For those who like to live a little dangerously. Bigger trades, higher leverage. After one too many GPT-4o 'performance enhancements', this mode became too aggressive, to the point where my bot was making trades so reckless, I thought it had developed a gambling problem.
if risk_mode == DEF_CON2:
leverage = 10
# High leverage, high risk, high blood pressure.
trade_size = balance * 0.05
if AIModelManager.predict_signal(pair) in [SIG_BUY, SIG_STRONG_BUY]:
TradeManager.execute_trade(pair, trade_size, leverage)
God Mode
The ultimate in chaos. Maximum leverage, massive trades, and a bot that’s more ‘Hail Mary’ than strategy. After GPT-4o’s random improvements, God Mode was less about calculated risk and more about throwing everything at the market and hoping for divine intervention.
if risk_mode == DEF_CON1:
leverage = 20 # Full throttle into financial madness.
trade_size = balance * 0.1
stop_loss, profit_target = RiskModeController.get_dynamic_limits(pair)
if AIModelManager.predict_signal(pair) == SIG_BUY:
TradeManager.execute_trade(pair, trade_size, leverage, stop_loss, profit_target)
GPT-4o’s Design Skills: Worse Than a Toddler with Crayons and Biscuits
If you think GPT-4o was bad at managing code, you should see what it does with design. Whenever I asked it to generate some HTML or CSS, it spat out layouts that looked like they were inspired by a child’s first drawing. And I’m talking about a toddler with a crayon in one hand and a biscuit in the other.
Ask GPT-4o for a sleek, modern UI, and you’ll get something that looks like it was cobbled together by a time traveler from the early days of the internet-clunky buttons, misaligned elements, and fonts that make your eyes bleed. Honestly, I’ve seen more cohesive design work from the back of cereal boxes.
It might sound harsh, but trust me-GPT-4o’s design and web development skills make 90s GeoCities websites look cutting edge. If you want a functional and aesthetically pleasing UI, you’re better off getting in someone experienced. At least the end result would be creative, rather than a shit sandwich. I'll pickup on the dashboard down the line.
Conclusion (pre-burnout)
Working with GPT-4o Canvas is like trying to build a house while someone keeps stealing your tools. Every 'performance improvement' felt like a gamble - would I get an actual improvement, or would half my files vanish, or would I get mental health advice about someone else's kid?
Who knows.
1. File Management Catastrophes
At random intervals, GPT-4o would decide that certain files were unnecessary. Sometimes it would delete a critical component like the Trade Monitor, other times it would remove sections of code that I thought were, you know, important.
2. Code Truncation and Missing Logic
GPT-4o’s habit of cutting off code halfway through or omitting crucial logic was almo
until next time....
x Biff
Customer's success is your success
6moLove this! God mode, innovative 😃😃