Python based command line tool to calculate XIRR from Zerodha funds statement
This takes input as the Zerodha funds statement as input to calculate XIRR. Along with that it takes the date and portfolio value for which the XIRR needs to be calculated
##Calculation It takes voucher comment Bank Receipts as negative cash flow and withdrawals as positive cashflow. So all charges are taken into account. Only dividends are not taken in the calculation. If you want you can add them manually in the ledger by keeping voucher column as 'Bank Payments' and adding the correct date and amount.
- Open console.zerodha.com
- Click on Funds in the header banner to reveal the dropdown manner
- Click on Statement from the dropdown menu
- Select the date range. For now XIRR can only be calculated since the beginning of the account.
- Download the csv format statements file
- Open https://console.zerodha.com/dashboard
- You will see Account Value displayed which includes Equity Holdings and funds balance
Python 3.x Modules: PyXIRR and datetime
Install Pyxirr: pip install pyxirr Install datetime: pip install DateTime
- Download the tool from the GitHub repo
- Copy Zerodha funds ledger to the same folder
- Open command prompt or Windows Powershell in the same folder. One way is to hold shift key, right click in the folder and select 'Open Powershell window here'
- Run the python script by entering 'python .\xirr_cal_pyxirr.py' in powershell
- Enter the date in 'dd-mm-yyyy' format, Account value and file name of the zerodha funds statement
You can find the SciPy based python file under the SciPy folder. It works but will no longer be updated. Simply because PyXIRR module is faster and simpler. Adding that in case people want to create their own versions or include in their workflows. SciPy might be more versatile in that case.
User @Anexen (Alexander Volkovsky) for the PyXIRR library (https://github.com/Anexen/pyxirr) StackOverflow question and answer https://stackoverflow.com/questions/46668172/calculating-xirr-in-python