Download index_data.py from sarim/pix: direct link, hf CLI and curl.
- Browser
- Download file 15.5 kB
-
https://huggingface.co/spaces/sarim/pix/resolve/main/index_data.py
- Command line
-
hf download hf://spaces/sarim/pix/index_data.py
-
curl -L -o index_data.py https://huggingface.co/spaces/sarim/pix/resolve/main/index_data.py
15.5 kB
| from enum import Enum | |
| class Company: | |
| def __init__(self, name, sector,symbol): | |
| self.name = name | |
| self.sector = sector | |
| self.symbol = symbol | |
| def __repr__(self): | |
| return ( | |
| f"Company(name='{self.name}', " | |
| f"sector='{self.sector}', " | |
| f"symbol='{self.symbol}')" | |
| ) | |
| def to_dict(self): | |
| return { | |
| "name": self.name, | |
| "sector": self.sector, | |
| "symbol": self.symbol, | |
| } | |
| class IndexEnum(str, Enum): | |
| kse_100 = "kse_100" | |
| kse_30 = "kse_30" | |
| psx_div_20 = "psx_div_20" | |
| mii_30 = "mii_30" | |
| kmi_30 = "kmi_30" | |
| ## KSE 100 | |
| kse_100 = [ | |
| Company("HBL Growth Fund", "Close-End Mutual Funds", "HGFA"), | |
| Company("First Habib Modaraba", "Modaraba", "FHAM"), | |
| Company("Pak-Gulf Leasing Company", "Leasing Companies", "PGLC"), | |
| Company("Engro Holdings Ltd.", "Investment / Holding Companies", "ENGROH"), | |
| Company("DH Partners Ltd.", "Investment / Holding Companies", "DHPL"), | |
| Company("Pakistan Stock Exchange Ltd.", "Investment / Holding Companies", "PSX"), | |
| Company("United Bank Ltd.", "Commercial Banks", "UBL"), | |
| Company("Bank AL Habib Ltd.", "Commercial Banks", "BAHL"), | |
| Company("Bank Alfalah Ltd.", "Commercial Banks", "BAFL"), | |
| Company("The Bank of Punjab", "Commercial Banks", "BOP"), | |
| Company("Faysal Bank Ltd.", "Commercial Banks", "FABL"), | |
| Company("Meezan Bank Ltd.", "Commercial Banks", "MEBL"), | |
| Company("Habib Bank Ltd.", "Commercial Banks", "HBL"), | |
| Company("Habib Metropolitan Bank Ltd.", "Commercial Banks", "HMB"), | |
| Company("MCB Bank Ltd.", "Commercial Banks", "MCB"), | |
| Company("National Bank of Pakistan", "Commercial Banks", "NBP"), | |
| Company("Standard Chartered Bank (Pak) Ltd.", "Commercial Banks", "SCBPL"), | |
| Company("Askari Bank Ltd.", "Commercial Banks", "AKBL"), | |
| Company("Allied Bank Ltd.", "Commercial Banks", "ABL"), | |
| Company("Adamjee Insurance Co. Ltd.", "Insurance", "AICL"), | |
| Company("TPL REIT Fund I", "REIT", "TPLRF1"), | |
| Company("Dolmen City REIT", "REIT", "DCR"), | |
| Company("Gadoon Textile Mills Ltd.", "Textile Spinning", "GADT"), | |
| Company("Yousaf Weaving Mills Ltd.", "Textile Weaving", "YOUW"), | |
| Company("Nishat Mills Ltd.", "Textile Composite", "NML"), | |
| Company("Mehmood Textile Mills Ltd.", "Textile Composite", "MTL"), | |
| Company("Kohinoor Textile Mills Ltd.", "Textile Composite", "KTML"), | |
| Company("Interloop Ltd.", "Textile Composite", "ILP"), | |
| Company("Bannu Woollen Mills Ltd.", "Woollen", "BWHL"), | |
| Company("Ibrahim Fibres Ltd.", "Synthetics & Rayon", "IBFL"), | |
| Company("JDW Sugar Mills Ltd.", "Sugar & Allied", "JDWS"), | |
| Company("Lucky Cement Ltd.", "Cement", "LUCK"), | |
| Company("D. G. Khan Cement Co. Ltd.", "Cement", "DGKC"), | |
| Company("Bestway Cement Ltd.", "Cement", "BWCL"), | |
| Company("Fauji Cement Company Ltd.", "Cement", "FCCL"), | |
| Company("Kohat Cement Company Ltd.", "Cement", "KOHC"), | |
| Company("Cherat Cement Company Ltd.", "Cement", "CHCC"), | |
| Company("Maple Leaf Cement Factory Ltd.", "Cement", "MLCF"), | |
| Company("Pioneer Cement Ltd.", "Cement", "PIOC"), | |
| Company("Pakistan Tobacco Company Ltd.", "Tobacco", "PTC"), | |
| Company("Attock Refinery Ltd.", "Refinery", "ATRL"), | |
| Company("Cnergyico PK Ltd.", "Refinery", "CNERGY"), | |
| Company("The Hub Power Company Ltd.", "Power Generation & Distribution", "HUBC"), | |
| Company("Kot Addu Power Company Ltd.", "Power Generation & Distribution", "KAPCO"), | |
| Company("K-Electric Ltd.", "Power Generation & Distribution", "KEL"), | |
| Company("Pakgen Power Ltd.", "Power Generation & Distribution", "PKGP"), | |
| Company("Pakistan State Oil Company Ltd.", "Oil & Gas Marketing", "PSO"), | |
| Company("Attock Petroleum Ltd.", "Oil & Gas Marketing", "APL"), | |
| Company("Sui Northern Gas Pipelines Ltd.", "Oil & Gas Marketing", "SNGP"), | |
| Company("Sui Southern Gas Company Ltd.", "Oil & Gas Marketing", "SSGC"), | |
| Company("Oil & Gas Development Co. Ltd.", "Oil & Gas Exploration", "OGDC"), | |
| Company("Mari Petroleum Company Ltd.", "Oil & Gas Exploration", "MARI"), | |
| Company("Pakistan Oilfields Ltd.", "Oil & Gas Exploration", "POL"), | |
| Company("Pakistan Petroleum Ltd.", "Oil & Gas Exploration", "PPL"), | |
| Company("International Steels Ltd.", "Engineering", "ISL"), | |
| Company("International Industries Ltd.", "Engineering", "INIL"), | |
| Company("Millat Tractors Ltd.", "Automobile Assembler", "MTL"), | |
| Company("Indus Motor Company Ltd.", "Automobile Assembler", "INDU"), | |
| Company("Sazgar Engineering Works Ltd.", "Automobile Assembler", "SAZEW"), | |
| Company("Atlas Honda Ltd.", "Automobile Assembler", "ATLH"), | |
| Company("Honda Atlas Cars (Pakistan) Ltd.", "Automobile Assembler", "HCAR"), | |
| Company("Ghandhara Automobiles Ltd.", "Automobile Assembler", "GHAND"), | |
| Company("Ghandhara Industries Ltd.", "Automobile Assembler", "GHNI"), | |
| Company("Thal Ltd.", "Automobile Parts & Accessories", "THALL"), | |
| Company("Pak Elektron Ltd.", "Cables & Electrical Goods", "PAEL"), | |
| Company("Pakistan International Bulk Term. Ltd.", "Transport", "PIBTL"), | |
| Company("Systems Ltd.", "Technology & Communication", "SYS"), | |
| Company("Air Link Communication Ltd.", "Technology & Communication", "AIRLINK"), | |
| Company("Pakistan Telecommunication Company Ltd.", "Technology & Communication", "PTC"), | |
| Company("TRG Pakistan Ltd.", "Technology & Communication", "TRG"), | |
| Company("Hum Network Ltd.", "Technology & Communication", "HUMNL"), | |
| Company("Fauji Fertilizer Company Ltd.", "Fertilizer", "FFC"), | |
| Company("Engro Fertilizers Ltd.", "Fertilizer", "EFERT"), | |
| Company("Fatima Fertilizer Company Ltd.", "Fertilizer", "FATIMA"), | |
| Company("GlaxoSmithKline Pakistan Ltd.", "Pharmaceutical", "GLAXO"), | |
| Company("AGP Ltd.", "Pharmaceutical", "AGP"), | |
| Company("The Searle Company Ltd.", "Pharmaceutical", "SEARL"), | |
| Company("Abbott Laboratories (Pak.) Ltd.", "Pharmaceutical", "ABOT"), | |
| Company("Citi Pharma Ltd.", "Pharmaceutical", "CIPHL"), | |
| Company("Haleon Pakistan", "Pharmaceutical", "HALEON"), | |
| Company("Highnoon Laboratories", "Pharmaceutical", "HINOON"), | |
| Company("Lucky Core Industries Ltd.", "Chemical", "LCI"), | |
| Company("Lotte Chemical Pakistan Ltd.", "Chemical", "LOTCHEM"), | |
| Company("Packages Ltd.", "Paper, Board & Packaging", "PKGS"), | |
| Company("S.S. Oil Mills Ltd.", "Vanaspati & Allied", "SSOM"), | |
| Company("Service Industries Ltd.", "Leather & Tanneries", "SRVI"), | |
| Company("Colgate-Palmolive (Pakistan) Ltd.", "Food & Personal Care", "COLG"), | |
| Company("Fauji Foods Ltd.", "Food & Personal Care", "FFL"), | |
| Company("Murree Brewery Company Ltd.", "Food & Personal Care", "MUREB"), | |
| Company("Nestle Pakistan Ltd.", "Food & Personal Care", "NESTLE"), | |
| Company("National Foods Ltd.", "Food & Personal Care", "NATF"), | |
| Company("Rafhan Maize Products Co. Ltd.", "Food & Personal Care", "RMPL"), | |
| Company("Unilever Pakistan Food Ltd.", "Food & Personal Care", "UPFL"), | |
| Company("Unity Foods Ltd.", "Food & Personal Care", "UNITY"), | |
| Company("Tariq Glass Industries Ltd.", "Glass & Ceramics", "TGGL"), | |
| Company("Ghani Glass Ltd.", "Glass & Ceramics", "GHGL"), | |
| Company("Pakistan Services Ltd.", "Miscellaneous", "PSEL"), | |
| Company("Pakistan Aluminium Beverage Cans Ltd.", "Miscellaneous", "PABC"), | |
| Company("Shifa International Hospitals Ltd.", "Miscellaneous", "SHFA"), | |
| Company("Javedan Corporation Ltd.", "Property", "JAVED") | |
| ] | |
| ## KSE 30 | |
| kse_30 = [ | |
| Company("Fauji Fertilizer Company Limited", "Fertilizer", "FFC"), | |
| Company("United Bank Limited", "Commercial Banks", "UBL"), | |
| Company("The Hub Power Company Limited", "Power Generation & Distribution", "HUBC"), | |
| Company("Engro Holdings Limited", "Investment / Holding Companies", "ENGROH"), | |
| Company("Oil & Gas Development Company Limited", "Oil & Gas Exploration", "OGDC"), | |
| Company("Pakistan Petroleum Limited", "Oil & Gas Exploration", "PPL"), | |
| Company("Meezan Bank Limited", "Commercial Banks", "MEBL"), | |
| Company("D.G. Khan Cement Company Limited", "Cement", "DGKC"), | |
| Company("Mari Energies Limited", "Oil & Gas Exploration", "MARI"), | |
| Company("Habib Bank Limited", "Commercial Banks", "HBL"), | |
| Company("Fauji Cement Company Limited", "Cement", "FCCL"), | |
| Company("Engro Fertilizers Limited", "Fertilizer", "EFERT"), | |
| Company("Pakistan State Oil Company Limited", "Oil & Gas Marketing", "PSO"), | |
| Company("Maple Leaf Cement Factory Limited", "Cement", "MLCF"), | |
| Company("Pakistan Oilfields Limited", "Oil & Gas Exploration", "POL"), | |
| Company("Ghandhara Industries Limited", "Automobile Assembler", "GHNI"), | |
| Company("Pak Elektron Limited", "Cables & Electrical Goods", "PAEL"), | |
| Company("Lucky Cement Limited", "Cement", "LUCK"), | |
| Company("Attock Refinery Limited", "Refinery", "ATRL"), | |
| Company("MCB Bank Limited", "Commercial Banks", "MCB"), | |
| Company("Sazgar Engineering Works Limited", "Automobile Assembler", "SAZEW"), | |
| Company("National Bank of Pakistan", "Commercial Banks", "NBP"), | |
| Company("The Searle Company Limited", "Pharmaceutical", "SEARL"), | |
| Company("Sui Northern Gas Pipelines Limited", "Oil & Gas Marketing", "SNGP"), | |
| Company("Ghandhara Automobiles Limited", "Automobile Assembler", "GAL"), | |
| Company("Pakistan Refinery Limited", "Refinery", "PRL"), | |
| Company("The Bank of Punjab", "Commercial Banks", "BOP"), | |
| Company("Sui Southern Gas Company Limited", "Oil & Gas Marketing", "SSGC"), | |
| Company("Systems Limited", "Technology & Communication", "SYS"), | |
| Company("Bank AL Habib Limited", "Commercial Banks", "BAHL"), | |
| ] | |
| ## div 20 | |
| psx_div_20 = [ | |
| Company("Pakistan Oilfields Limited", "Oil & Gas Exploration", "POL"), | |
| Company("Millat Tractors Limited", "Automobile Assembler", "MTL"), | |
| Company("Arif Habib Corporation Limited", "Investment / Holding Companies", "AHCL"), | |
| Company("Fauji Fertilizer Company Limited", "Fertilizer", "FFC"), | |
| Company("MCB Bank Limited", "Commercial Banks", "MCB"), | |
| Company("Engro Fertilizers Limited", "Fertilizer", "EFERT"), | |
| Company("Bank Alfalah Limited", "Commercial Banks", "BAFL"), | |
| Company("BankIslami Pakistan Limited", "Commercial Banks", "BIPL"), | |
| Company("Bank AL Habib Limited", "Commercial Banks", "BAHL"), | |
| Company("Image Pakistan Limited", "Textile Composite", "IMAGE"), | |
| Company("The Bank of Punjab", "Commercial Banks", "BOP"), | |
| Company("Faysal Bank Limited", "Commercial Banks", "FABL"), | |
| Company("National Foods Limited", "Food & Personal Care", "NATF"), | |
| Company("United Bank Limited", "Commercial Banks", "UBL"), | |
| Company("Javedan Corporation Limited", "Property", "JVDC"), | |
| Company("The Hub Power Company Limited", "Power Generation & Distribution", "HUBC"), | |
| Company("Meezan Bank Limited", "Commercial Banks", "MEBL"), | |
| Company("Habib Bank Limited", "Commercial Banks", "HBL"), | |
| Company("Oil & Gas Development Company Limited", "Oil & Gas Exploration", "OGDC"), | |
| Company("Fatima Fertilizer Company Limited", "Fertilizer", "FATIMA"), | |
| ] | |
| ## MII 30 | |
| mii_30 = [ | |
| Company("Fauji Fertilizer Company Limited", "Fertilizer", "FFC"), | |
| Company("Engro Holdings Limited", "Investment / Holding Companies", "ENGROH"), | |
| Company("The Hub Power Company Limited", "Power Generation & Distribution", "HUBC"), | |
| Company("Lucky Cement Limited", "Cement", "LUCK"), | |
| Company("Meezan Bank Limited", "Commercial Banks", "MEBL"), | |
| Company("Mari Energies Limited", "Oil & Gas Exploration", "MARI"), | |
| Company("Oil & Gas Development Company Limited", "Oil & Gas Exploration", "OGDC"), | |
| Company("Pakistan Petroleum Limited", "Oil & Gas Exploration", "PPL"), | |
| Company("Engro Fertilizers Limited", "Fertilizer", "EFERT"), | |
| Company("Systems Limited", "Technology & Communication", "SYS"), | |
| Company("Pakistan State Oil Company Limited", "Oil & Gas Marketing", "PSO"), | |
| Company("Maple Leaf Cement Factory Limited", "Cement", "MLCF"), | |
| Company("D.G. Khan Cement Company Limited", "Cement", "DGKC"), | |
| Company("Millat Tractors Limited", "Automobile Assembler", "MTL"), | |
| Company("Fauji Cement Company Limited", "Cement", "FCCL"), | |
| Company("Faysal Bank Limited", "Commercial Banks", "FABL"), | |
| Company("Sazgar Engineering Works Limited", "Automobile Assembler", "SAZEW"), | |
| Company("Pioneer Cement Limited", "Cement", "PIOC"), | |
| Company("Cherat Cement Company Limited", "Cement", "CHCC"), | |
| Company("Sui Northern Gas Pipelines Limited", "Oil & Gas Marketing", "SNGP"), | |
| Company("Attock Refinery Limited", "Refinery", "ATRL"), | |
| Company("Lucky Core Industries Limited", "Chemical", "LCI"), | |
| Company("Pak Elektron Limited", "Cables & Electrical Goods", "PAEL"), | |
| Company("The Searle Company Limited", "Pharmaceutical", "SEARL"), | |
| Company("GlaxoSmithKline Pakistan Limited", "Pharmaceutical", "GLAXO"), | |
| Company("Highnoon Laboratories Limited", "Pharmaceutical", "HINOON"), | |
| Company("Kohat Cement Company Limited", "Cement", "KOHC"), | |
| Company("Abbott Laboratories (Pakistan) Limited", "Pharmaceutical", "ABOT"), | |
| Company("National Foods Limited", "Food & Personal Care", "NATF"), | |
| ] | |
| ## KMI 30 | |
| kmi_30 = [ | |
| Company("Air Link Communication Limited", "Technology & Communication", "AIRLINK"), | |
| Company("Attock Refinery Limited", "Refinery", "ATRL"), | |
| Company("Cnergyico PK Limited", "Refinery", "CNERGY"), | |
| Company("Citi Pharma Limited", "Pharmaceutical", "CPHL"), | |
| Company("D.G. Khan Cement Company Limited", "Cement", "DGKC"), | |
| Company("Engro Fertilizers Limited", "Fertilizer", "EFERT"), | |
| Company("Engro Holdings Limited", "Investment / Holding Companies", "ENGROH"), | |
| Company("Fauji Cement Company Limited", "Cement", "FCCL"), | |
| Company("Fauji Fertilizer Company Ltd", "Fertilizer", "FFC"), | |
| Company("Fauji Foods Limited", "Food & Personal Care", "FFL"), | |
| Company("Ghandhara Automobiles Limited", "Automobile Assembler", "GAL"), | |
| Company("Ghandhara Industries Limited", "Automobile Assembler", "GHNI"), | |
| Company("GlaxoSmithKline Pakistan", "Pharmaceutical", "GLAXO"), | |
| Company("The Hub Power Company Limited", "Power Generation & Distribution", "HUBC"), | |
| Company("Lucky Cement Limited", "Cement", "LUCK"), | |
| Company("Mari Energies Limited", "Oil & Gas Exploration", "MARI"), | |
| Company("Meezan Bank Limited", "Commercial Banks", "MEBL"), | |
| Company("Maple Leaf Cement Factory Limited", "Cement", "MLCF"), | |
| Company("Millat Tractors Limited", "Automobile Assembler", "MTL"), | |
| Company("National Refinery Limited", "Refinery", "NRL"), | |
| Company("Oil & Gas Development Company Limited", "Oil & Gas Exploration", "OGDC"), | |
| Company("Pak Elektron Limited", "Cables & Electrical Goods", "PAEL"), | |
| Company("Pakistan Petroleum Limited", "Oil & Gas Exploration", "PPL"), | |
| Company("Pakistan Refinery Limited", "Refinery", "PRL"), | |
| Company("Pakistan State Oil Company Limited", "Oil & Gas Marketing", "PSO"), | |
| Company("Sazgar Engineering Works Limited", "Automobile Assembler", "SAZEW"), | |
| Company("The Searle Company Limited", "Pharmaceutical", "SEARL"), | |
| Company("Sui Northern Gas Pipelines Limited", "Oil & Gas Marketing", "SNGP"), | |
| Company("Sui Southern Gas Company Limited", "Oil & Gas Marketing", "SSGC"), | |
| Company("Systems Limited", "Technology & Communication", "SYS"), | |
| ] | |
| INDEX_MAP = { | |
| IndexEnum.kse_100: kse_100, | |
| IndexEnum.kse_30: kse_30, | |
| IndexEnum.psx_div_20: psx_div_20, | |
| IndexEnum.mii_30: mii_30, | |
| IndexEnum.kmi_30: kmi_30, | |
| } |