Skip to main content

Directed Acyclic Graph (DAG) management specifically for financial data workflows.

Project description

finance-dag: a finance focused DAG library for Python

Test status PyPI package Docs

Introduction

finance-dag is a Python library for managing Directed Acyclic Graphs (DAGs) specifically built for financial data workflows, such as portfolio rebalancing and risk calculations.

Installing

Requires Python 3.12+. Download and install the latest release:

pip install finance-dag

Quick Start

Define your financial logic using the ReactiveMixin and decorate your nodes with @node. Dependencies are resolved automatically.

from fdag import ReactiveMixin, node


class Portfolio(ReactiveMixin):
    @node
    def node_total_value(self) -> float:
        return self.node_cash() + self.node_equity()

    @node
    def node_cash(self) -> float:
        return 1000.0

    @node
    def node_equity(self) -> float:
        return 5000.0


if __name__ == "__main__":
    portfolio = Portfolio()

    # Calculates cash, equity, and total_value automatically
    print("Total Value:", portfolio.node_total_value())  # 6000.0

    # Cached access (instantaneous)
    print("Cached Value:", portfolio.node_total_value())

    # Changing value invalidates a base node; cascades to dependent nodes
    portfolio.node_equity = 3000

    # Recalculates total_value on next access
    print("Recalculated Value:", portfolio.node_total_value())  # 4000.0

Documentation

Features

  • Application Modeling: model relationships between entities in a straight-forward way
  • Dependency Tracking: automatically infers and tracks dependencies between nodes
  • Caching and Recalculation: caches computed values, invalidates only affected dependent nodes, and recomputes them when needed
  • Graph Evaluation: eagerly evaluates static parts of the graph while lazily computing reactive nodes on demand

License

This project is licensed under the Apache License, Version 2.0. See LICENSE.txt for the full text.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

finance_dag-0.1.0.dev7-cp312-cp312-win_amd64.whl (183.0 kB view details)

Uploaded CPython 3.12Windows x86-64

finance_dag-0.1.0.dev7-cp312-cp312-win32.whl (145.4 kB view details)

Uploaded CPython 3.12Windows x86

finance_dag-0.1.0.dev7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (386.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

finance_dag-0.1.0.dev7-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (376.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686manylinux: glibc 2.5+ i686

finance_dag-0.1.0.dev7-cp312-cp312-macosx_11_0_arm64.whl (156.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

File details

Details for the file finance_dag-0.1.0.dev7-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for finance_dag-0.1.0.dev7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 46dce089599545267f09c788e9a9647cc340ab7e4cf3de20f4f4cd0fd0d36edd
MD5 c9c60d76463c8786e06d63c9603b79d3
BLAKE2b-256 59f18ca93f329c20f6474f790533617f0f2be0125740d617275b7981a07e1e25

See more details on using hashes here.

Provenance

The following attestation bundles were made for finance_dag-0.1.0.dev7-cp312-cp312-win_amd64.whl:

Publisher: release.yml on tinamou8/finance-dag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file finance_dag-0.1.0.dev7-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for finance_dag-0.1.0.dev7-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 670064c295e467dbc87d30a545b7a2a1b064275a62cacb9f09a6199e245abf4a
MD5 dd61fe89366186b7dced4ae8506137f1
BLAKE2b-256 33d3e44237bb9000c0d8c73d5e25769140ae809bff83e2d6c419147024f33132

See more details on using hashes here.

Provenance

The following attestation bundles were made for finance_dag-0.1.0.dev7-cp312-cp312-win32.whl:

Publisher: release.yml on tinamou8/finance-dag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file finance_dag-0.1.0.dev7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for finance_dag-0.1.0.dev7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9bb89fbc7d11b93697d7fc246be14f58751eab98a2af1aba71ef1197123cee4c
MD5 05a6cffd4fd7c748c10d81852fffa255
BLAKE2b-256 3f1886d50737b2d2bb0b77a06a37de9af3df0915b2b7c9698af4fbce12785b36

See more details on using hashes here.

Provenance

The following attestation bundles were made for finance_dag-0.1.0.dev7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on tinamou8/finance-dag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file finance_dag-0.1.0.dev7-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for finance_dag-0.1.0.dev7-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 b3d91f34d0b69910c1a3739683fba6be9abb162ed975f456e352052116030033
MD5 55352ad9b7f803bec5d9f13ab85e4220
BLAKE2b-256 d1497db5f6c1924a23cd0461bd8c2985a55453087935f56a518885923e4842dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for finance_dag-0.1.0.dev7-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl:

Publisher: release.yml on tinamou8/finance-dag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file finance_dag-0.1.0.dev7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for finance_dag-0.1.0.dev7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0a4f006b5acacd06777c7bc24bfdb05738ed9199818034d615038a284da82b7f
MD5 7b354f63e8c5fe3af4e5710562c6110c
BLAKE2b-256 edb09ff93ae6d0bb8ac355fbe2d41d8bbac506a341f62b3ae3cda9f441c21ddc

See more details on using hashes here.

Provenance

The following attestation bundles were made for finance_dag-0.1.0.dev7-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on tinamou8/finance-dag

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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