Skip to content

Enhance Commission Handling#14

Open
antamy wants to merge 10 commits into
MarkT1065:mainfrom
antamy:feature/enhance-commission-handling
Open

Enhance Commission Handling#14
antamy wants to merge 10 commits into
MarkT1065:mainfrom
antamy:feature/enhance-commission-handling

Conversation

@antamy
Copy link
Copy Markdown
Contributor

@antamy antamy commented Oct 30, 2025

Fixes #10

Summary

This PR implements comprehensive commission tracking for options trades, addressing the requirements discussed in issue #10 with @MarkT1065.

Changes Made

Core Commission Handling

  • Database Schema: Added commission field to options table (stores total commission, not per-contract)
  • Migration System: Automatic one-time migration converts existing per-contract data to totals with pre-migration backup
  • Settings: Added OPTION_COMMISSION_PER_CONTRACT setting (default: 0.65) configurable via Settings page
  • Commission Storage:
    • Open/expired positions: per_contract_rate × contracts
    • Closed positions (buy-to-close): per_contract_rate × contracts × 2

UI Enhancements

  • Symbol Page Header: Added "Commissions" column displaying total commissions in red
  • Options Table: Added $ signs to Strike, Premium, and Total Commission columns for consistency
  • Monthly Results: Added "Commission Total" column showing commissions by month in red
  • Settings Page: Commission rate configuration with validation

Bug Fixes

  • Fixed CalculatePercentOfProfit() to use total commission instead of per-contract
  • Fixed eztime() unused parameter in test helper
  • Refactored if-else chains to tagged switch statements for better Go idioms

Testing

  • Updated all test files to use CreateWithCommission() method
  • Fixed NewOptionService calls to include SettingService parameter
  • All commission-related tests pass
  • Migration tested with automatic backup creation

Documentation

  • Updated model.md with commission field documentation
  • Added .gitignore rules for database files and backups

Migration Details

The migration:

  • ✅ Runs automatically on first startup after update
  • ✅ Creates timestamped backup in data/backups/ before migrating
  • ✅ Converts commission from per-contract to total for all existing records
  • ✅ Idempotent (won't re-run if already completed)
  • ✅ Handles both open and closed positions correctly

Testing

  • ✅ Manual testing completed with live database
  • ✅ Migration tested and verified
  • ✅ All page rendering tests pass
  • ✅ Commission calculations verified
  • ✅ UI displays correctly

…toggle. Addresses issue MarkT1065#5. (MarkT1065#7)

* Enhanced Monthly chart to display cumulative and monthly data via UI toggle

* Enhanced Monthly chart to display cumulative and monthly data via UI toggle (code and screenshots)

* Added screenshots

* Update README.md, remove previous screenshots and add new screenshot

* Remove test database from tracking and add to .gitignore
- Add commission field to options table (stored as total)
- Implement automatic migration from per-contract to total storage
- Add OPTION_COMMISSION_PER_CONTRACT setting (default: 0.65)
- Update UI to display commission totals in red
- Add $ signs to Strike, Premium, and Total Commission columns
- Add Commission Total to Monthly Results section
- Fix CalculatePercentOfProfit() bug
- Update all tests for commission changes
- Add database backup before migration
- Update model.md documentation

Addresses issue MarkT1065#10
- Add commission field to options table (stored as total)
- Implement automatic migration from per-contract to total storage
- Add OPTION_COMMISSION_PER_CONTRACT setting (default: 0.65)
- Update UI to display commission totals in red
- Add $ signs to Strike, Premium, and Total Commission columns
- Add Commission Total to Monthly Results section
- Fix CalculatePercentOfProfit() bug
- Update all tests for commission changes
- Add database backup before migration
- Update model.md documentation

Addresses issue MarkT1065#10
- Added Commissions column to symbol page header (displayed in red)
- Added $ signs to Strike, Premium, and Total Commission columns in Options table
- Added Commission Total to Monthly Results section
- Fixed Go idiom warnings (QF1003) by using tagged switch statements
- Fixed unused parameter bug in index_test.go eztime() function
- Updated model.md documentation for commission field
- Improved .gitignore for database file handling
Comment thread docs/Enhance Commission Handling.md Outdated
@@ -0,0 +1,1403 @@
# WHEELER - ENHANCE COMMISSION HANDLING
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc/plan to implement the feature looks good (and verbose!). Think we still need this markdown?

Copy link
Copy Markdown
Contributor Author

@antamy antamy Oct 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove it. There also were some conflicts which surprised me, but Claude assures me they have been addressed!

The docs/ directory contains local development documentation that should not be tracked in the repository.
currentdb and test_db.db should remain in the repository as starting points for new users. Local modifications to these files should not be committed.
Resolved conflicts in:
- .gitignore: Combined both versions, added .claude from upstream
- schema.sql: Kept commission comment, added current_price field from upstream
- symbol.html: Used upstream date format (01/02/2006), kept $ signs for Strike/Premium/Commission
Copy link
Copy Markdown
Contributor Author

@antamy antamy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Mark, is there anything you need in order to accept and merge this PR?

@MarkT1065
Copy link
Copy Markdown
Owner

everything looks good at first glance but I'd like to pull the branch and test first.

@MarkT1065 MarkT1065 mentioned this pull request Nov 13, 2025
@MarkT1065
Copy link
Copy Markdown
Owner

@antamy sorry to have let this languish. I'm reviewing it again, I've made other improvements to wheeler, and I'd appreciate your feedback on working through a v2 API. some of the improvements I've made include a schema migration system so we can safely refactor/migrate to a new API over time while keeping existing stuff working.

Please rebase?

@antamy
Copy link
Copy Markdown
Contributor Author

antamy commented Jan 11, 2026

No problem, the past few weeks have been hectic for me. I am hoping next week to have time to get back into this and get v2 up and running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

% of profit calculation includes commission only on one part of the calculation

2 participants