Skip to main content

DET Quant Library

Table of Contents

Overview

The DET Quant Library is an internal library containing functions and classes that can be used across Quant models.

Snapshot Testing

The detquantlib.snapshot_testing package provides snapshot (regression) tests for Quant models: each test runs a model end to end on a fixed set of inputs, and compares its outputs with a reviewed reference copy. Database calls are recorded once, locally, and replayed from disk in CI, which has no database access. The SnowflakeClient and AzureClient classes are supported out of the box.

See the snapshot testing guide for how the framework works and how to set it up in a model repository.

Exposed Symbols

Some of the package's symbols (i.e. functions, classes, modules, etc.) are exposed via __init__.py files. They can therefore be imported with a more concise notation that does not require specifying their full path.

This section references all exposed symbols, and for each one of them, provides an exhaustive list of the ways they can be imported.

Note: The list below is auto-generated and can be udpated with the following command in the terminal:

poetry run python docs.py

List of Exposed Symbols

Classes:

  • AzureClient:
    • from detquantlib.data import AzureClient
    • from detquantlib.data.databases.azure_client import AzureClient
  • AzureConfig:
    • from detquantlib.data import AzureConfig
    • from detquantlib.data.databases.azure_client import AzureConfig
  • BatteryState:
    • from detquantlib.assets import BatteryState
    • from detquantlib.assets.battery import BatteryState
  • DbCacheMissError:
    • from detquantlib.snapshot_testing import DbCacheMissError
    • from detquantlib.snapshot_testing.errors import DbCacheMissError
  • DetDatabase:
    • from detquantlib.data import DetDatabase
    • from detquantlib.data.databases.detdatabase import DetDatabase
  • Entsoe:
    • from detquantlib.data import Entsoe
    • from detquantlib.data.entsoe.entsoe import Entsoe
  • NetworkAccessBlockedError:
    • from detquantlib.snapshot_testing import NetworkAccessBlockedError
    • from detquantlib.snapshot_testing.errors import NetworkAccessBlockedError
  • OutputItem:
    • from detquantlib.outputs import OutputItem
    • from detquantlib.outputs.outputs_interface import OutputItem
  • OutputSet:
    • from detquantlib.outputs import OutputSet
    • from detquantlib.outputs.outputs_interface import OutputSet
  • PathDefinitions:
    • from detquantlib.outputs import PathDefinitions
    • from detquantlib.outputs.outputs_interface import PathDefinitions
  • Sftp:
    • from detquantlib.data import Sftp
    • from detquantlib.data.sftp.sftp import Sftp
  • SnapshotCase:
    • from detquantlib.snapshot_testing import SnapshotCase
    • from detquantlib.snapshot_testing.cases import SnapshotCase
  • SnapshotConfig:
    • from detquantlib.snapshot_testing import SnapshotConfig
    • from detquantlib.snapshot_testing.config import SnapshotConfig
  • SnowflakeClient:
    • from detquantlib.data import SnowflakeClient
    • from detquantlib.data.databases.snowflake_client import SnowflakeClient
  • SnowflakeConfig:
    • from detquantlib.data import SnowflakeConfig
    • from detquantlib.data.databases.snowflake_client import SnowflakeConfig
  • TennetAPIError:
    • from detquantlib.data import TennetAPIError
    • from detquantlib.data.tennet.tennet_client import TennetAPIError
  • TennetClient:
    • from detquantlib.data import TennetClient
    • from detquantlib.data.tennet.tennet_client import TennetClient
  • WindTurbine:
    • from detquantlib.assets import WindTurbine
    • from detquantlib.assets.wind_turbine import WindTurbine
  • WindTurbineModels:
    • from detquantlib.assets import WindTurbineModels
    • from detquantlib.assets.wind_turbine import WindTurbineModels

Functions:

  • create_case:
    • from detquantlib.snapshot_testing import create_case
    • from detquantlib.snapshot_testing.cases import create_case
  • discover_cases:
    • from detquantlib.snapshot_testing import discover_cases
    • from detquantlib.snapshot_testing.cases import discover_cases
  • list_to_sql_columns:
    • from detquantlib.data import list_to_sql_columns
    • from detquantlib.data.databases.helpers import list_to_sql_columns
  • list_to_sql_set:
    • from detquantlib.data import list_to_sql_set
    • from detquantlib.data.databases.helpers import list_to_sql_set
  • print_cases:
    • from detquantlib.snapshot_testing import print_cases
    • from detquantlib.snapshot_testing.cases import print_cases

Configuration

Project Structure

The project mainly follows the standard Poetry structure:

detquantlib
├── pyproject.toml
├── README.md
├── detquantlib
│   └── __init__.py
└── tests
    └── __init__.py

Dependencies

Dependency Manager

Project dependencies are managed by Poetry.

Dependabot

Automated dependency updates are executed with Dependabot.

GitHub Actions

The project's CI/CD pipeline is enforced with GitHub actions workflows.

Workflow: Continuous Integration (CI)

The continuous integration (CI) workflow runs tests to check the integrity of the codebase's content, and linters to check the consistency of its format.

The workflow was inspired by the following preconfigured templates:

  • Python package: A general workflow template for Python packages.
  • Poetry action: A GitHub action for installing and configuring Poetry.
Invoke Tasks

The workflow's checks and linters are specified with Invoke tasks, defined in a tasks.py file.

Invoke tasks can be executed directly from the terminal, using the inv (or invoke) command line tool.

For guidance on the available Invoke tasks, execute the following command in the terminal:

inv --list

Use the -h (or --help) argument for help about a particular Invoke task. For example:

inv lint -h
CI Check: Testing

Code changes are tested with the Pytest package.

The CI check is executed with the following Invoke task:

inv test -c
CI Check: Code Formatting

Linters are used to check that the code is properly formatted:

The CI check is executed with the following Invoke task:

inv lint -c

If the CI check fails, execute the following command in the terminal:

inv lint

This command fixes the parts of the code that should be reformatted. Adding the -c (or --check) optional argument instructs the command to only check if parts of the code should be reformatted, without applying any actual changes.

Workflow: Package Publisher

The package publisher workflow checks the validity of package version updates, creates version tags, and publishes package updates to PyPI.

Checking Version Updates

The workflow enforces version control:

  • The version number is specified via the version field in the pyproject.toml file.
  • The version number needs to be updated with every new master commit. If the version is not updated, the GitHub workflow will fail.
  • Version numbers should follow semantic versioning (i.e. X.Y.Z). That is:
    • X increments represent major, non-backward compatible updates.
    • Y increments represent minor, backward compatible functionality updates.
    • Z increments represent patch/bugfix, backward compatible updates.
Creating Version Tags

If the new package version is valid, the workflow automatically creates a new tag for every new master commit.

Publishing Package Updates to PyPI

The workflow automatically publishes every new master commit to PyPI.

Release Notes

When deemed necessary (especially in case of major updates), developers can document code changes in dedicated GitHub release notes.

Release notes can be created via https://github.com/Dynamic-Energy-Trading/detquantlib/releases.

In any case, all codes changes should always be properly described/documented in GitHub issues and/or pull requests.

Metadata

Release files for detquantlib 5.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for detquantlib 5.10.2
File Size Uploaded Provenance Actions
detquantlib-5.10.2.tar.gz 80.4 kB Without provenance Details for detquantlib-5.10.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for detquantlib 5.10.2
File Interpreter ABI Platform Actions
detquantlib-5.10.2-py3-none-any.whl Python 3 none any Details for detquantlib-5.10.2-py3-none-any.whl

Total release size: 175.0 kB

Release files / detquantlib-5.10.2.tar.gz

Download URL detquantlib-5.10.2.tar.gz
Size 80.4 kB
Tags Source
SHA-256 checksum
How to use checksums
55e5df2ed72289217cc1a2d014059bae19d708fb04279f9d5524e2bbb8371681
BLAKE2b-256 checksum
How to use checksums
29d6c1cc4d656b93f81d0510448da3f3940d0e8f2a76345fc7fd8f9da88b6962
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.17 Linux/7.0.0-1017-azure

Release files / detquantlib-5.10.2-py3-none-any.whl

Download URL detquantlib-5.10.2-py3-none-any.whl
Size 94.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d10a7cc4fe752cc22b991222908df846fd46ac827d8c806c3eff3fb8997cfca1
BLAKE2b-256 checksum
How to use checksums
14b529becd07485f8800f7abcd3397aaa045f95b748c66615add79105cdcf492
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.17 Linux/7.0.0-1017-azure

Security for detquantlib 5.10.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

5.10.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page