Skip to content

Commit bca03f2

Browse files
committed
update README.md
1 parent 5110330 commit bca03f2

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
Parse Consolidated Account Statement (CAS) PDF files generated from CAMS/KFINTECH
1010

11+
`casparser` also includes a command line tool with the following analysis tools
12+
- `summary`- print portfolio summary
13+
- `gains`- Print capital gains report (summary and detailed)
14+
1115

1216
## Installation
1317
```bash
@@ -117,7 +121,7 @@ Notes:
117121
casparser also comes with a command-line interface that prints summary of parsed
118122
portfolio in a wide variety of formats.
119123

120-
```bash
124+
```
121125
Usage: casparser [-o output_file.json|output_file.csv] [-p password] [-s] [-a] CAS_PDF_FILE
122126
123127
-o, --output FILE Output file path. Saves the parsed data as json or csv
@@ -128,21 +132,45 @@ Usage: casparser [-o output_file.json|output_file.csv] [-p password] [-s] [-a] C
128132
-p PASSWORD CAS password
129133
-a, --include-all Include schemes with zero valuation in the
130134
summary output
131-
--sort Sort transactions by date
135+
-g, --gains Generate Capital Gains Report (BETA) [Debt fund indexation not
136+
considered]
132137
--force-pdfminer Force PDFMiner parser even if MuPDF is
133138
detected
134139
135140
--version Show the version and exit.
136141
-h, --help Show this message and exit.
137142
```
138143

144+
#### CLI examples
145+
```
146+
# Print portfolio summary
147+
casparser /path/to/cas.pdf -p password
148+
149+
# Print portfolio and capital gains summary
150+
casparser /path/to/cas.pdf -p password -g
151+
152+
# Save parsed data as a json file
153+
casparser /path/to/cas.pdf -p password -o pdf_parsed.json
154+
155+
# Save parsed data as a csv file
156+
casparser /path/to/cas.pdf -p password -o pdf_parsed.csv
157+
158+
# Save capital gains transactions in csv files (pdf_parsed-gains-summary.csv and
159+
# pdf_parsed-gains-detailed.csv)
160+
casparser /path/to/cas.pdf -p password -g -o pdf_parsed.csv
161+
162+
```
163+
139164
**Note:** `casparser cli` supports two special output file formats [-o _file.json_ / _file.csv_]
140165
1. `json` - complete parsed data is exported in json format (including investor info)
141166
2. `csv` - Summary info is exported in csv format if the input file is a summary statement or if
142167
a summary flag (`-s/--summary`) is passed as argument to the CLI. Otherwise, full
143168
transaction history is included in the export.
169+
If `-g` flag is present, two additional files '{basename}-gains-summary.csv',
170+
'{basename}-gains-detailed.csv' are created with the capital-gains data.
144171
3. any other extension - The summary table is saved in the file.
145172

173+
146174
#### Demo
147175

148176
![demo](https://raw.githubusercontent.com/codereverser/casparser/main/assets/demo.jpg)

casparser/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def print_gains(data, output_file_path=None):
162162
stcg_total = Decimal(0.0)
163163
ltcg_taxable_total = Decimal(0.0)
164164
for row in rows:
165-
_, fund, _, _, ltcg, stcg, ltcg_taxable = row
165+
_, fund, _, _, ltcg, ltcg_taxable, stcg = row
166166
ltcg_total += ltcg
167167
stcg_total += stcg
168168
ltcg_taxable_total += ltcg_taxable
@@ -223,7 +223,7 @@ def print_gains(data, output_file_path=None):
223223
is_flag=True,
224224
help="Include schemes with zero valuation in the summary output",
225225
)
226-
@click.option("-g", "--gains", is_flag=True, help="Generate Capital Gains Report")
226+
@click.option("-g", "--gains", is_flag=True, help="Generate Capital Gains Report (BETA)")
227227
@click.option(
228228
"--force-pdfminer", is_flag=True, help="Force PDFMiner parser even if MuPDF is detected"
229229
)

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.4.9-alpha.1"
3+
version = "0.5.0"
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)