codereverser / casparser

Parser for Consolidated Account Statements (CAS) generated from CAMS/Karvy/Kfintech
MIT License
138 stars 63 forks source link

Issue in Franklin Templeton Segregated Units #46

Closed ram65875 closed 3 years ago

ram65875 commented 3 years ago

Hello team,

Franklin Templeton created few Segregated Portfolio's for some stressed Mutual Funds. The data is read incorrectly in some cases. In the example given below - there are 2 Segregation records - one for qty 215931.176, and second for qty 0.008, but the parser scans the 2nd one as qty 215931.184 ...

{"scheme": "Franklin India Credit Risk Fund- Segregated Portfolio 1 (8.25% Vodafone Idea Ltd-10JUL20-Growth Plan)", "advisor": "ICICIRON", "rta_code": "FTI880", "type": "DEBT", "rta": "CAMS", "isin": "INF090I01TJ6", "amfi": "147954", "open": "0.000", "close": "0.000", "close_calculated": "215931.176", "valuation": {"date": "2020-07-17", "value": "0.00", "nav": "0.0818"}, "transactions": [ {"date": "2020-01-24", "description": "Creation of units - Segregated Portfolio\t\t215,931.176", "amount": "0", "units": "215931.176", "nav": "0", "balance": "215931.176", "type": "SEGREGATION", "dividend_rate": null}, {"date": "2020-01-24", "description": "Creation of units - Segregated Portfolio\t\t0.008", "amount": "0", "units": "215931.184", "nav": "0", "balance": "215931.184", "type": "SEGREGATION", "dividend_rate": null}, {"date": "2020-06-15", "description": "Payment - Units Extinguished", "amount": "-1338.33", "units": "-16360.996", "nav": "0.0818", "balance": "199570.188", "type": "REDEMPTION", "dividend_rate": null}, {"date": "2020-07-10", "description": "Payment - Units Extinguished", "amount": "-16324.84", "units": "-199570.188", "nav": "0.0818", "balance": "0.000", "type": "REDEMPTION", "dividend_rate": null}]}

codereverser commented 3 years ago

It looks like the addition of SEGREGATION transaction types doesn't consider multiple incoming transactions in a segregated folio.

ref: https://github.com/codereverser/casparser/commit/132386ea36438cb87691871fee842d8a83d77183

shall fix this soon. Can you please post a partial screenshot of the transactions for testing the fix?

ram65875 commented 3 years ago

I suspect the field 'Description' seems to mess up the Qty ... "description": "Creation of units - Segregated Portfolio\t\t0.008"

Have attached the screenshot of actual CAMS statement

Screenshot 2021-07-22 at 10 54 12 AM
codereverser commented 3 years ago

Yes. that's one issue. but there is also this line, that sets wrong units for a segregated transaction

                 units = amt
                 balance = amt
                 amt = 0
                 nav = 0
codereverser commented 3 years ago

Can you please try testing with the pre-release version 0.5.2b1?

pip install casparser==0.5.2b1
ram65875 commented 3 years ago

Thanks!! Tested the version and works fine for me!!

On Sat, 7 Aug 2021 at 00:51, Sandeep Somasekharan @.***> wrote:

Closed #46 https://github.com/codereverser/casparser/issues/46 via #47 https://github.com/codereverser/casparser/pull/47.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/codereverser/casparser/issues/46#event-5124454088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU4R7ALRPWM7GKJYXJVXJYLT3QY4ZANCNFSM5AZIU7MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

codereverser commented 3 years ago

Many thanks for testing.

btw I had a query if you can answer.. How do you calculate capital gains on such a folio? There is no purchase price associated with the segregation transactions. Does it need to be matched with the purchase from the original/parent fund?

ram65875 commented 3 years ago

I believe the entire thing will have to taken as Capital Gains. And it should be indexed against the original purchase date. But, I am no tax expert:)

Regards Ram

On Wed, 11 Aug 2021 at 12:22 PM, Sandeep Somasekharan < @.***> wrote:

Many thanks for testing.

btw I had a query if you can answer.. How do you calculate capital gains on such a folio? There is no purchase price associated with the payout transactions. Does it need to be matched with the purchase from the original/parent fund?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/codereverser/casparser/issues/46#issuecomment-896549615, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU4R7AKT35EX7FPEMT7IWOTT4IM4BANCNFSM5AZIU7MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

ram65875 commented 3 years ago

I just got the Capital Gains statement from Franklin Templeton. They have considered the Unit Cost for this segregated units as Zero. And the Entire Sale amount is treated as LTCG with Indexation ...

codereverser commented 3 years ago

Many thanks..

So does that mean the total gains would be 17,663.17 (16324.84 + 1338.33) [ for the folio screenshot above ]? Also for indexation benefit, have they used Jan-2020 as the purchase date?

ram65875 commented 3 years ago

Yes, the total gains is 17,663.17. The statement indicates 2013 as the original purchase date. They have not used Jan 2020 date as the entire proceed is marked as Long Term and not Short Term, But since the purchase value is Zero, no indexation benefit accrue ...

On Thu, 26 Aug 2021 at 12:28, Sandeep Somasekharan @.***> wrote:

Many thanks..

So does that mean the total gains would be 17,663.17 (16324.84 + 1338.33) [ for the folio screenshot above ]? Also for indexation benefit, have they used Jan-2020 as the purchase date?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/codereverser/casparser/issues/46#issuecomment-906146104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AU4R7AI5X7ARQNUHFAVWEB3T6XQYHANCNFSM5AZIU7MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .