Pyhton Yahoo Financials SDK
Project description
Yahoo Financials API
Lightweight SDK for interacting with the Yahoo Financials API. This is more geared on towards the three main financial records:
- balance sheet
- income statement
- cash flow
How to install?
pip3 install yahoo-fin-api
Examples
1. Get the data from the Yahoo Financials API
from yahoo_api import Client
def main():
client = Client(
cache_response= True, # Should cache the response after fetching from API
input_csv_file="./examples/freetrade_universe.csv", # Load the universe from this file
download_folder_path="./data") # Cache the data from the API in this folder
client.get_symbols()
if __name__ == "__main__":
main()
2. Load the balance sheet models
from yahoo_api import YahooFinApi, Client
from pprint import pprint
def main():
yf = YahooFinApi(
Client(
cache_response= True,
input_csv_file="./examples/freetrade_universe.csv",
download_folder_path="./data"
)
)
bs = yf.get_balance_sheets(["AAPL", "TSLA"])
pprint(bs)
if __name__ == "__main__":
main()
3. Load the cash flow models
from yahoo_api import YahooFinApi, Client
from pprint import pprint
def main():
yf = YahooFinApi(
Client(
cache_response= True,
input_csv_file="./examples/freetrade_universe.csv",
download_folder_path="./data"
)
)
cf = yf.get_cashflow_statements(["AAPL", "TSLA"])
pprint(cf)
if __name__ == "__main__":
main()
4. Load the income statement model
from yahoo_api import YahooFinApi, Client
from pprint import pprint
def main():
yf = YahooFinApi(
Client(
cache_response= True,
input_csv_file="./examples/freetrade_universe.csv",
download_folder_path="./data"
)
)
i_stmts = yf.get_income_statements(["AAPL", "TSLA"])
pprint(i_stmts)
if __name__ == "__main__":
main()
5. Load financial data model
from yahoo_api import YahooFinApi, Client
from pprint import pprint
def main():
yf = YahooFinApi(
Client(
cache_response= True,
input_csv_file="./examples/freetrade_universe.csv",
download_folder_path="./data"
)
)
cf = yf.get_financial_data(["AAPL", "TSLA"])
pprint(cf)
if __name__ == "__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for yahoo_fin_api-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 947808bd4ddf21d5c8d22a78fbb080b34708c57e34ff2f80b97cf1721650bef8 |
|
MD5 | a9ee41cbba9da60ea4668f1b55ad9784 |
|
BLAKE2b-256 | ae680da563842579b087dcf6be02ff51ffc4af653b7a392b9848d522424f1850 |