Skip to main content

This package provides user-friendly functions to easily navigate stock information of the companies of their interests. The output results include visualization of closing prices and daily returns, stock prediction for the next twenty days, as well as the company information with sectors and PE ratios.

Project description

Stock_Info_Easy

This Python package is an implementation of the existing yfinance wrapper, one of the widely used yahoo finance API wrappers. One drawback of the existing yahoo finance API wrapper is its inability to fetch stock data using the company name; it can only fetch the data with company symbol registered on the Yahoo Finance.

To improve the functionality of the previous wrapper, this package enables a user to query a company with its full name. By simply typing a company name, this pacakage will generate today's stock information for the company of interest.

The fetched data includes:

  • company name, open, high, low, close (closing price), adj close, volume, daily return, and PE ratios.

The stock information will be provided in dynamic formats with the use of visualizations, a data table, a stock forecast and an audio file.

Installation

$ pip install stock_info_easy

Usage

To execute the package, simply type the names of companies.
On the terminal, type:

# Example: Only specify a company name(s) to query, using all other parameters as default.
>>> Input:
get_hist_data(['amazon', 'apple', 'microsoft', 'google'], start_date = 01/04/2022, end_date = '01/10/2022') # end_date is today's date by default.

>>> Output: 
[                Open        High         Low       Close      Adj Close    Volume     company_name     company_fullname
    2022-01-04  170.438004  171.399994  166.349503  167.522003  167.522003  70726000       amazon           AMAZON
    2022-01-05  166.882996  167.126495  164.356995  164.356995  164.356995  64302000       amazon           AMAZON
    2022-01-06  163.450500  164.800003  161.936996  163.253998  163.253998  51958000       amazon           AMAZON
    2022-01-07  163.839005  165.243500  162.031006  162.554001  162.554001  46606000       amazon           AMAZON
    2022-01-10  160.585495  161.661499  156.304504  161.485992  161.485992  87798000       amazon           AMAZON
    [5 rows x 8 columns],
    
    Open        High         Low       Close   Adj Close     Volume company_name company_fullname
    2022-01-04  182.630005  182.940002  179.119995  179.699997  178.663086   99310400        apple            APPLE
    2022-01-05  179.610001  180.169998  174.639999  174.919998  173.910645   94537600        apple            APPLE
    2022-01-06  172.699997  175.300003  171.639999  172.000000  171.007523   96904000        apple            APPLE
    2022-01-07  172.889999  174.139999  171.029999  172.169998  171.176529   86709100        apple            APPLE
    2022-01-10  169.080002  172.500000  168.169998  172.190002  171.196426  106765600        apple            APPLE
    [5 rows x 8 columns], 
    
    Open        High         Low       Close   Adj Close    Volume company_name company_fullname
    2022-01-04  145.550507  146.610001  143.816147  144.416504  144.416504  22928000       google           GOOGLE
    2022-01-05  144.181000  144.298004  137.523499  137.653503  137.653503  49642000       google           GOOGLE
    2022-01-06  137.497498  139.686005  136.763504  137.550995  137.550995  29050000       google           GOOGLE
    2022-01-07  137.904999  138.254745  135.789001  137.004501  137.004501  19408000       google           GOOGLE
    2022-01-10  135.098999  138.639999  133.140503  138.574005  138.574005  34096000       google           GOOGLE
    [5 rows x 8 columns],
    
    Open        High         Low       Close   Adj Close    Volume company_name company_fullname
    2022-01-04  334.829987  335.200012  326.119995  329.010010  325.955750  32674300    microsoft        MICROSOFT
    2022-01-05  325.859985  326.070007  315.980011  316.380005  313.442993  40054300    microsoft        MICROSOFT
    2022-01-06  313.149994  318.700012  311.489990  313.880005  310.966187  39646100    microsoft        MICROSOFT
    2022-01-07  314.149994  316.500000  310.089996  314.040009  311.124725  32720000    microsoft        MICROSOFT
    2022-01-10  309.489990  314.720001  304.690002  314.269989  311.352570  44289500    microsoft        MICROSOFT
    [5 rows x 8 columns]]

2. Visualization of Closing Price

>>> Input: get_closing_price_viz(company_list, comp_names) # company_list and comp_names are output from the previous function.

![](https://github.com/shaunahan/Stock_Info_Easy/blob/main/img/closing_price.png)


3. Visualization of Daily Return

>>> Input: get_daily_return_viz(company_list, company_names)

![](https://github.com/shaunahan/Stock_Info_Easy/blob/main/img/daily_return.png)

4. Audio file on Stock Info

This package provides key stock information such as PE ratio and basic company information of all queries companies in an audio format.

generate_audio(comp_names_abbr, audio_filename='default1.mp3') # insert a filename in audio_filename

5. Prediction on Closing Price

This package uses the time series LSTM vanila model to predict the closing price. LSTM model is built with two hidden LSTM layers followed by a standard feedforward output layer.

# Write following functions 
create_pricelist(close_prices, windown_size = 30)
predict_rolling_price(result_list, model, window_size = 30, predict_window_size = 10)
train_model(stock, comp_name, windown_size=30, predict_window_size=10)

![](https://github.com/shaunahan/Stock_Info_Easy/blob/main/img/closing_price_forecast.png)


Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

stock_info_easy was created by Shauna Han. It is licensed under the terms of the MIT license.

Credits

stock_info_easy was created with cookiecutter and the py-pkgs-cookiecutter template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stock_info_easy-1.1.9.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

stock_info_easy-1.1.9-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file stock_info_easy-1.1.9.tar.gz.

File metadata

  • Download URL: stock_info_easy-1.1.9.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.6 Darwin/21.4.0

File hashes

Hashes for stock_info_easy-1.1.9.tar.gz
Algorithm Hash digest
SHA256 b1c60633b58a153e574e366897fbfb0b3ef71eae969edb7a70ad3a8ea29b7a4c
MD5 d64d9c4f23403f4f1177774a6bdb5e25
BLAKE2b-256 6205857997cf99054369ba541d9b349b558022da7e6e79b3225533a2a5f1818a

See more details on using hashes here.

File details

Details for the file stock_info_easy-1.1.9-py3-none-any.whl.

File metadata

  • Download URL: stock_info_easy-1.1.9-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.10.6 Darwin/21.4.0

File hashes

Hashes for stock_info_easy-1.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9df5d0ee6135a6f840ecc332bbb1492e622a6062203d631df8774f58b10f1293
MD5 d6a425d53b2883c98abd4cd5bee27639
BLAKE2b-256 b3c112fba4e9a071d747ffd8e12077eca66578a425b4b7c9d2cf3d5a2cc689ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page