Skip to content

Commit

Permalink
Update examples for new version of the package
Browse files Browse the repository at this point in the history
  • Loading branch information
JerBouma committed Oct 18, 2021
1 parent cb07d6c commit 17b44c1
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 22 deletions.
Binary file modified Examples/CompaniesPerSectorInTheNetherlands.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Examples/CountrySectorIndustryExample.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import FinanceDatabase as fd
import Searcher as fd # Replace with FinanceDatabase if repo not cloned
import matplotlib.pyplot as plt

# Obtain all countries from the database
Expand Down
14 changes: 5 additions & 9 deletions Examples/Semiconductors_ETFs.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import FinanceDatabase as fd
import Searcher as fd
from yfinance.utils import get_json
import matplotlib.pyplot as plt

all_etfs = fd.select_etfs()

semiconductor_etfs = fd.search_products(all_etfs, 'semiconductor')

# Remove some unwanted ETFs
del semiconductor_etfs['DXSH.DE']
del semiconductor_etfs['DXSH.F']

semiconductor_etfs_fundamentals = {}
for symbol in semiconductor_etfs:
semiconductor_etfs_fundamentals[symbol] = get_json("https://finance.yahoo.com/quote/" + symbol)

for symbol in semiconductor_etfs_fundamentals:
ytd_return = semiconductor_etfs_fundamentals[symbol]['fundPerformance']['trailingReturns']['ytd']
long_name = semiconductor_etfs_fundamentals[symbol]['quoteType']['longName']

if ytd_return is None:
try:
ytd_return = semiconductor_etfs_fundamentals[symbol]['fundPerformance']['trailingReturns']['ytd']
long_name = semiconductor_etfs_fundamentals[symbol]['quoteType']['longName']
except KeyError:
continue

plt.barh(long_name, ytd_return)
Expand Down
Binary file modified Examples/Semiconductors_ETFs_Returns.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Examples/Silicon_Valley_Technology_MarketCap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 4 additions & 10 deletions Examples/Sillicon_Valley_Technology.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import FinanceDatabase as fd
import Searcher as fd # Replace with FinanceDatabase if repo not cloned
import FundamentalAnalysis as fa
import pandas as pd
import matplotlib.pyplot as plt

all_technology_companies = fd.select_equities(sector='Technology')
silicon_valley = fd.search_products(all_technology_companies, query='San Jose', search='city')

for ticker in silicon_valley.copy():
if '.' in ticker:
del silicon_valley[ticker]

import FundamentalAnalysis as fa

API_KEY = "YOUR_API_KEY_HERE"
data_set = {}
for ticker in silicon_valley:
Expand All @@ -17,9 +14,6 @@
except Exception:
continue

import pandas as pd
import matplotlib.pyplot as plt

years = ['2016', '2017', '2018', '2019', '2020']
market_cap = pd.DataFrame(index=years)
for ticker in data_set:
Expand Down
2 changes: 1 addition & 1 deletion Examples/Technical_Analysis_Biotech_Companies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import FinanceDatabase as fd
import Searcher as fd # Replace with FinanceDatabase if repo not cloned
import matplotlib.pyplot as plt
import pandas as pd
import yfinance as yf
Expand Down
Binary file modified Examples/Technical_Analysis_Biotech_Companies_Coronacrisis.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Examples/United_States_Airlines.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import FinanceDatabase as fd
import Searcher as fd # Replace with FinanceDatabase if repo not cloned
from yfinance.utils import get_json
from yfinance import download
import matplotlib.pyplot as plt
Expand Down
Binary file modified Examples/United_States_Airlines_QuickRatio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 17b44c1

Please sign in to comment.