@@ -311,48 +311,64 @@ func ComputeYTDTaxSummary(
311311 }, nil
312312}
313313
314- // WriteValueSummary writes the portfolio value summary with pregnant (unrealized) tax as formatted text.
314+ // WriteValueSummary writes the pregnant (unrealized) tax summary as formatted text.
315+ // Groups gains together, then taxes together, with the total bolded for emphasis.
315316func WriteValueSummary (writer io.Writer , summary * ValueSummary , config * ibctlconfig.Config , formatBaseMicros func (int64 ) string ) {
316- writeValueLine (writer , "Portfolio Value" , formatBaseMicros (summary .TotalValueMicros ))
317- fmt .Fprintln (writer )
317+ // Pregnant capital gains and their tax amounts.
318318 writeValueLine (writer , "Pregnant STCG" , formatBaseMicros (summary .TotalSTCGMicros ))
319- writeValueLine (writer , fmt .Sprintf ("Pregnant STCG Tax (%.1f%%)" , config .TaxRateSTCG * 100 ), formatBaseMicros (summary .STCGTaxMicros ))
320319 writeValueLine (writer , "Pregnant LTCG" , formatBaseMicros (summary .TotalLTCGMicros ))
320+ writeValueLine (writer , fmt .Sprintf ("Pregnant STCG Tax (%.1f%%)" , config .TaxRateSTCG * 100 ), formatBaseMicros (summary .STCGTaxMicros ))
321321 writeValueLine (writer , fmt .Sprintf ("Pregnant LTCG Tax (%.1f%%)" , config .TaxRateLTCG * 100 ), formatBaseMicros (summary .LTCGTaxMicros ))
322- writeValueLine (writer , "Total Pregnant Tax" , formatBaseMicros (summary .TotalTaxMicros ))
322+ fmt .Fprintln (writer )
323+ writeBoldValueLine (writer , "Total Pregnant Tax" , formatBaseMicros (summary .TotalTaxMicros ))
323324}
324325
325326// WriteYTDTaxSummary writes the YTD realized income tax summary as formatted text.
327+ // Groups income amounts together, then taxes together, with the remaining total bolded.
326328func WriteYTDTaxSummary (writer io.Writer , summary * YTDTaxSummary , config * ibctlconfig.Config , formatBaseMicros func (int64 ) string ) {
329+ // YTD realized income amounts and their tax amounts.
327330 writeValueLine (writer , "YTD Realized Dividends" , formatBaseMicros (summary .DividendMicros ))
328- writeValueLine (writer , fmt .Sprintf ("YTD Realized Dividend Tax (%.1f%%)" , config .TaxRateDividend * 100 ), formatBaseMicros (summary .DividendTaxMicros ))
329331 writeValueLine (writer , "YTD Realized Interest" , formatBaseMicros (summary .InterestMicros ))
330- writeValueLine (writer , fmt .Sprintf ("YTD Realized Interest Tax (%.1f%%)" , config .TaxRateInterest * 100 ), formatBaseMicros (summary .InterestTaxMicros ))
331332 writeValueLine (writer , "YTD Realized STCG" , formatBaseMicros (summary .STCGMicros ))
332- writeValueLine (writer , fmt .Sprintf ("YTD Realized STCG Tax (%.1f%%)" , config .TaxRateSTCG * 100 ), formatBaseMicros (summary .STCGTaxMicros ))
333333 writeValueLine (writer , "YTD Realized LTCG" , formatBaseMicros (summary .LTCGMicros ))
334+ writeValueLine (writer , fmt .Sprintf ("YTD Realized Dividend Tax (%.1f%%)" , config .TaxRateDividend * 100 ), formatBaseMicros (summary .DividendTaxMicros ))
335+ writeValueLine (writer , fmt .Sprintf ("YTD Realized Interest Tax (%.1f%%)" , config .TaxRateInterest * 100 ), formatBaseMicros (summary .InterestTaxMicros ))
336+ writeValueLine (writer , fmt .Sprintf ("YTD Realized STCG Tax (%.1f%%)" , config .TaxRateSTCG * 100 ), formatBaseMicros (summary .STCGTaxMicros ))
334337 writeValueLine (writer , fmt .Sprintf ("YTD Realized LTCG Tax (%.1f%%)" , config .TaxRateLTCG * 100 ), formatBaseMicros (summary .LTCGTaxMicros ))
335- writeValueLine (writer , "YTD Realized Tax Owed" , formatBaseMicros (summary .TotalTaxOwedMicros ))
336- writeValueLine (writer , "YTD Realized Tax Paid" , formatBaseMicros (summary .TaxPaidMicros ))
337- writeValueLine (writer , "YTD Realized Tax Remaining" , formatBaseMicros (summary .TaxRemainingMicros ))
338+ fmt .Fprintln (writer )
339+ // Tax owed minus paid, with remaining bolded.
340+ writeBoldValueLine (writer , "Total YTD Realized Tax Owed" , formatBaseMicros (summary .TotalTaxOwedMicros ))
341+ writeValueLine (writer , "Minus YTD Realized Tax Paid" , formatBaseMicros (- summary .TaxPaidMicros ))
342+ writeBoldValueLine (writer , "Total YTD Realized Tax Remaining" , formatBaseMicros (summary .TaxRemainingMicros ))
338343}
339344
340- // WriteAfterTaxValue writes the combined after-tax portfolio value.
341- // After-tax value = portfolio value - pregnant tax - YTD tax remaining.
345+ // WriteAfterTaxValue writes the combined after-tax portfolio value with a breakdown
346+ // showing pregnant tax and YTD realized tax remaining as deductions .
342347func WriteAfterTaxValue (writer io.Writer , valueSummary * ValueSummary , ytdSummary * YTDTaxSummary , formatBaseMicros func (int64 ) string ) {
343348 afterTaxMicros := valueSummary .TotalValueMicros - valueSummary .TotalTaxMicros - ytdSummary .TaxRemainingMicros
344- writeValueLine (writer , "After-Tax Value" , formatBaseMicros (afterTaxMicros ))
349+ // Portfolio value, deductions, and after-tax total.
350+ writeBoldValueLine (writer , "Total Portfolio Value" , formatBaseMicros (valueSummary .TotalValueMicros ))
351+ writeValueLine (writer , "Minus Pregnant Tax" , formatBaseMicros (- valueSummary .TotalTaxMicros ))
352+ writeValueLine (writer , "Minus YTD Realized Tax Remaining" , formatBaseMicros (- ytdSummary .TaxRemainingMicros ))
353+ writeBoldValueLine (writer , "Total After-Tax Value" , formatBaseMicros (afterTaxMicros ))
345354}
346355
347356// valueLabelWidth is the fixed column width for value summary labels, sized to accommodate
348- // the longest label ("YTD Realized Dividend Tax (XX.X%) ").
349- const valueLabelWidth = 36
357+ // the longest indented label (" Minus YTD Realized Tax Remaining: ").
358+ const valueLabelWidth = 40
350359
351360// writeValueLine writes a single label-value line with consistent column alignment.
352361func writeValueLine (writer io.Writer , label string , value string ) {
353362 fmt .Fprintf (writer , "%-*s %s\n " , valueLabelWidth , label + ":" , value )
354363}
355364
365+ // writeBoldValueLine writes a label-value line with the label wrapped in ** markers for emphasis.
366+ // Builds the bold label first, then pads the result to keep values column-aligned.
367+ func writeBoldValueLine (writer io.Writer , label string , value string ) {
368+ boldLabel := "**" + label + ":**"
369+ fmt .Fprintf (writer , "%-*s %s\n " , valueLabelWidth , boldLabel , value )
370+ }
371+
356372// WriteHoldingListTable writes the holding list as a table with securities,
357373// cash positions, and a totals row.
358374func WriteHoldingListTable (writer io.Writer , holdings []* ibctlholdings.HoldingOverview , baseCurrency string , formatBase func (string ) string , formatBaseMicros func (int64 ) string ) error {
0 commit comments