From 493617752699ff4ab63a1ed9df478ac030e68492 Mon Sep 17 00:00:00 2001 From: northern-64bit <75195383+northern-64bit@users.noreply.github.com> Date: Sat, 12 Mar 2022 13:25:13 +0100 Subject: [PATCH] Add avanza mutual fund data and commands (#1452) * Adding info_se and al_swe commands * Linting * Linting * linting * Fixes * Fixes to formatting * Linting * Linting * Linting Co-authored-by: jmaslek Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: didierlopes.eth --- .../mutual_funds/avanza_fund_ID.csv | 220 ++++++++++++++++++ .../mutual_funds/avanza_model.py | 35 +++ .../mutual_funds/avanza_view.py | 112 +++++++++ .../mutual_funds/mutual_fund_controller.py | 107 ++++++++- 4 files changed, 472 insertions(+), 2 deletions(-) create mode 100644 gamestonk_terminal/mutual_funds/avanza_fund_ID.csv create mode 100644 gamestonk_terminal/mutual_funds/avanza_model.py create mode 100644 gamestonk_terminal/mutual_funds/avanza_view.py diff --git a/gamestonk_terminal/mutual_funds/avanza_fund_ID.csv b/gamestonk_terminal/mutual_funds/avanza_fund_ID.csv new file mode 100644 index 00000000000..77c7130bd33 --- /dev/null +++ b/gamestonk_terminal/mutual_funds/avanza_fund_ID.csv @@ -0,0 +1,220 @@ +Fond,ISIN,Fond Bolag,Region,Kategori,ID +Enter Småbolagsfond A,SE0007413398,Enter,Sweden,Small/Mid Cap firms,589935 +SEF - Kavaljer Quality Focus A SEK,LU1232457504,Kavaljer,Sweden,Small/Mid Cap firms,659795 +Humle Småbolagsfond,SE0002229658,ISEC Services AB,Sweden,Small/Mid Cap firms,209089 +ODIN Small Cap C SEK,SE0013668183,Odin,Sweden,Small/Mid Cap firms,1039468 +Danske Invest Sverige Småbolag SA SEK,LU1857272386,Danske Invest,Sweden,Small/Mid Cap firms,880673 +Spiltan Aktiefond Småland,SE0002566349,Spiltan Fonder,Sweden,Small/Mid Cap firms,132510 +Evli Sverige Småbolag B,FI0008813142,Evli,Sweden,Small/Mid Cap firms,137448 +Spiltan Småbolagsfond,SE0001015355,Spiltan Fonder,Sweden,Small/Mid Cap firms,1996 +AMF Aktiefond Småbolag,SE0001185000,AMF,Sweden,Small/Mid Cap firms,2801 +Carnegie Småbolagsfond A,SE0004392025,Carnegie Fonder,Sweden,Small/Mid Cap firms,334856 +ODIN Sverige C,NO0008000023,Odin,Sweden,Small/Mid Cap firms,1918 +Cliens Småbolag A,SE0008992069,Cliens,Sweden,Small/Mid Cap firms,694253 +Lancelot Avalon A,SE0004841195,Lancelot,Sweden,Small/Mid Cap firms,378116 +Öhman Sweden Micro Cap A,SE0000432809,Öhman,Sweden,Micro Cap,2010 +Enter Sverige Pro,SE0000813925,Enter,Sweden,Non Specific,1964 +Didner & Gerge Småbolag,SE0002699421,Didner & Gerge,Sweden,Small/Mid Cap firms,157699 +Nordea Småbolagsfond Sverige,SE0003653302,Nordea,Sweden,Small/Mid Cap firms,276112 +PLUS Mikrobolag Sverige Index,SE0010323634,FCG,Sweden,Small/Mid Cap firms,789174 +PLUS Småbolag Sverige Index,SE0010323642,FCG,Sweden,Small/Mid Cap firms,789175 +Swedbank Robur Småbolagsfond Sverige A,SE0000602302,Swedbank Robur,Sweden,Small/Mid Cap firms,2008 +SEB Sverigefond Småbolag,SE0000577389,SEB,Sweden,Small/Mid Cap firms,2013 +Enter Sverige A,SE0000813917,Enter,Sweden,Non Specific,1963 +Indecap Guide Q30 C,SE0010441352,Indecap,Sweden,Small/Mid Cap firms,804453 +Handelsbanken Svenska Småbolag (A1 SEK),SE0000356065,Handelsbanken,Sweden,Small/Mid Cap firms,2006 +Strand Småbolagsfond,SE0001928730,Strand,Sweden,Small/Mid Cap firms,64710 +SEB Sverigefond Småbolag C/R,SE0000434201,SEB,Sweden,Small/Mid Cap firms,2007 +Catella Småbolag,SE0000577330,Catella,Sweden,Small/Mid Cap firms,1943 +Enter Select Pro,SE0001172362,Enter,Sweden,Non Specific,26 +Enter Select A,SE0002096545,Enter,Sweden,Non Specific,91107 +Lannebo Småbolag,SE0000740698,Lannebo,Sweden,Small/Mid Cap firms,2014 +Öhman Småbolagsfond A,SE0000432775,Öhman,Sweden,Small/Mid Cap firms,2003 +Cliens Sverige Fokus A,SE0003910314,Cliens,Sweden,Non Specific,283139 +Humle Sverigefond,SE0002229641,ISEC Services AB,Sweden,Non Specific,209088 +Cliens Sverige B,SE0004869626,Cliens,Sweden,Non Specific,379956 +Didner & Gerge Aktiefond,SE0000428336,Didner & Gerge,Sweden,Non Specific,1919 +Skandia Sverige Exponering,SE0005065521,Skandia Fonder,Sweden,Index,403595 +Catella Sverige Hållbart Beta A,SE0000577272,Catella,Sweden,Index,1948 +Handelsbanken Sverige Index Criteria,SE0001466368,Handelsbanken,Sweden,Index,20993 +Danske Invest Sverige SA,LU1349494812,Danske Invest,Sweden,Non Specific,801498 +SPP Sverige Plus A SEK,SE0008964407,SPP,Sweden,Index,694153 +Skandia Småbolag Sverige,SE0000810814,Skandia Fonder,Sweden,Small/Mid Cap firms,2012 +SEB Sverige Indexfond B,SE0009773716,SEB,Sweden,Index,1196130 +SEB Sverige Indexnära A,SE0002593673,SEB,Sweden,Index,150048 +SEB Sweden Equity C (SEK),LU0047322432,SEB,Sweden,Non Specific,1907 +AMF Aktiefond Sverige,SE0000739195,AMF,Sweden,Non Specific,1949 +Handelsbanken Sverige Selektiv,SE0005965639,Handelsbanken,Sweden,Non Specific,508255 +C Worldwide Sweden Small Cap 1A,LU0424682077,C Worldwide,Sweden,Small/Mid Cap firms,221608 +Simplicity Småbolag Sverige A,SE0009161540,Simplicity,Sweden,Small/Mid Cap firms,702073 +Spiltan Aktiefond Stabil,SE0001015348,Spiltan Fonder,Sweden,Non Specific,2016 +Öhman Sverige Hållbar A,SE0005281953,Öhman,Sweden,Non Specific,430255 +Case All Star,SE0010134288,Case,Sweden,Non Specific,795773 +Skandia Sverige Hållbar,SE0010547943,Skandia Fonder,Sweden,Non Specific,823614 +Skandia Cancerfonden,SE0000432759,Skandia Fonder,Sweden,Non Specific,1895 +Skandia Världsnaturfonden,SE0000432742,Skandia Fonder,Sweden,Non Specific,1896 +Consensus Sverige Select A,SE0011750967,FCG,Sweden,Small/Mid Cap firms,1011197 +Handelsbanken Sverige 100 Ind Cri A1 SEK,SE0003788587,Handelsbanken,Sweden,Index,315116 +Cicero Sverige A,SE0012853828,Cicero,Sweden,Non Specific,1013074 +Lannebo Sverige Plus,SE0002686584,Lannebo,Sweden,Non Specific,155953 +SEB Swedish Value Fund,SE0001838004,SEB,Sweden,Non Specific,87987 +Swedbank Robur Access Edge Sweden A,SE0013121522,Swedbank Robur,Sweden,Non Specific,1141040 +She Invest Sweden,SE0006852232,ALFAKRAFT Fonder AB,Sweden,Non Specific,1029789 +Carnegie All Cap A,SE0007704804,Carnegie Fonder,Sweden,Non Specific,670777 +Quesada Sverige,SE0000893307,FCG,Sweden,Non Specific,556795 +Nordea Sverige Passiv icke-utd,SE0002591016,Nordea,Sweden,Index,140888 +Öhman Sverige Fokus A,SE0009997091,Öhman,Sweden,Non Specific,855015 +Nordea Swedish Stars icke-utd,SE0000625238,Nordea,Sweden,Non Specific,1960 +Länsförsäkringar Sverige Indexnära,SE0002656611,Länsförsäkringar,Sweden,Index,159608 +Aktiespararna Topp Sverige Hållbar A,SE0000924649,Cicero,Sweden,Index,1961 +Norron Active RC SEK,LU0619829491,Norron,Sweden,Non Specific,313047 +Evli Aktieindex B,FI4000058821,Evli,Sweden,Index,416835 +SEB Sverigefond,SE0000775298,SEB,Sweden,Non Specific,1983 +Danske Invest Sverige Beta SA,LU1349502002,Danske Invest,Sweden,Index,801494 +Lancelot Avalon B,SE0014704805,Lancelot,Sweden,Non Specific,1150169 +Avanza Zero,SE0001718388,Avanza,Sweden,Index,41567 +Avanza Småbolag by Skoglund,SE0015194618,Avanza,Sweden,Non Specific,1162060 +Cliens Micro Cap A,SE0014829545,Cliens,Sweden,Micro Cap,1140464 +PLUS Allabolag Sverige Index,SE0014991535,FCG,Sweden,Index,1151293 +Alcur Grow B,SE0015196019,Alcur Fonder,Sweden,Small/Mid Cap firms,1170516 +PriorNilsson Sverige Aktiv A,SE0004636447,Prior&Nilsson,Sweden,Non Specific,377801 +Ålandsbanken Nordiska Småbolag S,FI4000439450,Ålandsbanken,Nordic Countries,Small/Mid Cap firms,1193260 +DNB Fund - Nordic Small Cap Retail A SEK,LU2085661721,DNB,Nordic Countries,Small/Mid Cap firms,1038776 +Fondita Nordic Micro Cap B,FI0008810940,Fondita,Nordic Countries,Micro Cap,70685 +Swedbank Robur Småbolagsfond Norden A,SE0000537706,Swedbank Robur,Nordic Countries,Small/Mid Cap firms,1678 +Aktiehuset Fond,SE0013222882,AIFM Capital AB,Nordic Countries,Non Specific,1161196 +SEB Nordenfond Småbolag C EUR - Lux,LU0385664312,SEB,Nordic Countries,Small/Mid Cap firms,195872 +Caprifol Nordiska Fonden,SE0002834432,Caprifol,Nordic Countries,Non Specific,187208 +Consensus Småbolag A,SE0008679971,FCG,Nordic Countries,Small/Mid Cap firms,1011196 +Holberg Norden A,NO0010072945,Holberg,Nordic Countries,Non Specific,74111 +Handelsbanken Nordiska Småbol (A1 SEK),SE0000522724,Handelsbanken,Nordic Countries,Small/Mid Cap firms,1682 +Pareto Nordic Equity B SEK,LU1653072758,Pareto Asset Management,Nordic Countries,Non Specific,907820 +BNP Paribas Nordic Small Cap Cl C,LU0950372838,BNP Paribas,Nordic Countries,Small/Mid Cap firms,459897 +Lannebo Norden Hållbar SEK,SE0011311281,Lannebo,Nordic Countries,Non Specific,862035 +Fondita Nordic Small Cap B,FI0008802871,Fondita,Nordic Countries,Small/Mid Cap firms,1681 +Evli Nordic B,FI0008810908,Evli,Nordic Countries,Non Specific,86207 +SEB WWF Nordenfond,SE0000691750,SEB,Nordic Countries,Non Specific,981 +SEB Nordic Equity Fund C EUR,LU0030165871,SEB,Nordic Countries,Non Specific,1630 +SEB Nordic Equity Fund C SEK,LU1807523151,SEB,Nordic Countries,Non Specific,887013 +Nordea Innovation Stars Fund AG-SEK,FI4000439625,Nordea,Globally,Non Specific,1120416 +Fidelity Nordic A-Dis-SEK,LU0048588080,Fidelity,Nordic Countries,Non Specific,1644 +Swedbank Robur Nordenfond,SE0000537722,Swedbank Robur,Nordic Countries,Non Specific,1636 +Handelsbanken Norden Selektiv,SE0005991700,Handelsbanken,Nordic Countries,Non Specific,512557 +ODIN Norden C,NO0008000155,Odin,Nordic Countries,Non Specific,1634 +DNB Norden Indeks A,NO0010815871,DNB,Nordic Countries,Index,862033 +SEB Nordenfond,SE0000984189,SEB,Nordic Countries,Non Specific,1651 +Handelsbanken Norden Ind Crit (A1 SEK),SE0010127894,Handelsbanken,Nordic Countries,Index,791753 +Ålandsbanken Norden Aktie EUR,FI4000123179,Ålandsbanken,Nordic Countries,Non Specific,559855 +Ålandsbanken Norden Aktie SEK,FI4000123245,Ålandsbanken,Nordic Countries,Non Specific,573156 +Alfred Berg Nordic Gambak C,NO0010833395,Alfred Berg,Nordic Countries,Non Specific,981861 +DNB Fund Nordic Equities retail A,LU0083425479,DNB,Nordic Countries,Non Specific,1646 +DNB Grönt Norden,NO0010102866,DNB,Nordic Countries,Non Specific,691676 +C WorldWide Nordic 1A,LU0086738027,C Worldwide,Nordic Countries,Non Specific,1643 +Skandia Norden,SE0004518744,Skandia Fonder,Nordic Countries,Non Specific,347375 +Simplicity Norden,SE0000988750,Simplicity,Nordic Countries,Non Specific,1660 +Captor Scilla Nordic Equity B,SE0010102277,Captor Fund Management AB,Nordic Countries,Non Specific,1141908 +Investtech Invest D,SE0014704854,Investtech Invest AS,Nordic Countries,Non Specific,1217309 +Norron Sustainable Equity RC SEK Acc,LU1982817865,Norron,Nordic Countries,Non Specific,1142574 +Fidelity Switzerland A-Dis-CHF,LU0054754816,Fidelity,Switzerland,Non Specific,777 +CS (Lux) Small and Mid Cap Germany Eq B,LU2066958898,Credit Suisse,Germany,Small/Mid Cap firms,1047825 +BNP Paribas Germany Mlt-Fac Eq C C,LU0823427611,BNP Paribas,Germany,Non Specific,416245 +Fidelity Germany A-Dis-EUR,LU0048580004,Fidelity,Germany,Non Specific,774 +SEF – Kavaljer Investmentbolagsfond A,LU1777968246,Kavaljer,Globally and Sweden,Non Specific,852914 +Quesada Vision B,SE0012854180,FCG,Globally and Sweden,Non Specific,1044020 +Quesada Vision A,SE0012854172,FCG,Globally and Sweden,Non Specific,1044019 +Handelsbanken Multi Asset 120 (A1 SEK),SE0009697170,Handelsbanken,Globally and Sweden,Fund of Funds,951762 +Skandia Världen Sverige,SE0014554838,Skandia Fonder,Globally and Sweden,Non Specific,1148787 +AMF Aktiefond Världen,SE0000739161,AMF,Globally and Sweden,Non Specific,2300 +GodFond Sverige & Världen,SE0002800276,SPP,Globally and Sweden,Non Specific,181868 +Swedbank Robur Bas 100,SE0006219184,Swedbank Robur,Globally and Sweden,Fund of Funds,502796 +Danske Invest Horisont Aktie SA,LU1349504479,Danske Invest,Globally and Sweden,Fund of Funds,801503 +SEB Aktiesparfond,SE0000984130,SEB,Globally and Sweden,Non Specific,1886 +Spiltan Aktiefond Investmentbolag,SE0004297927,Spiltan Fonder,Sweden,Finance,325406 +BGF World Financials A2,LU0106831901,BlackRock,Non Specific,Finance,541 +Fidelity Global Financial Svcs A-Dis-EUR,LU0114722498,Fidelity,Non Specific,Finance,521 +DNB Finans A,NO0008000593,DNB,Non Specific,Finance,321692 +Jupiter Financial Innovt L USD Acc,LU0262307720,Jupiter,Non Specific,Finance,119590 +DNB Fund - Private Equity retail B,LU0302296065,DNB,Non Specific,Private Equity,131490 +SEB Listed Private Equity C EUR - Lux,LU0385668222,SEB,Non Specific,Private Equity,192309 +Carnegie Listed Private Equity A,SE0003039874,Carnegie Fonder,Non Specific,Private Equity,198508 +SEB Listed Private Equity C SEK - LUX,LU0920715884,SEB,Non Specific,Private Equity,1161195 +UB Infra A,FI4000081211,United Bankers,Non Specific,Infrastructure,600081 +MS INVF Global Infrastructure A,LU0384381660,Morgan Stanley,Non Specific,Infrastructure,240788 +IKC Global Infrastructure A,SE0008434948,IKC,Non Specific,Infrastructure,698234 +First Sentier Glb Lstd Infra A GBP Acc,GB00B24HJC53,First State,Non Specific,Infrastructure,113948 +UB EM Infra A,FI4000081153,United Bankers,Emerging Markets,Infrastructure,600078 +Fidelity Global Div Pl A EUR,LU0099575291,Fidelity,Non Specific,Infrastructure,380 +Nordea 1 - Global Listed Infrastr BP SEK,LU2057980059,Nordea,Non Specific,Infrastructure,1047826 +Thematica – Future Mobility Retl SEK Acc,LU1814397268,IPConcept (Luxemburg) SA,Non Specific,New Technology,1158131 +BGF Future of Transport A2,LU1861214812,BlackRock,Non Specific,New Technology,927737 +Allianz Global Artfcl Intlgc AT EUR,LU1548497699,Allianz,Non Specific,New Technology,759593 +Threadneedle (Lux) Global Tech AU USD,LU0444971666,Threadneedle,Non Specific,New Technology,289977 +BGF Next Generation Technology A2,LU1861215975,BlackRock,Non Specific,New Technology,929225 +BGF FinTech A2,LU1861217088,BlackRock,Non Specific,New Technology,927736 +Augmented Reality Fund A,SE0011527829,AIFM Capital AB,Non Specific,New Technology,953014 +Lannebo Teknik Småbolag,SE0013236049,Lannebo,Globally and Sweden,New Technology,1011177 +Fidelity Global Technology A-Dis-EUR,LU0099574567,Fidelity,Non Specific,New Technology,379 +Swedbank Robur Technology A,SE0000538944,Swedbank Robur,Non Specific,New Technology,363 +JPM US Technology A (acc) USD,LU0210536867,JP Morgan,USA,New Technology,951763 +Öhman Global Growth,SE0000493546,Öhman,Non Specific,Growth Firms,37w +UBS (Lux) EF Tech Opp (USD) P acc,LU0081259029,UBS,Non Specific,New Technology,422 +Swedbank Robur Ny Teknik A,SE0000709123,Swedbank Robur,Globally and Sweden,New Technology,1933 +Franklin Technology A Acc USD,LU0109392836,Franklin Templeton,Non Specific,New Technology,397 +BGF World Technology A2,LU0056508442,BlackRock,Non Specific,New Technology,431 +AS SICAV I Global Inno Eq S Acc USD,LU0476877211,Aberdeen,Non Specific,New Technology,232954 +Skandia Time Global,SE0001112715,Skandia Fonder,Non Specific,New Technology,373 +Janus Henderson Hrzn GlbTechLdrs A2USD,LU0070992663,Janus Henderson,Non Specific,New Technology,12268 +TIN Ny Teknik A,SE0012193019,TIN Fonder,Globally and Sweden,New Technology,927735 +DNB Fund Technology retail A,LU0302296495,DNB,Non Specific,New Technology,131491 +DNB Teknologi A,NO0010337678,DNB,Non Specific,New Technology,321871 +Lannebo Teknik,SE0000740672,Lannebo,Non Specific,New Technology,2338 +GP Bullhound Global Technology A,SE0006881389,Finserve,Non Specific,New Technology,1161889 +Avanza World Tech by TIN,SE0014453221,Avanza,Non Specific,New Technology,1102641 +SEB Teknologifond,SE0000984114,SEB,Non Specific,New Technology,364 +SEB Teknologifond D USD - Lux utd,LU0047324487,SEB,Non Specific,New Technology,366 +Pictet-Digital R USD,LU0101692753,Pictet,Non Specific,New Technology,396 +White Fleet - Finserve Gbl Esports R SEK,LU2105725381,Finserve,Non Specific,New Technology,1097739 +Allianz Cyber Security AT USD Acc,LU2286300806,Allianz,Non Specific,New Technology,1237259 +Go Blockchain Fund A,SE0015837778,AIFM Capital AB,Non Specific,New Technology,1220461 +Jupiter Global Equity Gr Unc L USD Acc,LU2223789319,Non Specific,New Technology,1232059 +eSports Fund,SE0014957858,AIFM Capital AB,Non Specific,New Technology,1145780 +AuAg Silver Bullet A,SE0013358181,AIFM Capital AB,North America,Precious Metals,1015114 +Atlant Green Tech Metals,SE0008015077,Atlant,Non Specific,Precious Metals,666676 +Franklin Gold & Prec Mtls A(acc)USD,LU0496367417,Franklin Templeton,Non Specific,Precious Metals,236069 +Invesco Gold & Special Mirls A USD Acc,LU0505655562,Invesco,Non Specific,Precious Metals,250171 +BGF World Gold A2,LU0055631609,BlackRock,Non Specific,Precious Metals,492 +CPR Invest Global Gold Mines A USD Acc,LU1989766289,Amundi,Non Specific,Precious Metals,1149494 +Fidelity United Kingdom A-Dis-GBP,LU0048621717,Fidelity,United Kingdom,Non Specific,1844 +Threadneedle (Lux) UK Eqs AG GBP Acc,LU0713318490,Threadneedle,United Kingdom,Non Specific,376714 +Schroder ISF Emerging Europe A Acc EUR,LU0106817157,Schroder,East Europe,Non Specific,1166961 +SEB Östeuro Små o Medelst Bol EUR - Lux,LU0086828794,SEB,East Europe,Small/Mid Cap firms,935 +East Capital Östeuropa,SE0000888208,East Capital,East Europe,Non Specific,2591 +AS SICAV I Estn Eurp Eq S Acc EUR,LU0505785005,Aberdeen,East Europe,Non Specific,241952 +SEB Östeuropafond,SE0000433203,SEB,East Europe,Non Specific,2578 +Danske Invest Eastern Europe A,LU0727216755,Danske Invest,East Europe,Non Specific,1142573 +JPM Emerging Europe Equity A (acc) USD,LU0634316219,JP Morgan,East Europe,Non Specific,310258 +JPM Emerging Europe Equity A (dist) EUR,LU0051759099,JP Morgan,East Europe,Non Specific,2569 +Barings Eastern Europe A USD Inc,IE0000805634,Barings,East Europe,Non Specific,2579 +Swedbank Robur Östeuropafond A,SE0000539421,Swedbank Robur,East Europe,Non Specific,2575 +INVL Emerging Europe Bond,LTIF00000468,INVL,East Europe,Bonds,414066 +Invesco Global Equity Income A USD Acc,LU0607513230,Invesco,Globally,Large Dividend,317657 +Threadneedle (Lux) Asia Equity Inc AU,LU0061477393,Threadneedle,Asia and Australia ex. Japan,Large Dividend,289981 +Nordea Global Dividend Acc,FI4000064076,Nordea,Globally,Large Dividend,430355 +Swedbank Robur Global High Dividend A,SE0005249661,Swedbank Robur,Globally,Large Dividend,447023 +Jupiter Asia Pac Inc L USD Acc,LU0231116830,Jupiter,Asia and Australia ex. Japan,Large Dividend,92867 +BGF Global Equity Income A2,LU0545039389,BlackRock,Globally,Large Dividend,316508 +Länsförsäkringar Europa Aktiv A,SE0000837353,Länsförsäkringar,Europe,Large Dividend,573 +BGF Asia Pacific Equity Inc A2 USD,LU0414403419,BlackRock,Asia and Australia ex. Japan,Large Dividend,316502 +UBS(LUX) ES Glb Hi Div USD P-acc,LU0611173427,UBS,Globally,Large Dividend,376665 +BGF European Equity Income A2,LU0562822386,BlackRock,Europe,Large Dividend,316923 +Fidelity European Div A-Acc-EUR,LU0353647737,Fidelity,Europe,Large Dividend,277569 +AS SICAV I Eurp Eq Div S Acc EUR,LU0505783562,Aberdeen,Europe,Large Dividend,241953 +CS (Lux) Global Div Plus Eq B USD,LU0439730457,Credit Suisse,Globally,Large Dividend,414061 +Allianz European Equity Div AT EUR,LU0414045822,Allianz,Europe,Large Dividend,288003 +Danske Invest Europe High Dividend A,LU0123484957,Danske Invest,Europe,Large Dividend,2375 +Fidelity Global Dividend A-Acc-USD,LU0772969993,Fidelity,Globally,Large Dividend,350445 +Handelsbanken Gl Hi Div Lo Vol Cr A1 SEK,SE0013460920,Handelsbanken,Globally,Large Dividend,1076398 +CS (Lux) European Div Plus Eq B EUR,LU0439729368,Credit Suisse,Europe,Large Dividend,262969 +IKC Fastighetsfond A,SE0006600243,IKC,Sweden,Real Estate,551035 +ODIN Fastighet C,NO0010062953,Odin,Nordic Countries,Real Estate,351 +BNP Paribas Europe Small Cap Cl C,LU0212178916,BNP Paribas,Europe,Small/Mid Cap firms,281283 diff --git a/gamestonk_terminal/mutual_funds/avanza_model.py b/gamestonk_terminal/mutual_funds/avanza_model.py new file mode 100644 index 00000000000..d16da3fea89 --- /dev/null +++ b/gamestonk_terminal/mutual_funds/avanza_model.py @@ -0,0 +1,35 @@ +"""Avanza Model""" +__docformat__ = "numpy" + +# pylint: disable=E1101 + +import logging +import os +import requests + +import pandas as pd + +from gamestonk_terminal.decorators import log_start_end + +logger = logging.getLogger(__name__) + + +@log_start_end(log=logger) +def get_data(fund_name: str): + """Gets the data from Avanza + + Parameters + ---------- + fund_name: str + Full name of the fund + """ + ava_fund = pd.read_csv( + os.path.join("gamestonk_terminal", "mutual_funds", "avanza_fund_ID.csv"), + index_col=0, + ) + ava_fund.index = ava_fund.index.str.upper() + fund_id = ava_fund.loc[fund_name, "ID"] + url = f"https://www.avanza.se/_api/fund-guide/guide/{fund_id}" + response = requests.get(url) + fund_data = response.json() + return fund_data diff --git a/gamestonk_terminal/mutual_funds/avanza_view.py b/gamestonk_terminal/mutual_funds/avanza_view.py new file mode 100644 index 00000000000..052d7fb135a --- /dev/null +++ b/gamestonk_terminal/mutual_funds/avanza_view.py @@ -0,0 +1,112 @@ +"""Avanza View""" +__docformat__ = "numpy" + +import logging + +import pandas as pd + +from gamestonk_terminal.decorators import log_start_end +from gamestonk_terminal.rich_config import console +from gamestonk_terminal.helper_funcs import print_rich_table +from gamestonk_terminal.mutual_funds import avanza_model + +logger = logging.getLogger(__name__) + +sector_dict = { + "Industri": "Industry", + "Konsument, cyklisk": "Consumer goods, cyclical", + "Finans": "Finance", + "Konsument, stabil": "Consumer goods, stable", + "Sjukvård": "Health Care", + "Teknik": "Technology", + "Fastigheter": "Real Estate", + "Råvaror": "Commodities", + "Kommunikation": "Telecommunication", + "Allmännyttigt": "Utilities", + "Energi": "Energy", +} + + +@log_start_end(log=logger) +def display_allocation(fund_name: str, focus: str): + """Displays the allocation of the selected swedish fund + + Parameters + ---------- + fund_name: str + Full name of the fund + focus: str + The focus of the displayed allocation/exposure of the fund + """ + # Code mostly taken from: https://github.com/northern-64bit/Portfolio-Report-Generator/tree/main + fund_data = avanza_model.get_data(fund_name.upper()) + if focus in ["holding", "all"]: + table_row = [] + console.print("") + for data in fund_data["holdingChartData"]: + table_row_temp = [] + table_row_temp.append(data["name"]) + table_row_temp.append(str(data["y"])) + table_row_temp.append(data["countryCode"]) + table_row.append(table_row_temp) + header = ["Holding", "Allocation in %", "Country"] + holding_data = pd.DataFrame(table_row, columns=header) + print_rich_table(holding_data, title=f"{fund_name}'s Holdings", headers=header) + if focus in ["sector", "all"]: + table_row = [] + console.print("") + for data in fund_data["sectorChartData"]: + table_row_temp = [] + table_row_temp.append(sector_dict[data["name"]]) + table_row_temp.append(str(data["y"])) + table_row.append(table_row_temp) + header = ["Sector", "Allocation in %"] + sector_data = pd.DataFrame(table_row, columns=header) + print_rich_table( + sector_data, title=f"{fund_name}'s Sector Weighting", headers=header + ) + if focus in ["country", "all"]: + table_row = [] + console.print("") + for data in fund_data["countryChartData"]: + table_row_temp = [] + table_row_temp.append(data["countryCode"]) + table_row_temp.append(str(data["y"])) + table_row.append(table_row_temp) + header = ["Country", "Allocation in %"] + country_data = pd.DataFrame(table_row, columns=header) + print_rich_table( + country_data, title=f"{fund_name}'s Country Weighting", headers=header + ) + console.print("") + + +@log_start_end(log=logger) +def display_info(fund_name: str): + """Displays info of swedish funds + + Parameters + ---------- + fund_name: str + Full name of the fund + """ + fund_data = avanza_model.get_data(fund_name.upper()) + text = f"\nSwedish Description:\n\n{fund_data['description']}\n\nThe fund is managed by:\n" + for manager in fund_data["fundManagers"]: + text = text + f"\t- {manager['name']} since {manager['startDate']}\n" + text = ( + text + + f"from {fund_data['adminCompany']['name']}.\nThe currency of the fund is {fund_data['currency']}" + f" and it the fund started {fund_data['startDate']}." + ) + if fund_data["indexFund"]: + text = text + " It is a index fund." + else: + text = text + " It is not a index fund." + text = ( + text + + f" The fund manages {str(fund_data['capital'])} {fund_data['currency']}. The " + f"standard deviation of the fund is {str(fund_data['standardDeviation'])} and the sharpe " + f"ratio is {str(fund_data['sharpeRatio'])}.\n" + ) + console.print(text) diff --git a/gamestonk_terminal/mutual_funds/mutual_fund_controller.py b/gamestonk_terminal/mutual_funds/mutual_fund_controller.py index 6587b3e1491..469959d7717 100644 --- a/gamestonk_terminal/mutual_funds/mutual_fund_controller.py +++ b/gamestonk_terminal/mutual_funds/mutual_fund_controller.py @@ -23,7 +23,12 @@ from gamestonk_terminal.helper_funcs import ( valid_date, ) from gamestonk_terminal.menu import session -from gamestonk_terminal.mutual_funds import investpy_model, investpy_view, yfinance_view +from gamestonk_terminal.mutual_funds import ( + investpy_model, + investpy_view, + yfinance_view, + avanza_view, +) from gamestonk_terminal.parent_classes import BaseController from gamestonk_terminal.rich_config import console @@ -43,6 +48,8 @@ class FundController(BaseController): "plot", "sector", "equity", + "al_swe", + "info_swe", ] fund_countries = investpy.funds.get_fund_countries() @@ -57,6 +64,7 @@ class FundController(BaseController): "currency", "underlying", ] + focus_choices = ["all", "country", "sector", "holding"] PATH = "/funds/" FILE_PATH = os.path.join(os.path.dirname(__file__), "README.md") @@ -114,6 +122,12 @@ class FundController(BaseController): [src][YFinance][/src] sector sector weightings equity equity holdings[/cmds]{has_fund_usa_end} + """ + if self.fund_symbol != "" and self.country == "sweden": + help_text += """ +[src][Avanza][/src] + al_swe display fund allocation (sector, country, holdings) + info_swe get fund information """ console.print(text=help_text, menu="Mutual Funds") @@ -401,7 +415,7 @@ Potential errors @log_start_end(log=logger) def call_equity(self, other_args: List[str]): - """Process sector command""" + """Process equity command""" parser = argparse.ArgumentParser( add_help=False, formatter_class=argparse.ArgumentDefaultsHelpFormatter, @@ -424,3 +438,92 @@ Potential errors yfinance_view.display_equity(self.fund_symbol) return self.queue + + @log_start_end(log=logger) + def call_al_swe(self, other_args: List[str]): + """Process al_swe command""" + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="al_swe", + description="Show allocation of a swedish fund.", + ) + parser.add_argument( + "-f", + "--focus", + dest="focus", + type=str, + choices=self.focus_choices, + default="all", + help="The focus of the funds exposure/allocation", + ) + + ns_parser = parse_known_args_and_warn(parser, other_args) + if ns_parser: + ava_fund = pd.read_csv( + os.path.join( + "gamestonk_terminal", "mutual_funds", "avanza_fund_ID.csv" + ), + index_col=0, + ) + if self.country != "sweden": + console.print( + "Avanza implementation currently only supports funds from sweden." + ) + return self.queue + if self.fund_name == "": + if self.fund_symbol != "": + self.fund_symbol = investpy_model.get_fund_name_from_symbol( + self.fund_symbol + ) + else: + console.print( + "No fund loaded. Please use `load` first.\n", style="bold" + ) + return self.queue + if self.fund_name.upper() not in ava_fund.index.str.upper().to_numpy(): + console.print("No fund data. Please use another fund", style="bold") + return self.queue + avanza_view.display_allocation(self.fund_name, ns_parser.focus) + + return self.queue + + @log_start_end(log=logger) + def call_info_swe(self, other_args: List[str]): + """Process info_swe command""" + parser = argparse.ArgumentParser( + add_help=False, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + prog="info_swe", + description="Show fund info of a swedish fund.", + ) + + ns_parser = parse_known_args_and_warn(parser, other_args) + if ns_parser: + ava_fund = pd.read_csv( + os.path.join( + "gamestonk_terminal", "mutual_funds", "avanza_fund_ID.csv" + ), + index_col=0, + ) + if self.country != "sweden": + console.print( + "Avanza implementation currently only supports funds from sweden." + ) + return self.queue + if self.fund_name == "": + if self.fund_symbol != "": + self.fund_symbol = investpy_model.get_fund_name_from_symbol( + self.fund_symbol + ) + else: + console.print( + "No fund loaded. Please use `load` first.\n", style="bold" + ) + return self.queue + if self.fund_name.upper() not in ava_fund.index.str.upper().to_numpy(): + console.print("No fund data. Please use another fund", style="bold") + return self.queue + avanza_view.display_info(self.fund_name) + + return self.queue