Skip to main content

Crypto Trading Agent - Progress - 29 Nov 2025

Published: November 29, 20254 min read
#Crypto#Agent#LLM Trading#AI Trading

Wrestling with Fees: Making Trader-7 Transparent and Trustworthy

TL;DR:
Sprint 12 was all about nailing fee transparency in Trader-7. We added detailed fee tracking, upgraded the dashboard with fee analytics, and built safeguards so fees don’t silently kill profits. Plus, we tackled some gnarly bugs around manual position closing that taught me a lot about concurrency and database quirks.


This sprint was a deep dive into fees—the invisible drain that can quietly wreck trading performance if you don’t track it closely. I wanted Trader-7 to not just handle fees, but to wear them on its sleeve, so users truly understand how every trade’s profitability is shaped by these costs.

The Wins: Fee Transparency Everywhere

First up, all paper trades now estimate entry and exit fees along with 48-hour funding rate projections for perpetual contracts. That means as you simulate trades, you get a realistic picture of the costs baked into them, not just raw profits.

On the dashboard’s Performance page, I added a whole new fee analytics section. It breaks down trading fees, net funding, fees as a percent of volume, and something I like to call the Fee Impact metric. To make it digestible at a glance, I slapped on some color-coded efficiency indicators—green for good, orange for meh, red for ouch.

But tracking fees is only half the battle. I also beefed up the trade validation logic. Now, before a trade even goes through in paper mode, the RulesPreValidator rejects it if fees are eating more than 20% of expected profit or flip a winner into a loser. It’s like having a watchdog sniff out bad trades before they happen.

On the manual close front, I added the ability to close paper positions by hand on the Manager page. This wasn’t trivial—making sure the P&L calculations are accurate, retrying if the database locks, and updating capital properly took some careful handling.

I also cleaned up how balances display. Deposited capital is now clearly separated from trading P&L, so users don’t get confused about what’s their money vs. what’s earned or lost. Plus, the Overview page now shows a "Type" column so you can instantly see if a position is Spot or Perpetual. And for good measure, I expanded the perpetual instrument selector with SOL and XRP—because who doesn’t want more options?

The Headaches: Bugs and Lessons Learned

Not everything was smooth sailing. The manual close feature initially had a bug where it was adding the entire position value plus P&L back into the capital balance, effectively doubling the position’s worth. After some head-scratching, I realized it should add only the realized P&L. A quick fix and a unit test to catch this next time saved me from a capital reporting disaster. That little detour cost about 30 minutes, but it was worth it.

Then came the dreaded SQLite database locks during manual close. Turns out, trying to update positions and capital concurrently was stepping on itself’s toes. I added a retry mechanism with exponential backoff—three tries max—to gracefully handle these conflicts. It’s a band-aid for now, but it buys me time while I consider moving to async DB operations in the future.

Finally, a NOT NULL constraint on the total_deposits column caught me off guard during inserts. The schema change didn’t include a default value, so inserts failed. Lesson learned: always test schema changes on a fresh DB before shipping. Fixed that with a default value and moved on.

What’s Next?

With fees now transparent and guarded against silent profit erosion, I’m eager to see how the estimates stack up against real Coinbase fees once live trading kicks off. I’m also toying with adding a fee trends chart over time to spot patterns and anomalies.

Tomorrow, I’ll be validating fee calculations with actual live trades—fingers crossed the numbers hold up. This sprint reinforced how important it is to make invisible costs visible and to build safeguards that keep trading honest. Onward!


Crafted on November 29, 2025, from the trenches of Trader-7 development.

Share this post