Module Contents



Abstract class to fetch data from multiple sources.


class finalynx.fetch.source_base.SourceBase(name: str, _type: type, item_name: str, cache_validity: int = 12)[source]

Abstract class to fetch data from multiple sources.


This is an abstract class to provide a common interface when fetching investments from multiple sources.


Contributions to add data from any format or source are warmly welcome!

  • name – A unique name to identify this source instance, the id used to activate this source is the lower-case name.

  • _type – Used by children classes to specify what type of object the source generates.

  • cache_validity – Finalynx will save fetched results to a file and reuse them on the next run if the cache age is less than the specified number of hours.

_fetch(clear_cache: bool) rich.tree.Tree[source]

Fetch items from the source.


clear_cache – Delete cached data to immediately fetch data online, defaults to False


A Tree object from the rich package used to display what has been fetched.

abstract _fetch_data(tree: rich.tree.Tree) None[source]

Abstract method, must be averridden by children classes. This method retrieves the data from the source, and calls _register_fetchline to create a FetchLine instance representing each fetched investment.

_get_cache() List[Any][source]

Attempt to retrieve the cached data. Check if more than an hour has passed since the last update.


A key:amount dictionary if the cache file is less than an hour old, None otherwise.

_save_cache() None[source]

Save the fetched data locally to work offline and reduce the amoutn of calls to the API.


tree – Generated tree object containing all information

_log(message: str, **kwargs: Any) None[source]
property id: str