Skip to main content

Unofficial Python library for accessing GSE (Guyana Stock Exchange) financial data

Project description

🏦 FinanceGY

FinanceGY is an unofficial Python library for accessing financial data from the Guyana Stock Exchange (GSE). It provides a simple and consistent interface for retrieving information on traded securities, recent trade data, and session details, all programmatically.


Installation

pip install financegy

Quick Start

import financegy

# Get a list of all traded securities
securities = financegy.get_securities()

# Get the name of a security by its ticker symbol
security_name = financegy.get_security_by_symbol("DDL")

# Get the most recent trade data for a security
recent_trade = financegy.get_recent_trade("DDL")

# Get all trade data for the most recent year
recent_year = financegy.get_security_recent_year("DDL")

# Get trade data for a specific trading session
session_trades = financegy.get_session_trades("1136")

# Get session trade data for a specific security
security_session_trade = financegy.get_security_session_trade("DDL", "1136")

# Search for securities by name or symbol
search_results = financegy.search_securities("DDL")

# Get all trades for a given year
year_trades = financegy.get_trades_for_year("DDL", "2019")

# Get historical trades within a date range - (yyyy) / (mm/yyyy) / (dd/mm/yyyy)
historical_trades = financegy.get_historical_trades(
    symbol="DDL",
    start_date="01/06/2020",
    end_date="01/2022"
)

Data Retrieval

Function Description
get_securities() Returns a list of all currently traded securities on the GSE.
get_security_by_symbol(symbol: str) Retrieves the full name of a security using its ticker symbol (e.g., "DDL""Demerara Distillers Limited").
get_recent_trade(symbol: str) Returns the most recent trade information for the given security.
get_security_recent_year(symbol: str) Fetches all trade data for the most recent year of the selected security.
get_session_trades(session: str) Retrieves trade data for all securities during a specific trading session.
get_security_session_trade(symbol: str, session: str) Retrieves trade data for a specific security in a given trading session.
search_securities(query: str) Searches for securities whose names or ticker symbols match the given query.
get_trades_for_year(symbol: str, year: str) Returns all trade records for a specific security during a given year.
get_historical_trades(symbol: str, start_date: str, end_date: str) Fetches historical trade data for a security within the specified date range (dd/mm/yyyy, mm/yyyy, yyyy format).

Data Utilities

Function Description
to_dataframe(data) Converts a list (or dictionary) of trade data into a Pandas DataFrame for easy analysis. Raises TypeError if the data is not properly formatted.
save_to_csv(data, filename: str = "output.csv", path: str = None) Saves the given data to a CSV file. By default, the file is saved to the current working directory. Returns True after saving successfully.
save_to_excel(data, filename: str = "output.xlsx", path: str = None) Saves the given data to an Excel .xlsx file. By default, the file is saved to the current working directory. Returns True after saving successfully.

Caching System

FinanceGY includes a lightweight local caching system designed to speed up repeated requests and reduce unnecessary calls.

Whenever you call a data retrieval function (such as get_securities() or get_recent_trade()), FinanceGY automatically checks whether a cached response already exists for that specific query:

  • If a valid cache file (less than 7 days old since sessions are held once per week) is found, the result is returned instantly from the cache.
  • If the cache is missing, disabled, or older than one week, FinanceGY fetches fresh data from the GSE and updates the cache automatically.

All cache files are stored in a local cache/ directory as small JSON files containing the retrieved data and a timestamp.

You can manually clear all cached data at any time:

import financegy

financegy.clear_cache()

This will delete all cached files and force the next data request to fetch fresh data directly from the source.

If you prefer to bypass the cache for a specific call, simply pass use_cache=False to any function. For example:

# Force a fresh fetch from the GSE, ignoring cached data
recent_trade = financegy.get_recent_trade("DDL", use_cache=False)

By default, caching is enabled for all supported functions unless explicitly turned off.


License

This project is licensed under the MIT License


Example Use Case

import financegy

ddl_recent = financegy.get_security_recent("DDL")
print(ddl_recent)

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

financegy-1.5.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

financegy-1.5-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file financegy-1.5.tar.gz.

File metadata

  • Download URL: financegy-1.5.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for financegy-1.5.tar.gz
Algorithm Hash digest
SHA256 3ab68ae2e89cd3f40b6a528a3d56ec2f9e6d2acdd3d5f05f9af1409d289a4b1d
MD5 aa684943afd714c15a0a1d3dbcb4bc75
BLAKE2b-256 9da5607525ac452cfd4792baf76f47ae8d5b2c0a6da2f8effae68356de6a0d19

See more details on using hashes here.

File details

Details for the file financegy-1.5-py3-none-any.whl.

File metadata

  • Download URL: financegy-1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for financegy-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 253a0be29d0ad01ffffb8a8543665124f13ef98371c3c2181b5ad1e3c28c4319
MD5 ff098271df0493707c4a04975a8690cd
BLAKE2b-256 70077693de2babf0d216ed281e00d3be8d195482552891ce3bba4c57543e6015

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