Skip to content

Commit

Permalink
v2023.8.18 - hdfc fund lookup fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
codereverser committed Aug 18, 2023
1 parent 9f6c740 commit 0aefe11
Show file tree
Hide file tree
Showing 7 changed files with 574 additions and 127 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2023.8.18
- fix issues with hdfc mutual fund lookups
- update database

## 2023.1.16
- DB updates

Expand Down
2 changes: 1 addition & 1 deletion casparser_isin/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.9.1
2023.8.18
Binary file modified casparser_isin/isin.db
Binary file not shown.
9 changes: 7 additions & 2 deletions casparser_isin/mf_isin.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,23 @@ def scheme_lookup(self, rta: str, scheme_name: str, rta_code: str):

if (
"hdfc" in scheme_name.lower()
and re.search(r"^h\d+$", rta_code, re.I)
and re.search("dividend|idcw", scheme_name, re.I)
):
# Special case for old HDFC funds with scheme codes of format "H\d+"
if re.search("re-*invest", scheme_name, re.I):
where.append("name LIKE '%reinvest%'")
else:
where.append("name LIKE '%payout%'")
if re.search("direct", scheme_name, re.I):
where.append("name LIKE '%direct%'")
else:
where.append("name NOT LIKE '%direct%'")
where.append("rta_code like :rta_code_d")
args.update(rta_code_d=f"{rta_code}%")
else:
where.append("rta_code = :rta_code")

sql_statement = "{} WHERE {}".format(sql, " AND ".join(where))
sql_statement = "{} WHERE {} GROUP BY isin".format(sql, " AND ".join(where))
results = self.run_query(sql_statement, args)
if len(results) == 0 and "rta_code" in args:
args["rta_code"] = args["rta_code"][:-1]
Expand Down
666 changes: 552 additions & 114 deletions poetry.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "casparser_isin"
version = "2023.1.16"
version = "2023.8.18"
description = "ISIN database for casparser"
authors = ["Sandeep Somasekharan <codereverser@gmail.com>"]
homepage = "https://github.com/codereverser/casparser-isin"
Expand All @@ -18,18 +18,18 @@ include = [ "CHANGELOG.md" ]
[tool.poetry.dependencies]
python = "^3.8"
packaging = ">=20.9"
rapidfuzz = "^2.0.0"
rapidfuzz = "^3.2.0"

[tool.poetry.dev-dependencies]
coverage = {version = "^6.0", extras=["toml"]}
pytest = "^7.1.0"
pytest-cov = "^3.0.0"
apsw-wheels = "^3.36.0"
b2sdk = "^1.17.0"
coverage = {version = "^7.3.0", extras=["toml"]}
pytest = "^7.4.0"
pytest-cov = "^4.1.0"
apsw = "^3.42.0"
b2sdk = "^1.23.0"
lxml = "^4.9.0"
python-dotenv = "^0.20.0"
requests = "^2.28.0"
requests-cache = "^0.9.4"
requests = "^2.31.0"
requests-cache = "^1.1.0"

[tool.poetry.scripts]
casparser-isin = "casparser_isin.cli:main"
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures.csv
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Franklin India Smaller Companies Fund - Direct Plan - GROWTH,CAMS,FTI478,frankli
Franklin India Ultra Short Bond Fund- Super Inst. Plan-Segregated Portfolio 1 (erstwhile 8.25% Vodafone Idea Ltd-10jul20-Daily Dividend Option) - Daily - IDCW# Payout,FRANKLIN,FTI915,Franklin India Ultra Short Bond Fund- Super Inst Plan-Segregated Portfolio 1 (8.25% Vodafone Idea Ltd-10jul20-Daily Dividend Option) - Daily - IDCW,INF090I01VH6,147971
Franklin India Ultra Short Bond Fund- Super Inst. Plan-Segregated Portfolio 1 (erstwhile 8.25% Vodafone Idea Ltd-10jul20-Daily Dividend Option) - Daily - IDCW# Payout,CAMS,FTI915,Franklin India Ultra Short Bond Fund- Super Inst Plan-Segregated Portfolio 1 (8.25% Vodafone Idea Ltd-10jul20-Daily Dividend Option) - Daily - IDCW,INF090I01VH6,147971
HDFC Balanced Fund - Regular Plan - Growth,CAMS,HBFG,hdfc balanced fund - growth option,INF179K01392,100122
HDFC Cash Management Fund - Savings Plan - Weekly IDCW# - Reinvest,CAMS,H51,hdfc money market fund-weekly idcw reinvestment,INF179KB1IB7,119094
HDFC Cash Management Fund - Savings Plan - Weekly IDCW# - Reinvest,CAMS,H51,hdfc money market fund-weekly idcw reinvestment,INF179KB1II2,101995
HDFC Corporate Bond Fund - Direct Plan - Growth Option,CAMS,HMTOGT,hdfc corporate bond fund - direct plan - growth option,INF179K01XD8,118987
HDFC Flexi Cap Fund - Regular Plan - Growth,CAMS,H02,hdfc flexicap fund - growth option,INF179K01608,101762
HDFC Hybrid Equity Fund - Regular Plan - Growth,CAMS,HPREG,hdfc hybrid equity fund - regular plan - growth,INF179K01AS4,102948
Expand Down

0 comments on commit 0aefe11

Please sign in to comment.