A functional reactive platform used to process time-series streams. Provides support for backtest (simulation) and realtime time-series processing. Using a forward propagation graph with a microtask scheduler for the runtime engine.


Keywords
reactive, graph, fpg, forward, propogating, time, series, functional, programming, frp, time-series
License
MIT
Install
pip install hgraph==0.1.3

Documentation

hgraph

A functional reactive programming engine with a Python front-end.

This provides a DSL and runtime to support the computation of results over time, featuring a graph based directed acyclic dependency graph and the concept of time-series properties. The language is function-based, and promotes composition to extend behaviour.

Here is a simple example:

from hgraph import graph, run_graph, const
from hgraph.nodes import debug_print

@graph
def main():
    a = const(1)
    c = a + 2
    debug_print("a + 2", c)

run_graph(main)

Results in:

[1970-01-01 00:00:00.000385][1970-01-01 00:00:00.000001] a + 2: 3

See this for more information.

Development

The project is currently configured to make use of Poetry for dependency management. Take a look at the website to see how best to install the tool.

Here are some useful commands:

First, this will cause the virtual environment to be installed in the same folder as the project (in .venv folder)

poetry config virtualenvs.in-project true

Use this command to set the version of Python to make use of if you want a specific version of Python.

poetry env use 3.11

Then use the following command to install the project and its dependencies. Note that the --with docs installs the dependencies to build the documentation set which is not required otherwise, also the --all-extras is only required for the adaptors.

poetry install --with docs --all-extras

If you did not use the first command, you can find the location of the installation using:

poetry env info

PyCharm can make use of poetry to setup the project.

Run Tests

# No Coverage
poetry run pytest
# Generate Coverage Report
poetry run pytest --cov=your_package_name --cov-report=xml