Skip to content

Commit 371fa67

Browse files
committed
remove taxable stcg fields
1 parent 39de63e commit 371fa67

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

casparser/analysis/gains.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,6 @@ def ltcg_taxable(self) -> Decimal:
107107
return Decimal(round(self.sell_price - self.coa, 2))
108108
return Decimal(0.0)
109109

110-
@property
111-
def stcg_taxable(self) -> Decimal:
112-
if self.gain_type == GainType.STCG:
113-
return Decimal(round(self.sell_price - self.coa, 2))
114-
return Decimal(0.0)
115-
116110
@property
117111
def ltcg(self) -> Decimal:
118112
if self.gain_type == GainType.LTCG:
@@ -283,20 +277,17 @@ def get_summary(self):
283277
"""Calculate capital gains summary"""
284278
summary = []
285279
for (fy, fund), txns in itertools.groupby(self.gains, key=lambda x: (x.fy, x.fund)):
286-
ltcg = stcg = ltcg_taxable = stcg_taxable = Decimal(0.0)
280+
ltcg = stcg = ltcg_taxable = Decimal(0.0)
287281
for txn in txns:
288282
ltcg += txn.ltcg
289283
stcg += txn.stcg
290284
ltcg_taxable += txn.ltcg_taxable
291-
stcg_taxable += txn.stcg_taxable
292-
summary.append(
293-
[fy, fund.name, fund.isin, fund.type, ltcg, ltcg_taxable, stcg, stcg_taxable]
294-
)
285+
summary.append([fy, fund.name, fund.isin, fund.type, ltcg, ltcg_taxable, stcg])
295286
return summary
296287

297288
def get_summary_csv_data(self) -> str:
298289
"""Return summary data as a csv string."""
299-
headers = ["FY", "Fund", "ISIN", "Type", "LTCG", "LTCG(Taxable)", "STCG", "STCG(Taxable)"]
290+
headers = ["FY", "Fund", "ISIN", "Type", "LTCG", "LTCG(Taxable)", "STCG"]
300291
with io.StringIO() as csv_fp:
301292
writer = csv.writer(csv_fp)
302293
writer.writerow(headers)
@@ -324,7 +315,6 @@ def get_gains_csv_data(self) -> str:
324315
"LTCG",
325316
"LTCG Taxable",
326317
"STCG",
327-
"STCG Taxable",
328318
]
329319
with io.StringIO() as csv_fp:
330320
writer = csv.writer(csv_fp)
@@ -347,7 +337,6 @@ def get_gains_csv_data(self) -> str:
347337
gain.ltcg,
348338
gain.ltcg_taxable,
349339
gain.stcg,
350-
gain.stcg_taxable,
351340
]
352341
)
353342
csv_fp.seek(0)

casparser/cli.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,35 +155,30 @@ def print_gains(data, output_file_path=None):
155155
table.add_column("LTCG")
156156
table.add_column("LTCG (Taxable)")
157157
table.add_column("STCG")
158-
table.add_column("STCG (Taxable)")
159158

160159
for fy, rows in itertools.groupby(summary, lambda x: x[0]):
161160
table.add_row(f"[bold]{fy}[/]", "", "", "")
162161
ltcg_total = Decimal(0.0)
163162
stcg_total = Decimal(0.0)
164163
ltcg_taxable_total = Decimal(0.0)
165-
stcg_taxable_total = Decimal(0.0)
166164
for row in rows:
167-
_, fund, _, _, ltcg, ltcg_taxable, stcg, stcg_taxable = row
165+
_, fund, _, _, ltcg, ltcg_taxable, stcg = row
168166
ltcg_total += ltcg
169167
stcg_total += stcg
170168
ltcg_taxable_total += ltcg_taxable
171-
stcg_taxable_total += stcg_taxable
172169
table.add_row(
173170
"",
174171
fund,
175172
f"₹{round(ltcg, 2)}",
176173
f"₹{round(ltcg_taxable, 2)}",
177174
f"₹{round(stcg, 2)}",
178-
f"₹{round(stcg_taxable, 2)}",
179175
)
180176
table.add_row(
181177
"",
182178
f"[bold]{fy} - Total Gains[/]",
183179
f"[bold {get_color(ltcg_total)}]₹{round(ltcg_total, 2)}[/]",
184180
f"[bold {get_color(ltcg_taxable_total)}]₹{round(ltcg_taxable_total, 2)}[/]",
185181
f"[bold {get_color(stcg_total)}]₹{round(stcg_total, 2)}[/]",
186-
f"[bold {get_color(stcg_taxable_total)}]₹{round(stcg_taxable_total, 2)}[/]",
187182
)
188183
console.print(table)
189184
if isinstance(output_file_path, str):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "casparser"
3-
version = "0.5.0"
3+
version = "0.5.0-alpha.2"
44
description = "(Karvy/Kfintech/CAMS) Consolidated Account Statement (CAS) PDF parser"
55
authors = ["Sandeep Somasekharan <[email protected]>"]
66
homepage = "https://github.com/codereverser/casparser"

0 commit comments

Comments
 (0)