Skip to main content

A package to aggregate fixed income products available to Singapore residents to earn yield on singapore dollars

Project description

sgfixedincome_pkg

codecov

A python package to aggregate and analyse data on SGD-denominated retail fixed income products in Singapore.

Are you a non-technical user? Use the app here.

Introduction

This python package contains:

  • scraper.py: A generalized web scraper to extract fixed deposit rates data from bank websites that display this data in a suitable table format.
  • mas_api_client.py: An API client that interacts with several Monetary Authority of Singapore (MAS) bonds and bills API endpoints. In particular, we provide functions to extract data on Singapore Savings Bonds (SSB) and Treasury bills (T-bills).
  • consolidate.py: Functions to format, merge, and consolidate data obtained from scraping bank websites and from the MAS API.
  • analysis.py: Functions to analyse and visualise extracted fixed income product data.
  • streamlit_app/app.py: code for streamlit web interface

Installation

The package can be installed using:

$ pip install sgfixedincome_pkg

Documentation and Usage

Detailed documentation can be found on Read the Docs.

You can also explore detailed vignettes demonstrating the package's functionality:

  • Main vignette: fetch, analyze, and visualize retail fixed income product data.
  • MAS vignette: how to use the MAS bonds and bills API client and related functions
  • Scraper vignette: how to use functions that scrape bank fixed deposit websites

Or simply explore the streamlit app.

Running the Streamlit App

After installation, find the installation location with:

$ pip show sgfixedincome_pkg

Then run:

$ streamlit run "C:\Path\To\site-packages\sgfixedincome_pkg\streamlit_app\app.py"

For example:

$ streamlit run "C:\Users\John\Desktop\Folder\test_env\Lib\site-packages\sgfixedincome_pkg\streamlit_app\app.py"

This will open a browser window with an interactive dashboard.

Note: The web interface requires an active internet connection to fetch current rates and product information.

The App's Data Fetching & Caching Logic

To optimize performance and reliability:

  1. Data is scraped and stored in a central cache once every 24 hours, using this Github repository.
  2. If the cached data has any fetch failures but a previous successful version exists (no failures), you'll see an option to use that version instead.
  3. If the cached data is more than 2 days old, the tool will fetch fresh data directly.

When running the tool:

  • If you're using the hosted web app, you'll see whether the data is from the cache or freshly fetched
  • If you're running locally (streamlit run after pip install), the tool will always fetch fresh data
  • The data timestamp (in Singapore time) is always displayed in the sidebar

If present, warnings and failures will be shown in the sidebar to highlight any data fetching issues.

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

sgfixedincome_pkg was created by Gideon Tay. It is licensed under the terms of the MIT license.

Contact

Reach out to me on LinkedIn if you have any questions or suggestions.

Credits

sgfixedincome_pkg 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

sgfixedincome_pkg-0.2.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sgfixedincome_pkg-0.2.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file sgfixedincome_pkg-0.2.0.tar.gz.

File metadata

  • Download URL: sgfixedincome_pkg-0.2.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Windows/11

File hashes

Hashes for sgfixedincome_pkg-0.2.0.tar.gz
Algorithm Hash digest
SHA256 22127978e19362d5c11d7841f91ceed94952be1c39ba51dbeee3825a99719b4e
MD5 eba93a88da827dc2f51068d41a0ca03b
BLAKE2b-256 3d1f12feef2020eb727bb53a45254c77671a64ad36f83dc924f82cdbdb3f6481

See more details on using hashes here.

File details

Details for the file sgfixedincome_pkg-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sgfixedincome_pkg-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Windows/11

File hashes

Hashes for sgfixedincome_pkg-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0eb4f11039549b97f9ea74e9769846dfae8fb55d926e9185b40ab959403dd8c4
MD5 a664755f6140062e5afe189808d95668
BLAKE2b-256 00ec0e0db92b13fd2b393e3c293edddde08cebae97326c3489431f9d18fc45e9

See more details on using hashes here.

Supported by

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